3x8 Decoder Vhdl Code

Posted onby

USEFUL LINKS to VHDL CODES. Refer following as well as links mentioned on left side panel for useful VHDL codes. D Flipflop T Flipflop Read Write RAM 4X1 MUX 4 bit binary counter Radix4 Butterfly 16QAM Modulation 2bit Parallel to serial. RF and Wireless tutorials. Question on VHDL 3 to 8 decoder using two 2 to 4 decoders. I have successfully created the code for this problem using port map dec2to4. I'm having trouble with the test bench at the moment. It only gives me the input but the output is only empty. Here is my code for dec3to8:-library IEEE. Very simple beginner level VHDL and Verilog code to implement 3 to 8 bit binary decoder in xilinx spartan 3E FPGA. Code: library ieee; use ieee.stdlogic1164.all; entity decoder8x3 is port (a,b,c,enable: in stdlogic; d: out stdlogicvector (0 to 7)); end decoder8x3; architecture vdc of decoder8x3 is begin process (a,b,c) begin if enable = '1' then d(0).

A decoder is a combinational logic circuit which is used to change the code into a set of signals. It is the reverse process of an encoder. A decoder circuit takes multiple inputs and gives multiple outputs. A decoder circuit takes binary data of ‘n’ inputs into ‘2^n’ unique output. In addition to input pins, the decoder has a enable pin. This enables the pin when negated, makes the circuit inactive. in this article, we discuss 3 to 8 line Decoder and Multiplexer.

The below is the truth table for simple 1 to 2 line decoder where A is the input and D0 and D1 are the outputs.

The circuit shows the 1 to 2 decoder logic.

A demultiplexer is a device that takes a single input and gives one of the several output lines. A demultiplexer takes one single input data and then selects any one of the single output lines one at a time. It is the reverse process of a multiplexer. It is also called as a DEMUX or a data distributor. A DEMUX converts the input serial data line into output parallel data. A DEMUX gives ‘2n’ outputs for ‘n’ selection lines with a single input.

DEMUX is used when the circuit wishes to send the data signal to one of the many devices. A decoder is used to select among many devices whereas a demultiplexer is used to send the signal to many devices.

3 to 8 encoder vhdl code

The below is the truth table for 1 to 2 demultiplexer with “I” as input data, D0 and D1 are the output data line and A is the selection line.

The circuit shows the 1 to 2 demultiplexer schematic.

3 Line to 8 Line Decoder

This decoder circuit gives 8 logic outputs for 3 inputs and has a enable pin. The circuit is designed with AND and NAND logic gates. It takes 3 binary inputs and activates one of the eight outputs. 3 to 8 line decoder circuit is also called as binary to an octal decoder.

The decoder circuit works only when the Enable pin (E) is high. S0, S1 and S2 are three different inputs and D0, D1, D2, D3. D4. D5. D6. D7 are the eight outputs.

Circuit Diagram

3 to 8 Line Decoder Truth Table

The below table gives the truth table of 3 to 8 line decoder.


When the Enable pin (E) is low all the output pins are low.

1 to 8 Demultiplexer

A 1 line to 8 line demultiplexer has one input, three select input lines and eight output lines. It distributes the one input data into 8 output lines depending on the selected input. Din is the input data, S0, S1, and S2 are select inputs and Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7 are the outputs.

Circuit Diagram

3 to 8 Decoder/Demultiplexer

IC 74HC238 is used is used as decoder/ demultiplexer. 3 to 8 line decoder demultiplexer is a combinational circuit that can be used as both a decoder and a demultiplexer. IC 74HC238 decodes three binary address inputs (A0, A1, A2) into eight outputs (Y0 to Y7). The device also has three Enable pins. The same combination is used as a demultiplexer.

Pin Configuration

The below is the pin configuration for the IC74HC238 3 to 8 line decoder or demultiplexer. It is a 16 pin DIP.


The logical circuit explains the working of the IC 74HC238.

Features of 74HC238 IC

  • Demultiplexing capability
  • Multiple inputs enable for easy expansion
  • Ideal for memory chip select decoding
  • Active HIGH mutually exclusive outputs
  • Multiple package option

Application of Decoder

  • The Decoders were used in analog to digital conversion in analog decoders.
  • Used in electronic circuits to convert instructions into CPU control signals.
  • They mainly used in logical circuits, data transfer.

Applications of Demultiplexer

  • Used to connect a single source to multiple destinations.
  • The Demux is used in communication systems to carry multiple data signals into a single transmission line.
  • Used in Arithmetic Logic Units
  • Used in serial to parallel converters in data communications.

Therefore, this is the basic information about 3 to 8 line decoder and demultiplexers. Hope you might have got some fundamental concepts about this topic by observing the digital logic circuits and truth tables and their applications. Furthermore, any doubts regarding this article or Latest electronics projects, You can write your views about this topic in the comment section below.

Related Content

8 to 3 Encoder VHDL source code

This page of VHDL source code covers 8 to 3 encoder vhdl code.


library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity encoder8to3 is
din : in STD_LOGIC_VECTOR(7 downto 0);
dout : out STD_LOGIC_VECTOR(2 downto 0)
end encoder8to3;
architecture encoder8to3_arc of encoder8to3 is
dout <= '000' when (din='10000000') else
'001' when (din='01000000') else
'010' when (din='00100000') else
'011' when (din='00010000') else
'100' when (din='00001000') else
'101' when (din='00000100') else
'110' when (din='00000010') else
end encoder8to3_arc;


Refer following as well as links mentioned on left side panel for useful VHDL codes.
D Flipflop
T Flipflop
Read Write RAM
4 bit binary counter
Radix4 Butterfly
16QAM Modulation
2bit Parallel to serial

RF and Wireless tutorials

Share this page

3x8 Decoder Vhdl Code Generator

3x8 Decoder Truth Table

Translate this page