Glitch: solución 2: creación de guarda de estado 'viejo'
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, viejo:std_logic_vector(3 downto 0);
beginprocess(clk, reset)
beginif reset='1' then actual<=(others=>'0');
elsif clk'event and clk='1' thenviejo <= actual;
actual<=actual+1;end if;
end process;
q<=actual;
tc <= '1' when (viejo=14)and(actual=15) else '0';end rtl;