Guest
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
ENTITY MOORE IS
PORT(Clock,RQA,RQB,TC,INIT : IN STD_LOGIC;
Q,CEN,AKB,AKA,LDC : OUT STD_LOGIC);
END ENTITY MOORE;
ARCHITECTURE Behavior OF MOORE IS
TYPE State_type IS (Q,CEN,AKB,AKA,LDC) ;
SIGNAL current_state : state_type ;
SIGNAL next_state : state_type ;
BEGIN
NEXT_State_PROCROCESS(current_state,INIT,RQA,RQB,TC)
BEGIN
CASE current_state IS
WHEN wait_for_INIT => IF INIT='0' and RQA='0' and RQB='0'THEN
next_state <= Q ;
ELSIF INIT='1' and RQA='1' and RQB='0'THEN
next_state <=AKA;
ELSIF INIT='1' and RQA='1'THEN
next_state <=AKA;
ELSIF INIT='1' and RQA='0'THEN
next_state <=LDC;
ELSIF INIT='1'THEN
next_state <=CEN;
ELSIF INIT='1' and RQB='1'THEN
next_state <=AKB;
ELSIF INIT='1' and RQB='1'THEN
next_state <=AKB;
ELSIF INIT='1' and RQB='0'THEN
next_state <=LDC;
ELSIF INIT='1'THEN
next_state <=CEN;
ELSIF INIT='1'and TC='0' THEN
next_state <=CEN;
ELSIF INIT='1'and TC='1' THEN
next_state <=Q;
END IF;
END CASE;
END PROCESS NEXT_State_PROC;
State_Register_ProcROCESS(Clock)
BEGIN
IF Clock'EVENT and Clock='1'THEN
IF rising_edge(Clock)THEN
IF INIT='0'THEN
current_state<=wait_for_INIT;
ELSE
current_state<=next_state;
END IF;
END IF;
END IF;
END PROCESS State_Register_Proc ;
END Behavior ;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
ENTITY MOORE IS
PORT(Clock,RQA,RQB,TC,INIT : IN STD_LOGIC;
Q,CEN,AKB,AKA,LDC : OUT STD_LOGIC);
END ENTITY MOORE;
ARCHITECTURE Behavior OF MOORE IS
TYPE State_type IS (Q,CEN,AKB,AKA,LDC) ;
SIGNAL current_state : state_type ;
SIGNAL next_state : state_type ;
BEGIN
NEXT_State_PROCROCESS(current_state,INIT,RQA,RQB,TC)
BEGIN
CASE current_state IS
WHEN wait_for_INIT => IF INIT='0' and RQA='0' and RQB='0'THEN
next_state <= Q ;
ELSIF INIT='1' and RQA='1' and RQB='0'THEN
next_state <=AKA;
ELSIF INIT='1' and RQA='1'THEN
next_state <=AKA;
ELSIF INIT='1' and RQA='0'THEN
next_state <=LDC;
ELSIF INIT='1'THEN
next_state <=CEN;
ELSIF INIT='1' and RQB='1'THEN
next_state <=AKB;
ELSIF INIT='1' and RQB='1'THEN
next_state <=AKB;
ELSIF INIT='1' and RQB='0'THEN
next_state <=LDC;
ELSIF INIT='1'THEN
next_state <=CEN;
ELSIF INIT='1'and TC='0' THEN
next_state <=CEN;
ELSIF INIT='1'and TC='1' THEN
next_state <=Q;
END IF;
END CASE;
END PROCESS NEXT_State_PROC;
State_Register_ProcROCESS(Clock)
BEGIN
IF Clock'EVENT and Clock='1'THEN
IF rising_edge(Clock)THEN
IF INIT='0'THEN
current_state<=wait_for_INIT;
ELSE
current_state<=next_state;
END IF;
END IF;
END IF;
END PROCESS State_Register_Proc ;
END Behavior ;