Glitch: solución 1: activación de tc por flanco de bajada
De esta forma se evitan las transiciones producidas por el cambio de estado
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity comptador is port( clk, reset:in std_logic;
tc: out std_logic;
q: out std_logic_vector(3 downto 0));end comptador ;
architecture rtl of comptador is
signal actual:std_logic_vector(3 downto 0);
beginprocess(clk, reset)
if reset='1' then actual<=(others=>'0');
elsif clk'event and clk='1' then actual<=actual+1;
end if;end process;
q<=actual;
process
beginwait until clk='0';
if actual = 15 then tc <= '1';
else tc <= '0';
end if;end process;
end rtl;