Advertisement
Guest User

Untitled

a guest
Sep 19th, 2014
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.84 KB | None | 0 0
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3.  
  4. entity Upp2 is port (
  5. SW0,SW1,SW2,SW3: in std_logic;
  6. HEX0: out std_logic_vector(6 downto 0));
  7. end Upp2;
  8.  
  9. architecture arch of Upp2 is
  10. begin
  11.     process(SW0,SW1,SW2,SW3)
  12.         variable swich: std_logic_vector(3 downto 0);
  13.     begin
  14.    
  15.     swich := SW3 & SW2 & SW1 & SW0;
  16.     case swich is
  17.         when "0000" =>
  18.            HEX0 <= "1000000";
  19.         when "0001" =>
  20.            HEX0 <= "1111001";
  21.         when "0010" =>
  22.            HEX0 <= "0100100";
  23.         when "0011" =>
  24.            HEX0 <= "0110000";
  25.         when "0100" =>
  26.            HEX0 <= "0011001";
  27.         when "0101" =>
  28.            HEX0 <= "0010010";
  29.         when "0110" =>
  30.            HEX0 <= "0000010";
  31.         when "0111" =>
  32.            HEX0 <= "1111000";
  33.         when "1000" =>
  34.            HEX0 <= "0000000";
  35.         when "1001" =>
  36.            HEX0 <= "0011000";
  37.         when others =>
  38.            HEX0 <= "0111111";
  39.     end case;
  40.      end process;
  41. end arch;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement