Altera_Forum
Honored Contributor
18 years agoRunning into infinite loop problems
I'm relatively new to Quartus and I'm trying to define a latch with three outputs and the following properties:
L M | Q(t+1) | R(t+1) | S(t+1) ------------------------------ 0 0 | S(t) | Q(t) | R(t) 0 1 | 0 | 1 | 1 1 0 | 1 | 0 | 1 1 1 | Q(t) | R(t) | S(t) So I wrote the following code to do it. Running a functional simulation gets me in an infinite loop. Running a timing simulation results in unanticipated resulting waveform. Perhaps my VHDL code is wrong? LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY newlatch IS PORT (L,M,Clk : IN STD_LOGIC; Q,R,S : OUT STD_LOGIC); END newlatch; ARCHITECTURE Behavior OF newlatch IS SIGNAL LM: STD_LOGIC_VECTOR(1 DOWNTO 0); SIGNAL Q1: STD_LOGIC; SIGNAL R1: STD_LOGIC; SIGNAL S1: STD_LOGIC; BEGIN PROCESS(L,M) BEGIN LM<=L & M; IF Clk = '1' THEN IF LM = "00" THEN Q1<=S1; R1<=Q1; S1<=R1; ELSIF LM = "01" THEN Q1<='0'; R1<='1'; S1<='1'; ELSIF LM= "10" THEN Q1<='1'; R1<='0'; S1<='1'; END IF; Q<=Q1; R<=R1; S<=S1; END IF; END PROCESS; END Behavior;