Advertisement
Tyler_Elric

Counter_60

Sep 20th, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.STD_LOGIC_1164.ALL;
  3. use ieee.std_logic_unsigned.all;
  4.  
  5. entity Counter_60 is
  6. Port ( CLK : in STD_LOGIC;
  7. En : in STD_LOGIC;
  8. Rst : in STD_LOGIC;
  9. Cout : out STD_LOGIC;
  10. Fout : out STD_LOGIC_VECTOR (5 downto 0));
  11. end Counter_60;
  12.  
  13. architecture Behavioral of Counter_60 is
  14. signal time : std_logic_vector(5 downto 0) := "000000";
  15. begin
  16. TT:process(CLK,Rst,En)
  17. Begin
  18. if (CLK='1' and CLK'event) then
  19. if (Rst = '1') then
  20. time <= "000000";
  21. Cout <= '0';
  22. else
  23. if (En = '1') then
  24. if (time < "111011") then
  25. time <= time+1;
  26. if (time = "111010") then
  27. Cout <= '1';
  28. else
  29. Cout <= '0';
  30. End if;
  31. else
  32. time <= "000000";
  33. Cout <= '0';
  34. End if;
  35. End if;
  36. End if;
  37. End if;
  38. End process;
  39. Fout <= time;
  40. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement