You are on page 1of 2

COMPTEUR 3BIT

-- 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 MO_compteur is

Port ( H : in STD_LOGIC;

UN : in STD_LOGIC;

Q : out STD_LOGIC_VECTOR (2 downto 0));

end MO_compteur;

architecture Behavioral of MO_compteur is

signal I : STD_LOGIC_VECTOR(Q'range);

begin

process(H, UN)

begin

if(UN ='0') then

I <="000";

end if;

if (H'event and H='0') then

I <=I + 1;

end if;
end process;

Q <= I;

end Behavioral;

You might also like