www.pudn.com > codeofvhdl2006.rar > BIN2LED.VHD


Library IEEE; 
Use IEEE.std_logic_1164.all; 
Use IEEE.std_logic_unsigned.all; 
Use IEEE.std_logic_arith.all; 
entity bin2led is 
  port (bin : in std_logic_vector (3 downto 0);--internal binary number 
        led : out std_logic_vector (6 downto 0) );--7_segments led display 
end bin2led; 
architecture arch of bin2led is 
begin 
-- segment encoding 
--     0 
--     ---   
--  5 |   | 1 
--     ---   <- 6 
--  4 |   | 2 
--     --- 
--     3 
--anode_common 7_segment led 
  with bin select 
   led<="1111001" when "0001",--1 
        "0100100" when "0010",--2 
	"0110000" when "0011",--3 
	"0011001" when "0100",--4 
	"0010010" when "0101",--5 
	"0000010" when "0110",--6 
	"1111000" when "0111",--7 
	"0000000" when "1000",--8 
	"0010000" when "1001",--9 
	"1000000" when "0000",--0	     
	"0000110" when others;--E for error display 
end arch;