3 To 8 Decoder Using Two 2 To 8 Decoder
3 To 8 Decoder Using Two 2 To 8 Decoder
Lesson Objectives
In this lesson, we will learn about
o Decoders
o Expansion of decoders
o Combinational circuit implementation with decoders
o Some examples of decoders
o Encoders
o Major limitations of encoders
o Priority encoders
o Some examples of ecnoders
Decoders
As its name indicates, a decoder is a circuit component that decodes an input code. Given
a binary code of n-bits, a decoder will tell which code is this out of the 2n possible codes
(See Figure 1(a)).
n-to-2n
Decoder
n Inputs
0
1
2n-1
n Inputs
Enable
n-to-2n
Decoder
2 n Outputs
Figure 1(b) shows the block diagram o f a typical decoder, which has n input lines, and m
output lines, where m is equal to 2n . The decoder is called n-to- m decoder. Apart
from this, there is also a single line connected to the decoder called enable line. The
operations of the enable line will be discussed in the flowing text.
o
i.
In general, output i equals 1 if and only if the input binary code has a value of
Thus, each output line equals 1 at only one input combination but is equal to 0 at
all other combinations.
D0 = A1A0
A0
A1
D1 = A1A0
2-to-4
Decoder
D2= A1A0
D3 = A1A0
Input
A1
A0
0
0
0
1
1
0
1
1
D0
1
0
0
0
Output
D1
D2
0
0
1
0
0
1
0
0
D3
0
0
0
1
Notice that, each output of the decoder is actually a minterm resulting from a
certain combination of the inputs, that is
o D0 =A1 A0 , ( minterm m0 ) which corresponds to input
00 o D1 =A1 A0 , ( minterm m1 ) which corresponds to
input 01 o D2 =A1 A0 , ( minterm m2 ) which corresponds
to input 10 o D3 =A1 A0 , ( minterm m3 ) which
corresponds to input 11
This is depicted in Figures 2 where we see that each input combination will
inovke the corresponding output, where each output is minterm corresponding to
the input combination.
A1
A0
D0 = A1A0
D1 = A1A0
D2 = A1A0
D3 = A1A0
Figure 3: Implementation 2-to -4 decoder
The circuit is implemented with AND gates, as shown in figure 3. In this circuit we see
that the logic equation for D0 is A1 / A0 /. D0 is A1 / A0 , and so on. These are in fact
the minterms being implemented. Thus, each output of the decoder generates a minterm
corresponding to the input combination.
truth table (table 2). In this table we see that as long as E is zero, the outputs D0 to
D3 will remain zero, no matter whatever value you provide at the inputs A1 A0 , depicted
by two dont cares. When E becomes 1, then we see the same behavior as we saw in the
case of 2-to-4 decoder discussed earlier.
E
A1
A0
D0
D1
D2
D3
Inputs
A1
X
0
0
1
1
A0
X
0
1
0
1
Outputs
D0
0
1
0
0
0
D1
0
0
1
0
0
D2
0
0
0
1
0
D3
0
0
0
0
1
In a three to eight decoder, there are three inputs and eight outputs, as shown in figure 5.
A0 is the least significant variable, while A2 is the most significant variable.
The three inputs are decoded into eight outputs. That is, binary values at the input form a
combination, and based on this combination, the corresponding output line is activated.
A0
A1
A2
D0 = A2A1A0
D1 = A2A1A0
D2 = A2A1A0
D3 = A2A1A0
D4 = A2A1A0
D5 = A2 A1 A0
D6 = A2A1A0
D7 = A2A1A0
3-to-8
Decoder
Enable
Inputs
Outputs
A2 A1 A0 D 0 D 1 D 2 D 3 D 4 D 5 D 6 D 7
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
Decoder Expansion
o
For example, a 6-to-64 decoder can be designed with four 4-to-16 decoders and one
2-to-4 line decoder.
Some decoders are constructed with NAND rather than AND gates.
In this case, all decoder outputs will be 1s except the one corresponding to the input
code which will be 0.
Decimal #
0
1
2
3
Input
A1
A0
0
0
0
1
1
1
1
1
D0
0
1
1
1
Output
D1 D2
1
1
0
1
1
0
1
1
D3
1
1
1
0
E
0
1
2
3
1
0
0
0
0
Inputs
A1
X
0
0
1
1
A0
X
0
1
1
1
Outputs
D0
1
0
1
1
1
D1
1
1
0
1
1
D2
1
1
1
0
1
D3
1
1
1
1
0
Table 5: Truth table of 2-to -4 decoder with Enable using NAND gates
A 2-to-4 line decoder with an enable input constructed with NAND gates is shown in
figure 8. The circuit operates with complemented outputs and enable input E is also
complemented to match the outputs of the NAND gate decoder. The decoder is enabled
when E is equal to zero. As indicated by the truth table, only one output can be equal to
zero at any given time, all other outputs being equal to one. The output with the value of
zero represents the minterm selected by inputs A1 and A0 . The circuit is disabled when
E is equal to one, regardless of the values of the other two inputs. When the circuit is
disabled, none of the outputs are equal to zero, and none of the minterms are selected.
The corresponding logic equations are also given in table 5.
Remember,
that
o The function need not be simplified since the decoder implements a function using
the minterms, not product terms.
o
Let us look at the truth table (table 6) for the given problem. We have two outputs, called
S, which stands for sum, and C, which stands for carry. Both sum and carry are functions
of X, Y, and Z.
Decimal
value
Input
0
1
2
3
4
5
6
7
Output
0
0
0
1
1
0
1
1
0
0
1
1
0
0
0
1
1
0
0
1
1
1
1
1
0
1
0
1
1
1
20
21
22
0
1
2
3
4
5
6
7
Encoders
o
o
o
o
2 Inputs
n Outputs
Outputs
E0 A2 A1 A0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
1
0
0
0
1
1
0
1
0
0
0
1
0
1
0
1
1
0
0
1
1
1
Decimal
Code
0
1
2
3
4
5
6
7
8 Inputs
E0
E1
E2
E3
E4
E5
E6
E7
A0
8-to-3
Encoder
3 Outputs
A1
A2
Solution To Problem 2:
o Provide one more output signal V to indicate validity of input data.
o V = 0 if none of the inputs equals 1, otherwise it is 1
E2
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
1
E1
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
E0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
A1
X
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
A0
X
0
1
1
0
0
0
0
1
1
1
1
1
1
1
1
V
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
Invalid
Input
precedence compared to E0 and E1 . Although E0 and E1 are also having a value of one
in this set of four combinations, but they do not have the priority.
Finally we have the last eight input combinations, whose output is 11. This is because E3
is the highest priority input, and it is equal to 1. Though the other inputs with smaller
subscripts, namely, E2, E1, and E0 are also having values of one in some combinations,
but they do not have the priority.
The truth table can be rewritten in a more compact form using dont care conditions for
inputs as shown below in table 9.
Inputs
1
2
3
4
5
E3 E2
0
0
0
0
0
0
0
1
1 X
E1 E0
0
0
0
1
1 X
X X
X X
Outputs
A1 A0 V
X X 0
0
0 1
0
1 1
1
0 1
1
1 1
With 4 Input variables, the truth table must have 16 rows, with each row
representing an input combination.
With dont care input conditions, the number of rows can be reduced since rows with
dont care inputs will actually represent more than one input combination.
Thus, for example, row # 3 represents 2 combinations since it represents the input
conditions E3 E2 E1 E0 =0010 and 0011.
Thus, the total number of input combinations represented by the 5-row truth table =
1+ 1+ 2+ 4 + 8= 16 input combinations.