-- Contador
-- Declaración de librerías
Library ieee;
Use ieee.std_logic_1164.ALL;
Use ieee.std_logic_unsigned.ALL;
clk, reset: in std_logic;
tc: out std_logic;
q: out std_logic_vector(3 downto 0));
end contador ;
-- Definición de la arquitectura
Architecture rtl of contador
is
signal estat: std_logic_vector(3 downto 0);
beginprocess(clk, reset)
beginif reset='1' then estat<=(others=>'0');
elsif clk'event and clk='1' then
estat<=estat+1;
end if;end process;
q<=estat;
tc <= '1' when estat = 15 else '0';
end rtl;