Decoders,encoders
Decoders,encoders
Decoders
2. Encoders, Priority Encoders
1.Decoders:
Definition:
A decoder is the combinational circuit that converts binary information from ‘n’
input lines to a maximum of output lines.
Problem: 1, Implement a full adder with decoder circuit and two OR gates
Solution:
First write down the truth table for the Full adder whose inputs are x,y,z
and output are S (sum) and C(carry) {do it yourself or refer Full adder}.
S(x,yz)= ∑(1,2,4,7)
C(x,y,z)= ∑(3,5,6,7)
Since there are three inputs, there are total 8 minterms available. Therefore we
need to use 3 line to 8 line decoder. This decoder generates 8 outputs for three
inputs.
To Implement sum S of full adder we have to add the minterms 1,2,4,7 using an
OR gate. Similarly, to implement carry C minterms 3,5,6,7 can be added using
a OR gate.
Z
Note: A function with a long list of minterms requires an OR gate with a large
number of inputs. A function F having a list of k minterms can be expressed in
its complemented form F' with 2n – k minterms. If the number of minterms in a
function is greater than 2n/2, then F' can be expressed with fewer minterms than
required for F. In such a Case it is advantageous to use a NOR gate to sum the
ninterms of F'. The output of the NOR gate will generate the normal output F.
A
B
A D0
D0
D1
B
2 X 4 line decoder D2
D1
D3
D2
D3
E (Enable)
E (Enable)
Fig 1.3 Truth table for the 2 to 4 line decoder with active high enable
When the enable is active high, all the output gates are equal to zero when E=0,
When E=1, it will be enabled as a decoder as we can see from the truth table in
the Fig 1.3.
D0
D1
D2
D3
E (Enable)
Here we can observe that for the active low enable, we have active low
output.The circle in the enable and outputs signify the enable low input, and low
outputs respectively.
The decoder works when the enable input =0 in active low condition otherwise
the all the output will be one irrespective of the input. When enable is in active
low, one of the output will be zero corresponding to particular input. The details
can be analysed from the truth table below.
E A B D0 D1 D2 D3
1 X X 1 1 1 1
0 0 0 0 1 1 1
0 0 1 1 0 1 1
0 1 0 1 1 0 1
0 1 1 1 1 1 0
Fig 1.5 : Truth table for the 2 to 4 line decoder with active low enable
1.2 Demultiplexer:
It has eight inputs, one for each octal digit and three outputs that generate the
corresponding binary number. The truth table shows that Y0 must be 1
whenever the input O1 or O3 or O5 or O7 is high.
Thus, Y0 = O1 + O3 + O5 + O7
Similarly Y1 = O2 + O3 + O6 + O7 and
Y2 = O4 + O5 + O6 + O7.
Using these three expressions, the circuit can be implemented using three 4-
input OR gates as shown in Fig 2.2. thus encoders are implemented using OR
gates.
Fig 2.2 8 x3 encoder (octal to binary encoder)
1. Only one input can be active at any given time. If two or more inputs are
equal to 1 at the same time, the O/P is undefined. For example if O2 and O5 are
active simultaneously, the o/p of encoder will be 111 that is equal to binary 7.
This does not represent binary 2 or 5.
2. The output with all 0’s is generated when all inputs are ‘0’, and is also true
when O0 = ‘1’.
The second problem is taken care by an extra line in the encoder output, called
‘valid output indicator’ that specifies the condition that none of the inputs are
active
Priority encoder:
A priority encoder is an encoder that includes priority function. If two or more
inputs are equal to 1 at the same time, the input having the highest priority will
take precedence. To understand priority encoder, consider a 4 to 2 line encoder
which gives priority to higher subscript number input than lower subscript
number.
The truth table is given below. Truth Table of 4 to 2 line priority encoder:
The X’s are don’t care conditions. Input D3 has the highest priority, so
regardless of values of other inputs, when this input is 1, the output Y1 Y2 = 11.
D2 has next priority level. The o/p is 10 if D2 is 1, provided D3 = 0, irrespective
of the values of the other two lowerpriority inputs. The o/p is 01 if D1 is 1,
provided both D2 and D3 are 0, irrespective of the value of lower-priority input
D0. The o/p is 00 if D0 = 1, provided all other inputs are 0. A valid output
indicator, V is set to 1, only when one or more of the inputs are equal to 1. If all
the inputs are 0, V is equal to 0 and the other two outputs of the circuit are not
used. Now, simplifying using k-map the outputs can be written as :
The logic diagram for a 4 to 2 line priority encoder with ‘valid output indicator’
is shown below in Fig. below