You are on page 1of 1

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity Contador is
Generic (width:POSITIVE:=8);
Port ( CLK : IN STD_LOGIC;
RESET : IN STD_LOGIC;
ENAMBLE : IN STD_LOGIC;
SALIDA : OUT STD_LOGIC_VECTOR (WIDTH-1 downto
0));
end Contador;
architecture Behavioral of Contador is SIGNAL cnt :
UNSIGNED(width-1 DOWNTO 0); begin
pSeq : process (CLK, RESET)
begin if RESET = '1' then
cnt '0');
elsif (CLK'event and CLK='1') then
if enamble = '1' then
cnt <= cnt + 1;
end if;
end if;
end process;
SALIDA <= std_logic_vector(cnt);
end Behavioral;

You might also like