M
Matt
Guest
Hello,
I wrote this peice of code (a single process state machine) and I
have two INOUT Standard Vectors. When an IOR pin is high, one data bus
should write to the other and vice versa. When I try to simulate this
code in Quartus II, the data bus that should have info written to it
is left as a high impedence. I attempted to cut out any unnesicary
code to allow easier reading. I have surrounded the places I feel are
incorrect in *'s. Any help would be great because this is driving me a
little crazy.
Thank you
ENTITY singleprocess IS
PORT( SA: IN STD_LOGIC_VECTOR (19 downto 0); --system address
lines
D: INOUT STD_LOGIC_VECTOR (7 downto 0); --data bus
DATA: INOUT STD_LOGIC_VECTOR (7 downto 0));
END singleprocess;
----------------------------------------------------------
ARCHITECTURE state_machine OF singleprocess IS
TYPE state IS (state1, state2, state3, SILENT);
SIGNAL pr_state, nx_state: state;
CONSTANT address1: STD_LOGIC_VECTOR (19 downto 0) :=
X"002E8"; --declare base address vector for channel
CONSTANT interrupt: STD_LOGIC_VECTOR (10 downto 0) :=
"00000000001"; --declare interupt vector
SIGNAL FLAG: STD_LOGIC; --used to
inform the internal system an interrupt has been thrown
SIGNAL BASEADDRESS: STD_LOGIC_VECTOR (19 downto 0); --contains
the usable address
BEGIN
BASEADDRESS <= SA AND "11111111111111111000"; --base address
----------------STATE MACHINE----------------------------
PROCESS (RSET, BCLK)
VARIABLE RorW: STD_LOGIC;
BEGIN
IF (RSET='1') THEN
pr_state<=SILENT;
ELSIF (BCLK'EVENT AND BCLK='1' AND AEN ='0' AND
BASEADDRESS=address1) THEN-- AND AEN ='0') THEN
pr_state<=nx_state;
END IF;
CASE pr_state IS
WHEN state1 =>
IF(IOR='0') THEN
*********************************************
D<=DATA;
*********************************************
ELSIF(IOW='0') THEN
*********************************************
DATA<=D;
*********************************************
END IF;
nx_state<= state2;
WHEN state2 =>
IF(IOR='0') THEN
*********************************************
D<=DATA;
*********************************************
RorW:='0'; --IORC and IOWC unset during the
middle of the third clock cycle. This is used to hold vaule.
ELSIF(IOW='0') THEN
*********************************************
DATA<=D;
*********************************************
RorW:='1'; --IORC and IOWC unset during the
middle of the third clock cycle. This is used to hold vaule.
END IF;
nx_state<= state3;
WHEN state3 =>
IF(RorW='0') THEN
*********************************************
D<=DATA;
*********************************************
ELSIF(RorW='1') THEN
*********************************************
DATA<=D;
*********************************************
END IF;
nx_state<= SILENT;
WHEN SILENT =>
D<= "ZZZZZZZZ";
DATA<= "ZZZZZZZZ";
nx_state<= state1;
END CASE;
END PROCESS;
END state_machine;
I wrote this peice of code (a single process state machine) and I
have two INOUT Standard Vectors. When an IOR pin is high, one data bus
should write to the other and vice versa. When I try to simulate this
code in Quartus II, the data bus that should have info written to it
is left as a high impedence. I attempted to cut out any unnesicary
code to allow easier reading. I have surrounded the places I feel are
incorrect in *'s. Any help would be great because this is driving me a
little crazy.
Thank you
ENTITY singleprocess IS
PORT( SA: IN STD_LOGIC_VECTOR (19 downto 0); --system address
lines
D: INOUT STD_LOGIC_VECTOR (7 downto 0); --data bus
DATA: INOUT STD_LOGIC_VECTOR (7 downto 0));
END singleprocess;
----------------------------------------------------------
ARCHITECTURE state_machine OF singleprocess IS
TYPE state IS (state1, state2, state3, SILENT);
SIGNAL pr_state, nx_state: state;
CONSTANT address1: STD_LOGIC_VECTOR (19 downto 0) :=
X"002E8"; --declare base address vector for channel
CONSTANT interrupt: STD_LOGIC_VECTOR (10 downto 0) :=
"00000000001"; --declare interupt vector
SIGNAL FLAG: STD_LOGIC; --used to
inform the internal system an interrupt has been thrown
SIGNAL BASEADDRESS: STD_LOGIC_VECTOR (19 downto 0); --contains
the usable address
BEGIN
BASEADDRESS <= SA AND "11111111111111111000"; --base address
----------------STATE MACHINE----------------------------
PROCESS (RSET, BCLK)
VARIABLE RorW: STD_LOGIC;
BEGIN
IF (RSET='1') THEN
pr_state<=SILENT;
ELSIF (BCLK'EVENT AND BCLK='1' AND AEN ='0' AND
BASEADDRESS=address1) THEN-- AND AEN ='0') THEN
pr_state<=nx_state;
END IF;
CASE pr_state IS
WHEN state1 =>
IF(IOR='0') THEN
*********************************************
D<=DATA;
*********************************************
ELSIF(IOW='0') THEN
*********************************************
DATA<=D;
*********************************************
END IF;
nx_state<= state2;
WHEN state2 =>
IF(IOR='0') THEN
*********************************************
D<=DATA;
*********************************************
RorW:='0'; --IORC and IOWC unset during the
middle of the third clock cycle. This is used to hold vaule.
ELSIF(IOW='0') THEN
*********************************************
DATA<=D;
*********************************************
RorW:='1'; --IORC and IOWC unset during the
middle of the third clock cycle. This is used to hold vaule.
END IF;
nx_state<= state3;
WHEN state3 =>
IF(RorW='0') THEN
*********************************************
D<=DATA;
*********************************************
ELSIF(RorW='1') THEN
*********************************************
DATA<=D;
*********************************************
END IF;
nx_state<= SILENT;
WHEN SILENT =>
D<= "ZZZZZZZZ";
DATA<= "ZZZZZZZZ";
nx_state<= state1;
END CASE;
END PROCESS;
END state_machine;