Altera_Forum
Honored Contributor
13 years agoopen and close door
i write these but i'm not sure
LIBRARY IEEE; USE IEEE.std_logic_1164.all; USE IEEE.std_logic_unsigned.all; ENTITY reg1 IS PORT ( d : in STD_LOGIC; clk : in STD_LOGIC; q : out STD_LOGIC); END reg1; ARCHITECTURE reg1 OF reg1 IS SIGNAL a, b : STD_LOGIC; BEGIN PROCESS (clk) BEGIN IF rising_edge(clk) THEN a <= d; b <= a; q <= b; END IF; END PROCESS; END reg1; process (reset_n, CLOCK) begin if reset_n = '0' then state <= open_1; elsif (rising_edge(CLOCK)) then case state is open_1 => when closed_2=> end case; end if; end process;