Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.36 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date:    11:36:51 05/21/2019
  6. -- Design Name:
  7. -- Module Name:    licznikmod4 - Behavioral
  8. -- Project Name:
  9. -- Target Devices:
  10. -- Tool versions:
  11. -- Description:
  12. --
  13. -- Dependencies:
  14. --
  15. -- Revision:
  16. -- Revision 0.01 - File Created
  17. -- Additional Comments:
  18. --
  19. ----------------------------------------------------------------------------------
  20. library IEEE;
  21. use IEEE.STD_LOGIC_1164.ALL;
  22. use IEEE.STD_LOGIC_ARITH.ALL;
  23. use IEEE.STD_LOGIC_UNSIGNED.ALL;
  24.  
  25. -- Uncomment the following library declaration if using
  26. -- arithmetic functions with Signed or Unsigned values
  27. --use IEEE.NUMERIC_STD.ALL;
  28.  
  29. -- Uncomment the following library declaration if instantiating
  30. -- any Xilinx primitives in this code.
  31. --library UNISIM;
  32. --use UNISIM.VComponents.all;
  33.  
  34. entity licznikmod4 is
  35.     Port ( wejscie : in  STD_LOGIC;
  36.            wyjscie : out  STD_LOGIC_VECTOR (1 downto 0));
  37. end licznikmod4;
  38.  
  39. architecture Behavioral of licznikmod4 is
  40. signal liczenie : std_logic_vector(1 downto 0):="00";
  41.  
  42. begin
  43.  
  44.     process (wejscie)
  45.     begin
  46.         if wejscie='1' and wejscie'event then
  47.             if liczenie = "11" then
  48.                 liczenie <= "00";
  49.             else
  50.                 liczenie <= liczenie + 1;
  51.             end if;
  52.         end if;
  53.     end process;
  54. wyjscie <= liczenie;
  55. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement