Advertisement
voik3

Untitled

Jun 26th, 2019
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.63 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.STD_LOGIC_1164.ALL;
  3. use IEEE.STD_LOGIC_ARITH.ALL;
  4. use IEEE.STD_LOGIC_UNSIGNED.ALL;
  5.  
  6.  
  7. entity licznik_16 is
  8.     Port ( wej : in  STD_LOGIC;
  9.            sw1 : in  STD_LOGIC;
  10.            sw2 : in  STD_LOGIC;
  11.            wyj : out  STD_LOGIC_VECTOR (3 downto 0));
  12. end licznik_16;
  13.  
  14. architecture Behavioral of licznik_16 is
  15. signal licznik : std_logic_vector(11 downto 0):="000000000000";
  16. begin
  17. process(wej)
  18. begin
  19. if (wej'event and sw1='1') then
  20.  
  21. licznik <= licznik + 1;
  22. else
  23. licznik <= licznik - 1;
  24. end if;
  25.  
  26. if (sw2 = '1') then
  27. licznik <= licznik;
  28. end if;
  29.  
  30. end process;
  31.  
  32.  
  33.  
  34. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement