What are the differences between decoder and encoder circuits? In this article, first you will learn about the basic definition of encoder and decoder and then you will get the idea of how is an encoder different from the decoder?.
What is a decoder? How to define a decoder?
A combinational logic circuit that is used to decode the coded information is called the decoder. In a decoder circuit, there are n inputs and 2n outputs. Only one output is selected corresponding to a single combination of input. There is another controlling input in the decoder that is the enable input. If the decoder is not enabled, then no output is selected no matter whatever the input is selected.
If E=1, then the value of input combination decides which of the outputs is asserted.
What is meant by one-hot encoded?
An n bit binary code in which one bit is activated or asserted at a time is called one-hot-encoded. It means that the bit that is set is 1 is deemed hot.
The outputs of the binary decoder are one-hot encoded.
A n to 2n output lines binary decoder is shown in the figure below:
Design of a 2 to 4 line decoder circuit
A truth table and graphic symbol of of 2 to 4 line decoder is shown in the figure below
Here w1 and w0 are the two inputs that will assert any of the outputs y0 to y3. It can be seen that when E=0, then whatever the values of w1 and w0 are, all outputs are low. In other words, all inputs are in don’t care condition, when the decoder is disabled.
When the decoder is enabled E=1, then the corresponding output is asserted.
The decoder circuits can be active low or active high. In above example it was as active high circuit. Since an output was asserted when its corresponding input was high.
Logic diagram of 2 to 4 line decoder
Here is the logic diagram of 2 to 4 line decoder circuit
How to design a 3 to 8 line decoder using 2 to 4 line decoder?
Larger decoders can be built from the smaller decoders. In order to design a 3 to 8 line decoder, using 2 to line decoder the third input can be used to derive the enable input of two decoders.
As mentioned above, w2 derives the enable input of the two decoders. When w2=0, top decoder is enabled while disabling the bottom decoder. In this ways all outputs (y4,y5,y6,y7) will be zero and y0,y1,y2, or y3 is selected with respect to the input combination. When w2=1, top decoder is disabled and decoder at bottom is enabled. In this case all outputs (y0 to y3) are zero while any of the outputs is asserted according to the combination of input w0and w1.
The same concept can be used for designing the higher order decoders. Because of treelike structure, these circuits are also named as decoder tree.
Design of 4 to 16 line decoder circuit using a decoder tree
Design of a multiplexer (MUX) using decoder
A decoder with an enable input is called the demultiplexer. What are the differences between decoder and encoder circuits?
Here You will see how to design a 4 to l line MUX using the decoder.
It can be seen that enable input of decoder is not needed and it is set to 1. The four outputs of decoder represent the four values of select inputs.
For understanding the concept of the encoder click here.
How is an encoder different from the decoder?
What are the differences between decoder and encoder circuits?
So far it must be clear by definition and working what are the decoders and encoders. Decoders and encoders are the inverse of each others. Encoders actually do the reverse task of the decoders. So we can say that encoders ‘hide’ or compress the information. While decoders ‘show’ or expand the information. An encoder usually do not need an Enable input while decoders require that mostly.
Application of Decoder Circuit
Here is the application of decoder circuit
- What are the synchronous counters? Explain with an example.
- what are the half adder and full adder circuits?
- what are the half subtractor and full subtractor circuits?
- How to design a four bit adder-subtractor circuit?
- What are number systems in computer?
- Discuss the binary counter with parallel load? Explain its working with an example
- how to draw state diagram of sequential circuit?
- How to simplify a Boolean function using Karnaugh map (k-map)?
- What are the flip flops and registers in digital design?
- Define fan-in, fan-out, CMOS and TTL logic levels
- what is the Canonical form representation of Boolean function?
- What is difference between latches and flip flops?