voik3

Untitled

Jun 26th, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.73 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_modulo_16 is
  8.     Port ( Clk : in  STD_LOGIC;
  9.             switch: in STD_LOGIC_vector(1 downto 0);
  10.            poz1 : out  STD_LOGIC_vector(3 downto 0));
  11. end licznik_modulo_16;
  12.  
  13. architecture Behavioral of licznik_modulo_16 is
  14.     signal licznik: std_logic_vector(14 downto 0) := "000000000000000";
  15.     signal miejsce: std_logic;
  16.     begin
  17.     process(Clk)
  18.         begin
  19.             if Clk'event and Clk = '1' then
  20.                 if switch(0) ='1' then
  21.                     if (switch(1) = '1') then
  22.                         licznik <= licznik+1;
  23.                     else
  24.                         licznik <= licznik-1;
  25.                     end if;
  26.                 end if;
  27.             end if;
  28.     end process;
  29.     poz1 <= licznik(14 downto 11);
  30.  
  31. end Behavioral;
Add Comment
Please, Sign In to add comment