Advertisement
Guest User

Untitled

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