I just started VHDL coding, and right now have to code a BCD to 7 segment decoder. I am doing a Behavioral design(it's required) but right now I am having trouble on how to code the display.
I know how to code this decoder with just one input and one output, however we have a second output called DIGEN_L which is used as our display. It is an active low bus output that enables each digit of the 7-segment display on our board.
He told us to just program it to '01110 so the fourth digit is always on and the other three are off.
I do not know how to code DIGEN_L into my code, and do not know what the above statement actually means (code wise). Can anyone help? If any clarification is needed on this question, comment and I will edit.
Here is my code:
library IEEE;
ise IEEE.std_logic_1164.all;
library unisim;
use unisim.vcomponents.all;
entity decoder is
port( BCD: in STD_LOGIC_VECTOR (3 downto 0);
( SEGS_L: out STD_LOGIC_VECTOR(5 downto 0);
( DIGEN_L: out STD_LOGIC_VECTOR(3 downto 0));
end decoder;
architecture decoder_arc of decoder is
begin
process(BCD)
begin
DIGEN_L <= "0111";
case BCD is
when "0000"=> SEGS_L <="1111110"; -- '0'
when "0001"=> SEGS_L <="0110000"; -- '1'
when "0010"=> SEGS_L <="1101101"; -- '2'
when "0011"=> SEGS_L <="1111001"; -- '3'
when "0100"=> SEGS_L <="0110011"; -- '4'
when "0101"=> SEGS_L <="1011011"; -- '5'
when "0110"=> SEGS_L <="1011111"; -- '6'
when "0111"=> SEGS_L <="1110000"; -- '7'
when "1000"=> SEGS_L <="1111111"; -- '8'
when "1001"=> SEGS_L <="1111011"; -- '9'
when others=> SEGS_L <="-";
end case;
end process;
end decoder_arc;