Escolar Documentos
Profissional Documentos
Cultura Documentos
Contadores
Contadores
Contador.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_unsigned.all;
entity contadorupdow is
Port ( clk : in STD_LOGIC;
reset : in STD_LOGIC;
led : out STD_LOGIC_VECTOR (3 downto 0));
end contadorupdow;
Begin
process(clk,reset)
begin
if(reset='1')then
contador<=(others=>'0');
elsif(clk' event and clk= '1') then
contador <= contador+1;
end if;
end process;
led<=contador;
end Behavioral;
1
15/07/2019
entity contadorupdow is
Port ( clk : in STD_LOGIC;
reset : in STD_LOGIC;
led : out STD_LOGIC_VECTOR (3 downto 0);
up_dow : in STD_LOGIC);
end contadorupdow;
Begin
process(clk,reset)
begin
if(reset='1')then
contador<=(others=>'0');
elsif(clk' event and clk= '1') then
if up_dow ='1' then
contador <= contador+1;
else
contador <= contador-1;
end if;
end if;
end process;
led<=contador;
end Behavioral;
2
15/07/2019
Contador Modulo.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_unsigned.all;
entity contadorupdow is
Port ( clk : in STD_LOGIC;
reset : in STD_LOGIC;
led : out STD_LOGIC_VECTOR (3 downto 0));
end contadorupdow;
begin
process(clk,reset)
begin
if(reset='1')then
contador<=(others=>'0');
elsif(clk' event and clk= '1') then
if contador = "0100" then
contador <=(others=>'0') ;
else
contador <= contador+1;
end if;
end if;
end process;
led<=contador;
end Behavioral;