library IEEE; use IEEE.STD_LOGIC_1164.ALL; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values --use IEEE.NUMERIC_STD.ALL; -- Uncomment the following library declaration if instantiating -- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity Detecteur_sequence is Port ( clk : in STD_LOGIC; ps2_clk : in STD_LOGIC; ps2_data : in STD_LOGIC; reset : in STD_LOGIC; an : out STD_LOGIC_VECTOR (3 downto 0); seg : out STD_LOGIC_VECTOR (7 downto 0); led : out STD_LOGIC_VECTOR (7 downto 0)); end Detecteur_sequence; architecture Behavioral of Detecteur_sequence is COMPONENT ps2_keyboard GENERIC( clk_freq : INTEGER := 50_000_000; --system clock frequency in Hz debounce_counter_size : INTEGER := 8); --set such that (2^size)/clk_freq = 5us (size = 8 for 50MHz) PORT( clk : IN STD_LOGIC; --system clock ps2_clk : IN STD_LOGIC; --clock signal from PS/2 keyboard ps2_data : IN STD_LOGIC; --data signal from PS/2 keyboard ps2_code_new : OUT STD_LOGIC; --flag that new PS/2 code is available on ps2_code bus ps2_code : OUT STD_LOGIC_VECTOR(7 DOWNTO 0)); --code received from PS/2 END component; COMPONENT porte port (clk : in std_logic; reset : in std_logic; keyon : in std_logic; keycode : in std_logic_vector(7 downto 0); opendoor : out std_logic); end COMPONENT; signal clk1 : STD_LOGIC; signal ps2_clk1 : STD_LOGIC; signal ps2_data1 : STD_LOGIC; signal ps2_code1 : STD_LOGIC; signal ps2_code_new1 : STD_LOGIC_VECTOR(7 DOWNTO 0); signal reset1 : STD_LOGIC; signal an1 : STD_LOGIC_VECTOR (3 downto 0); signal seg1 : STD_LOGIC_VECTOR (7 downto 0); signal led1 : STD_LOGIC_VECTOR (7 downto 0); signal opendoor1 : STD_LOGIC; signal Gnd,Vcc : std_logic; begin --Gnd <= '0'; Vcc <= '1'; clk1<=clk; ps2_clk1 <= ps2_clk; ps2_data1<=ps2_data; reset1<=reset; --led<="00000000"; ps2_keyboard1:ps2_keyboard port map (clk1,ps2_clk1,ps2_data1,ps2_code1,ps2_code_new1); porte1:porte port map (clk1,reset1,ps2_code1,ps2_code_new1,opendoor1); ctrl:process(opendoor1) begin led<="00000000"; if opendoor1='1' then led<="11111111"; end if; --wait 5000 ms; --led<="00000000"; end process ctrl; end Behavioral;