Lecture8 2p-2
Lecture8 2p-2
Decoders
Discrete quantities of information are represented in digital
systems by binary codes.
1
Decoders
Example
Consider the 3-to-8-line
decoder circuit.
A particular application of 3-
to-8-line decoder is binary-to-
octal conversion.
3-to-8-line decoder
Decoders
Example
For each possible input combination, there are seven outputs that
are equal to 0 and only one that is equal to 1.
Inputs Outputs
x y z D0 D1 D2 D3 D4 D5 D6 D7
0 0 0 1 0 0 0 0 0 0 0
0 0 1 0 1 0 0 0 0 0 0
0 1 0 0 0 1 0 0 0 0 0
0 1 1 0 0 0 1 0 0 0 0
1 0 0 0 0 0 0 1 0 0 0
1 0 1 0 0 0 0 0 1 0 0
1 1 0 0 0 0 0 0 0 1 0
1 1 1 0 0 0 0 0 0 0 1
The output whose value is 1 represents the minterm equivalent of
the binary number presently available in the input.
2
Decoders
Example
Some decoders are constructed with NAND gates, since it is more
economical to generate the decoder minterms in their
complemented form.
Furthermore, decoders include one or more enable inputs to
control the circuit operation.
The truth table for 2-to-4-line decoder with an enable input and its
circuit implementation with NAND gates (the circuit operates with
complemented outputs):
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
Decoders
Demultiplexer
In general, a decoder may operate with complemented or
uncomplemented outputs and the enable input may be activated
with a 0 or a 1 signal.
3
Decoders
Enable inputs are a convenient feature for interconnecting two or
more standard components for the purpose of expanding the
component into a similar function with more inputs and outputs.
Decoders
Combinational Logic Implementation
Since any Boolean function can be expressed in sum of minterms,
one can use a decoder to generate the minterms and an external OR
gate to form the logical sum.
4
Combinational Logic Implementation
Example
Implementation of a full adder with a decoder:
x y z C S
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
If NAND gates are used for the decoder, the external gates must be
NAND gates instead of OR gates.
This is because a two-level NAND gate circuit implements a sum
of minterms function and is equivalent to a two level AND-OR
circuit.
10
5
Encoders
An encoder, performing the inverse operation of a decoder, has 2n
(or fewer) input lines and n output lines.
11
Encoders
Example
Octal-to-binary encoder has eight inputs (one for each octal digit)
and three outputs that generate the corresponding binary number.
It is assumed that only one input has a value of 1 at any time.
Inputs Outputs
D0 D1 D2 D3 D4 D5 D6 D7 x y z The encoder can be
1 0 0 0 0 0 0 0 0 0 0 implemented with
three OR gates:
0 1 0 0 0 0 0 0 0 0 1
0 0 1 0 0 0 0 0 0 1 0 z = D1+D3+D5+D7
0 0 0 1 0 0 0 0 0 1 1 y = D2+D3+D6+D7
0 0 0 0 1 0 0 0 1 0 0 x = D4+D5+D6+D7
0 0 0 0 0 1 0 0 1 0 1
0 0 0 0 0 0 1 0 1 1 0
0 0 0 0 0 0 0 1 1 1 1
12
6
Encoders
Example
The ambiguity need to be resolved:
1. The encoder has the limitation that only one input can be active at
any given time.
If two inputs are active simultaneously, the output produces an
undefined combination.
To resolve this, encoder circuit must establish an input priority
to ensure that only one input is encoded (higher priority to
inputs with higher subscript numbers).
2. When all the inputs are 0, an output with all 0’s is generated. This
output is the same as when D0 is equal to 1.
Providing one more output indicating that at least one input is
1, can resolve this problem.
13
Encoders
Priority Encoder
A priority encoder is an encoder circuit that includes the priority
function.
The higher the subscript number, the higher the priority of the
input.
When V equals to 0, the outputs are not inspected and are specified
as don’t-care conditions.
14
7
Encoders
Priority Encoder
The truth table of a four input priority encoder:
15
Encoders
Priority Encoder
The K-maps for simplifying outputs x and y:
x = D2+D3 y = D3+D1D2’
The output V is an OR function of all input variables.
V = D0+D1+D2+D3
16
8
Encoders
Priority Encoder
Logic diagram of 4-input Priority Encoder:
x = D2+D3
y = D3+D1D2’
V = D0+D1+D2+D3 = D0+D1+x
17
Multiplexers
A multiplexer is a combinational circuit that selects binary information
from one of many input lines and directs it to a single output line.
The selection of a particular input line from 2n input lines is controlled
by a set of n selection lines.
A 2-to-1-line multiplexer has two data input lines I0 I1, one output
line Y, and one selection line S.
18
9
Multiplexers
Logic diagram and function
table of a 4-to-1 line
multiplexer:
19
Multiplexers
A multiplexer is also called a data selector, since it selects one
of many inputs.
20
10
Multiplexers
As in decoders, multiplexers
may have an enable input
to control the operation of
the unit.
21
Multiplexers
Boolean Function Implementation
A decoder can be used to implement Boolean functions by
employing external OR gates, while Multiplexer is a decoder that
includes the OR gate within the unit.
22
11
Boolean Function Implementation
Example 1
Consider the Boolean function of three variables:
F(x,y,z) = (1,2,6,7)
The function can be implemented with a 4-to-1-line MUX.
23
24
12
Boolean Function Implementation
Example 2
Consider the Boolean function of four variables:
F(A,B,C,D) = (1,3,4,11,12,13,14,15)
25
When the control input is equal to 1, the output is enabled and the
gate behaves like a conventional buffer, with the output equal to
the normal input.
26
13
Three State Gates
A multiplexer can be constructed with three-state gates.
Because of the high-impedance state, a large number of three
state gate outputs can be connected with wires to form a
common line without endangering loading effects.
27
14