Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.91 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date:    15:26:09 01/10/2017
  6. -- Design Name:
  7. -- Module Name:    source - 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_unsigned.all;
  23.  
  24. -- Uncomment the following library declaration if using
  25. -- arithmetic functions with Signed or Unsigned values
  26. --use IEEE.NUMERIC_STD.ALL;
  27.  
  28. -- Uncomment the following library declaration if instantiating
  29. -- any Xilinx primitives in this code.
  30. --library UNISIM;
  31. --use UNISIM.VComponents.all;
  32.  
  33. entity source is
  34. port(
  35.     prekidaci: in std_logic_vector(7 downto 0);
  36.     desnatipka: in std_logic;
  37.     lijevatipka: in std_logic;
  38.     led: out std_logic_vector(6 downto 0);
  39.     pokaz: inout std_logic_vector(3 downto 0)
  40.     );
  41. end source;
  42.  
  43. architecture Behavioral of source is
  44. signal temp:std_logic_vector(3 downto 0);
  45. begin
  46.     with prekidaci select
  47.         led <= "0000001" when "00000001",
  48.                 "1001111" when "00000010",
  49.                 "0010010" when "00000100",
  50.                 "0000110" when "00001000",
  51.                 "1001100" when "00010000",
  52.                 "0100100" when "00100000",
  53.                 "0100000" when "01000000",
  54.                 "0001111" when "10000000",
  55.                 "0110000" when others;
  56. process(desnatipka)
  57. begin
  58.     if(desnatipka'event and desnatipka='1') then
  59.         temp<=temp+1;
  60.     end if;
  61. end process;
  62.  
  63. process(lijevatipka)
  64. begin
  65.     if(lijevatipka'event and lijevatipka='1') then
  66.         temp<=temp-1;
  67.     end if;
  68. end process;
  69.  
  70. process(temp)
  71. begin
  72.     case temp is
  73.             when "00" => pokaz <= "1110";
  74.             when "01" => pokaz <= "0111";
  75.             when "10" => pokaz <= "1011";
  76.             when "11" => pokaz <= "1101";
  77.     end case;
  78. end process;
  79.  
  80. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement