Tyler_Elric

Untitled

Mar 10th, 2016
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. LIBRARY ieee ;
  2. USE ieee.std_logic_1164.all ;
  3. ENTITY Lab4 IS
  4.     PORT (  bcd     : IN    STD_LOGIC_VECTOR(3 DOWNTO 0) ;
  5.         leds    : OUT   STD_LOGIC_VECTOR(1 TO 7) ) ;
  6. END Lab4 ;
  7. ARCHITECTURE Behavior OF Lab4 IS   
  8. BEGIN
  9.     PROCESS ( bcd )
  10.     BEGIN
  11.         CASE bcd IS                      ------    abcdefg
  12.             WHEN "0000"     => leds     <=        "0000001" ;
  13.             WHEN "0001"     => leds     <=        "1001111" ;
  14.             WHEN "0010"     => leds     <=        "0010010" ;
  15.             WHEN "0011"     => leds     <=        "0000110" ;
  16.             WHEN "0100"     => leds     <=        "1001100" ;
  17.             WHEN "0101"     => leds     <=        "0100100" ;
  18.             WHEN "0110"     => leds     <=        "0100000" ;
  19.             WHEN "0111"     => leds     <=        "0001111" ;
  20.             WHEN "1000"     => leds     <=        "0000000" ;
  21.             WHEN "1001"     => leds     <=        "0001100" ;
  22.                                          ------    abcdefg
  23.             WHEN "1010"     =>-- ten.
  24.                                   leds <=        "0001000" ;
  25.                                  
  26.             WHEN "1011"     => -- elleven
  27.                                   leds <=        "1100000" ;
  28.                                
  29.             WHEN "1100"     => -- twelve
  30.                                   leds <=        "0110001" ; -- none.
  31.                                  
  32.             WHEN "1101"     => -- thirteen
  33.                                   leds <=        "1000010" ; -- none.
  34.                                  
  35.             WHEN "1110"     => -- fourteen.
  36.                                   leds <=        "0110000" ; -- none.
  37.                                  
  38.             WHEN "1111"     => -- fifteen.
  39.                                   leds <=        "0111000" ;
  40.                                  
  41.             WHEN OTHERS     => -- none.
  42.                                   leds <=        "1111111" ; -- none.
  43.         END CASE ;
  44.     END PROCESS ;
  45. END Behavior ;
Add Comment
Please, Sign In to add comment