-- conserv1.vhd -- Eurobot 2004 : APB Team -- Auteur : Pierre-André Galmes -- Lors de la détection d'un front, garde un état haut durant 2 cycles -- d'horloge. Marche sur une patte. library ieee; use ieee.std_logic_1164.all; --use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; use work.isa_const.all; use work.nono_const.all; entity conserv1 is port ( clk : in std_logic; rst : in std_logic; pin_in : in std_logic; pin_out : out std_logic ); end entity; architecture RTL of conserv1 is -- Signal interne signal cycle : std_logic_vector (1 downto 0); begin -- process séquentiel process (rst, clk) begin if (rst = '1') then pin_out <= '0'; cycle <= "00"; elsif (clk'event and clk = '1') then if (cycle = "10") then pin_out <= '0'; cycle <= "00"; end if; -- if (pin_in /= '0' or cycle = "01") then cycle <= cycle + "01"; pin_out <= '1'; end if; end if; end process; -- process combinatoire. end RTL;