-- BCD to 7 segment LED display converter -- written by Anco Snip / John Forcadas -- _________________________________________ -- This is generally reusable VHDL code. count0 is a 4 bit BCD count. -- The LED display is as shown below. -- Both common anode and common cathode implementations are shown. -- DISPLAY FORMAT AND OUTPUTS: -- ______7______ -- 8 | | 9 -- | | -- -----10------ -- 11 | | 12 -- |___________| -- 13 -- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; entity displayc is port(count0: in std_logic_vector(0 to 3); output7, output8, output9, output10, output11, output12, output13: out std_logic); end displayc; architecture LED of displayc is begin -- COMMON ANODE output7 <= not(count0(0) or (count0(1) and count0(3)) or (not count0(0) and count0(2)) or (not count0(0) and not count0(1) and not count0(3))); output8 <= not(count0(0) or (not count0(2) and not count0(3)) or (not count0(2) and count0(1)) or (not count0(3) and count0(1))); output9 <= not(count0(0) or not count0(1) or (not count0(2) and not count0(3)) or (count0(2) and count0(3))); output10 <= not(count0(0) or (not count0(2) and count0(1)) or (count0(2) and not count0(3)) or (not count0(1) and count0(2))); output11 <= not((count0(2) and not count0(3)) or (not count0(3) and not count0(1))); output12 <= not(count0(3) or not count0(2) or count0(1)); output13 <= not(count0(0) or (not count0(3) and not count0(1)) or (not count0(2) and count0(3) and count0(1)) or (count0(2) and not count0(3)) or (count0(2) and not count0(1))); -- COMMON CATHODE -- output7 <= (count0(0) or (count0(1) and count0(3)) or (not count0(0) and count0(2)) or -- (not count0(0) and not count0(1) and not count0(3))); -- output8 <= (count0(0) or (not count0(2) and not count0(3)) or (not count0(2) and count0(1)) -- or (not count0(3) and count0(1))); -- output9 <= (count0(0) or not count0(1) or (not count0(2) and not count0(3)) or -- (count0(2) and count0(3))); -- output10 <= (count0(0) or (not count0(2) and count0(1)) or (count0(2) and not count0(3)) or -- (not count0(1) and count0(2))); -- output11 <= ((count0(2) and not count0(3)) or (not count0(3) and not count0(1))); -- output12 <= (count0(3) or not count0(2) or count0(1)); -- output13 <= (count0(0) or (not count0(3) and not count0(1)) or (not count0(2) and -- count0(3) and count0(1)) or (count0(2) and not count0(3)) or -- (count0(2) and not count0(1))); end LED;