In: Computer Science
Show the gate level implementation of a decoder as well as an encoder, then explain the functionality of each one, and show what happens if you connect them together.
- Decoder is a combinational circuit that has ‘n’ input lines and maximum of 2n output lines.
-One of these outputs will be active High based on the combination of inputs present, when the decoder is enabled. That means decoder detects a particular code. The outputs of the decoder are nothing but the min terms of ‘n’ input variables lineslines, when it is enabled.
- Lets consider 2 to 4 decoder, which has 2 inputs and 4 outputs.
fig. 2:4 Decoder
- As shown in above fig. A1 & A2 are two inputs and Y1, Y2, Y3 & Y4 are output lines.
Enable | Inputs | Outputs | ||||
E | A0 | A1 | Y0 | Y1 | Y2 | Y3 |
0 | x | x | 0 | 0 | 0 | 0 |
1 | 0 | 0 | 0 | 0 | 0 | 1 |
1 | 0 | 1 | 0 | 0 | 1 | 0 |
1 | 1 | 0 | 0 | 1 | 0 | 0 |
1 | 1 | 1 | 1 | 0 | 0 | 0 |
-From given Truth table of decoder, we can write the Boolean expression for each output as follows
Y3 = E.A1.A0Y3 = E.A1.A0
Y2 = E.A1.A0′Y2 = E.A1.A0′
Y1 = E.A1′.A0Y1 = E.A1′.A0
Y0=E.A1′.A0′
- In each of above equation there is product of inputs or there complement, so we will use AND gate for product and NOT gate to obtain the complement.
fig. Implementation using logic gate
- Figure shows the decoder circuit using AND and NOT gate. Output will be proper only if enable is high, else when enable is zero output will be zero for each input combination.
- An Encoder is a combinational circuit that has maximum of 2n input lines and ‘n’ output lines.
- It performs the reverse operation of Decoder.
- It will produce a binary code equivalent to the input, which is active High. Therefore, the encoder encodes 2n input lines with ‘n’ bits. It is optional to represent the enable signal in encoders.
- Lets consider 4 to 2 encoder, which has 4 inputs and 2 outputs.
fig. 4:2 Encoder
- As shown in above fig. A1 & A2 are two outputs and Y1, Y2, Y3 & Y4 are input lines.
Inputs | Outputs | ||||
Y0 | Y1 | Y2 | Y3 | A0 | A1 |
0 | 0 | 0 | 1 | 0 | 0 |
0 | 0 | 1 | 0 | 0 | 1 |
0 | 1 | 0 | 0 | 1 | 0 |
1 | 0 | 0 | 0 | 1 | 1 |
-From given Truth table of encoder, we can write the Boolean expression for each output as follows
A1 = Y3+Y2
A0 = Y3+Y1
-We can implement the above two Boolean functions by using two input OR gates.
fig. Implementation using logic gate
- Fig. shows the implementation of encoder using two OR gates.
- When we connect encoder output to the inputs of decoder , at decoder output we will get original output. This happens because encoding and decoding of same input is done. Similarly, when we connect encoder output to the input of decoder , at decoder output we get original input.