Implementation of Decoder Using VHDL
Last Updated :
27 Oct, 2022
The decoder is a combinational circuit consists of 'n' no of input lines and '2^n' no of output lines. It decodes the original signal from encoded input signal. Here, a structure of 3:8 line decoder is implemented using hardware level programming language VHDL( VHSIC Hardware Description Language).
This VHDL programming language is used to design models of digital system by Dataflow, Behavioral and Structural style of modeling. VHDL gives us the features like we can generate the circuit diagram as our requirements and can generate wavefronts from which we can check the systems input-output values and compare with it's original truth-table. Moreover, we can perform various Sequential & Concurrent activities within the model as VHDL gives a wide range of descriptive capabilities within a model. VHDL consists of total five types of design units--> Entity , architecture, configuration, package and package body.
The logical circuit diagram is given below:
On the above circuit diagram red line are representing a connection with negation(connected with a nor gate) and black lines are representing normal connection.
The Truth table of the 3:8 Decoder is given below:
Truth Table:
Input | Output |
---|
i2 | i1 | i0 | d0 | d1 | d2 | d3 | d4 | d5 | d6 | d7 |
0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
0 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
So , the output expressions will be:
d0=i2'i1'i0', d1=i2'i1'i0, d2=i2'i1i0',
d3=i2'i1i0, d4=i2i1'i0',d5=i2i1'i0,
d6=i2i1i0', d7=i2i1i0 .
Now the VHDL code implementation is:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity decoder is
Port ( i2,i1,i0 : in STD_LOGIC;
d : out STD_LOGIC_vector(7 downto 0));
end decoder;
architecture Behavioral of decoder is
begin
process(i2,i1,i0)
variable input : std_logic_vector(2 DOWNTO 0);
begin
input:=i2&i1&i0;
case input is
when "000"=>d<="00000001";
when "001"=>d<="00000010";
when "010"=>d<="00000100";
when "011"=>d<="00001000";
when "100"=>d<="00010000";
when "101"=>d<="00100000";
when "110"=>d<="01000000";
when others=>d<="10000000";
end case;
end process;
end Behavioral;
Output:
Stimulated circuit diagram:
Timing Diagram:
From the above timing diagram we can see that the input value is ''010" and corresponding output value is ''00100000'' {d0 to d7 order}which can be verified by it's Truth-table.
Similar Reads
Counter Design using verilog HDL Designing a counter in Verilog means creating a circuit that changes its value (either increasing or decreasing) with each clock pulse.What is Counter?A counter is a logic circuit that counts the incidences of particular events; it is identified traditionally by the frequencies of a clock pulse. Cou
6 min read
Combinational circuits using Decoder Combinational circuits utilizing decoders are basic parts in a computerized plan, assuming a significant part in making an interpretation of parallel data into noteworthy results. Decoders are combinational rationale gadgets that convert twofold information signals into an extraordinary arrangement
8 min read
Multiplexer Design using Verilog HDL The Verilog Hardware Description Language is an important language in the world of digital design where electronic systems are modeled using it. It provides a way of describing and simulating both the behavior and structure of digital circuits; hence, it is an important tool for engineers in hardwar
7 min read
Control Signals Generation using Counter In various digital applications(For example : hardwired control unit) control signals are needed to start, execute and step various operations in a particular time sequence.For this control signals are required and for the generation of control signals, a counter circuit is designed whose outputs ar
2 min read
BCD to 7 Segment Decoder Prerequisite - Number System and base conversionsBinary Coded Decimal (BCD)BCD is the encoding scheme each of the decimal numbers(0-9) is represented by its equivalent binary pattern(which is generally of 4-bits). Seven segment Seven Segment display is an electronic device which consists of seven Li
5 min read
Full Adder using Verilog HDL A full adder is a digital circuit in Verilog HDL that adds three binary numbers. It has two inputs for the numbers to be added, A and B, and one Carry-In input, Cin. The outputs are Sum, S, and Carry-Out, Cout. A full adder has been implemented using Verilog as shown in the previously shared code sn
5 min read