Design a BCD converter to drive one and only one of the 7seg
Design a BCD converter to drive one (and only one) of the 7-segment displays on the Basys2 board. For example if a3a2a1a0 = 0011, 3 should appear on the 7-segment display. Write the signal assignments statements for segments a through g using VHDL, as presented in Chapter 10.1 of the text. Implement the converter on the Basys2 board. Remember that the 7-segment displays on the Basys2 board are active-low. Use a VHDL circuit description to do this. Do NOT use Schematic Capture. can you solve it with the circuit.
Solution
The VHDL architectural code for BCD to 7-segment decoder is given below:-
library IEEE;
 use IEEE.STD_LOGIC_1164.ALL;
 use IEEE.STD_LOGIC_ARITH.ALL;
 use IEEE.STD_LOGIC_UNSIGNED.ALL;
 
 entity decoder1 is
 port (
 clk : in std_logic;
 bcd : in std_logic_vector(3 downto 0); --BCD input
 segment7 : out std_logic_vector(6 downto 0) -- 7 bit decoded output.
 );
 end decoder1;
 --\'a\' corresponds to MSB of segment7 and g corresponds to LSB of segment7.
 architecture Behavioral of decoder1 is
 
 begin
 process (clk,bcd)
 BEGIN
 if (clk\'event and clk=\'1\') then
 case bcd is
 when \"0000\"=> segment7 <=\"0000001\"; -- \'0\'
 when \"0001\"=> segment7 <=\"1001111\"; -- \'1\'
 when \"0010\"=> segment7 <=\"0010010\"; -- \'2\'
 when \"0011\"=> segment7 <=\"0000110\"; -- \'3\'
 when \"0100\"=> segment7 <=\"1001100\"; -- \'4\'
 when \"0101\"=> segment7 <=\"0100100\"; -- \'5\'
 when \"0110\"=> segment7 <=\"0100000\"; -- \'6\'
 when \"0111\"=> segment7 <=\"0001111\"; -- \'7\'
 when \"1000\"=> segment7 <=\"0000000\"; -- \'8\'
 when \"1001\"=> segment7 <=\"0000100\"; -- \'9\'
 --nothing is displayed when a number more than 9 is given as input.
 when others=> segment7 <=\"1111111\";
 end case;
 end if;
 
 end process;
 
 end Behavioral;

