A continuación se muestra un ejemplo de un contador de 8 bits:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity cont8 is
port (clk : in std_logic; - Reloj
clear : in std_logic;
q : out std_logic_vector (7 downto 0)); -Salida
end cont8;
architecture beh of cont8 is
signal cuenta : std_logic_vector (7 downto 0);
begin
output: process(clk,clear)
begin
if (clear='0') then
q<="00000000";
cuenta<="00000000";
elsif (clk'event and clk='1') then
cuenta<=(cuenta+1);
q<=cuenta;
end if;
end process;
end beh;
Juan Gonzalez 2003-12-31