Glitch: solución 3: trabajar con una variable en el proceso
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
beginprocess(clk, reset)
variable actual:std_logic_vector(3 downto 0);begin
if reset='1' then actual:=(others=>'0');
elsif clk'event and clk='1' thenactual:=actual+1;
q<=actual;
if actual=15 then tc <= '1';
else tc <= '0';
end if;end if;
end process;
end rtl;