cursofpgavhdl

contador09(C/CarryOUT)

Dec 18th, 2019
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.std_logic_1164.all;
  3. use IEEE.std_logic_unsigned.all;
  4.  
  5. entity conta_up is
  6. port (
  7. clk:in bit;
  8. reset: in bit;
  9. carry_out: out bit;
  10. q: out std_logic_vector(3 downto 0)
  11. );
  12. end conta_up;
  13.  
  14. architecture arquitetura of conta_up is
  15. begin
  16. process(clk,reset)
  17. variable qtemp: std_logic_vector(3 downto 0);
  18. begin
  19. if reset='1' then
  20. qtemp:="0000";
  21.  
  22. else
  23. if clk'event and clk='1' then
  24.  
  25. if qtemp<9 then ---
  26. qtemp:=qtemp+1; ---
  27. carry_out <= '0'; ---
  28. else --- CONTADOR CRESCENTE
  29. qtemp:="0000"; ---
  30. carry_out <= '1'; ---
  31. end if; ---
  32.  
  33.  
  34. end if;
  35. q<=qtemp;
  36. end if;
  37. end process;
  38. end arquitetura;
Advertisement
Add Comment
Please, Sign In to add comment