Advertisement
Guest User

licznik_source

a guest
May 20th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.STD_LOGIC_1164.ALL;
  3. use IEEE.STD_LOGIC_UNSIGNED.ALL;
  4.  
  5.  
  6. entity module1 is
  7. Port ( clk : in STD_LOGIC;
  8. res : in STD_LOGIC;
  9. outmod : out STD_LOGIC_VECTOR(3 downto 0));
  10. end module1;
  11.  
  12. architecture Behavioral of module1 is
  13. signal counter : STD_LOGIC_VECTOR (3 downto 0);
  14. begin
  15. process(clk,res)
  16. begin
  17. if(rising_edge(clk)) then
  18. if(res='1') then
  19. counter <= x"0";
  20. else
  21. counter <= counter - x"1";
  22. end if;
  23. end if;
  24. end process;
  25. outmod <= counter;
  26. end architecture;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement