Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library ieee;
- use ieee.std_logic_1164.all;
- use ieee.std_logic_arith.all;
- use ieee.std_logic_unsigned.all;
- use work.std_arith.all;
- entity contador is
- port(clk, reset, ud:in std_logic;
- conta: buffer std_logic_vector( 3 downto 0) );
- end contador;
- architecture archicontador of contador is
- begin
- process (clk)
- begin
- if (clk'event and clk='1') then
- if ud = '1' then
- conta <= conta + 1;
- if (conta ="1001") then
- conta <= "0000";
- end if;
- end if;
- if ud='0' then
- conta <= conta -1;
- if (conta = "0000") then
- conta <= "1001";
- end if;
- end if;
- end if;
- end process;
- end archicontador;
Advertisement
Add Comment
Please, Sign In to add comment