4-bit Binary to 7-Segment LED Converter in VHDL

The following is a simple example of a VHDL program that has a 7-bit output with a 4-bit input. The program is called example, which can be any name that you desire, although it must be uniform throughout the program.

As you can see, there is an output statement for all 16 possible input combinations. The first block defines the W variable as the input variable, with bits 3,2,1, and 0. It also defines F as the output variable, with bits 6,5,4,3,2,1, and 0.

The second block is the behavior block, which defines the behavior of the logic circuit. The "with w select" line tells the compiler that the output is dependent on the W input variable. The following series of lines define the output F for each input variable W.

Entity example is
port(W:in bit_vector (3 downto 0);
F:out bit_vector (6 downto 0));
end example;

architecture behavior of example is
begin
with w select
F<= "0000001" when "0000",
"1001111" when "0001",
"0010010" when "0010",
"0000110" when "0011",
"1001100" when "0100",
"0100100" when "0101",
"0100000" when "0110",
"0001111" when "0111",
"0000000" when "1000",
"0000100" when "1001",
"0000010" when "1010",
"1100000" when "1011",
"0110001" when "1100",
"1000010" when "1101",
"0010000" when "1110",
"0111000" when "1111",
end behavior;

Back

Other Articles That You May Be Interested In:

68HC11 Source Code
The Motorola 68HC11 is a versatile microprocessor that is embedded in many everyday objects. These programs written in assembly were designed specially for it.
Robert Goddard Biography
As one of the earliest pioneers in rocketry, Goddard spurred important technological developments.