Decoder+encoder+multiplexer
Decoder+encoder+multiplexer
• Decoder
• Encoder
• Multiplexer
DECODER
Decoder
• Decoding - the conversion of an n-bit input code to
an m-bit output code with
n m 2n such that each valid code word
produces a unique output code
• Circuits that perform decoding are called decoders
• Here, functional blocks for decoding are
– called n-to-m line decoders, where m 2n, and
– generate 2n (or fewer) minterms for the n input variables
Decoder Examples
• 1-to-2-Line Decoder
• 2-to-4-Line Decoder
A0
A1 A0 D0 D1 D2 D3
A1
0 0 1 0 0 0
0 1 0 1 0 0
1 0 0 0 1 0
1 1 0 0 0 1
(a)
y0 = wn −1'...w1' w0' En
w0 y0 y1 = w n −1'...w1' w0En
n
2n y 2 = w n −1'...w1w0' En
inputs
wn – 1 outputs
...
y2n – 1
Enable En y 2n −1 = w n −1...w1w0En
Example: 2-to-4 Decoder with Enable input
En w1 w0 y0 y1 y2 y3
w0
1 0 0 1 0 0 0 y0
1 0 1 0 1 0 0 w1
1 1 0 0 0 1 0
1 1 1 0 0 0 1
0 x x 0 0 0 0 y1
(a) Truth table
y2
w0 y0
w1 y1 y3
y2
En y3 En
w0
y0
2n n
inputs outputs
yn – 1
w2n – 1
Octal to binary Encoder
Eight inputs – three outputs – only one input = 1 at any given time.
The value of the control inputs determines the data input that is
selected.
A multiplexer has
❑ 2n data inputs
❑ n control inputs
❑ 1 output
2-to-1 Multiplexer
Y Y
S S
Data S
inputs
Control
input
2-to-1 Multiplexer
Y = S′.I0 + S.I1
4-to-1 Multiplexer
Y = S1′.S0′.I0 + S1′. S0.I1 + S1. S0 ′.I2 + S1. S0.I3
Y
S1 S0 Y
0 0 I0
0 1 I1
1 0 I2
1 1 I
3
m0 = S1'. S0'
m1 = S1'. S0
m2 = S1. S0'
m3 = S1. S0
8-to-1 Multiplexer
Y = A′.B'.C'.I0 + A'.B'.C.I1 + A'.B.C'.I2 + A'.B.C.I3 +
A.B'.C'.I0 + A.B'.C.I1 + A'.B.C'.I2 + A.B.C.I3
0
212
22
Y
MSB LSB
A B C Y
Y
0 0 0 I0 m0
0 0 1 I1 m1 Logical diagram
0 1 0 I2 m2
0 1 1 I3 m3
1 0 0 I4 m4
1 0 1 I5 m5
1 1 0 I6 m6
1 1 1 I7 m7
2n-to-1 Multiplexer
Y
Y
20
2n-1
EN Enable
EN S Y
I0 0 X 0
2-to 1 Y 1 0 I0
I1
MUX 1 1 I1
Data inputs S
Control input
Contd..
EN
Active low enable input, Mux=1 when EN=0
EN S1 S0 Y
0 0 0 I0
0 0 1 I1
0 1 0 I2
0 1 1 I3
1 X X 1
Multiplexer Width Expansion
Quadruple 2-to-1 MUX – to select one of two 4 bit data words.
MUX with active high input and active low input, MUX with enable inputs.
Combinational Logic Implementation
- Multiplexer-Based approach
▪ Design:
• Find the truth table for the functions.
• In the order they appear in the truth table:
▪ Apply the function input variables to the multiplexer inputs Sn
- 1, … , S0
▪ Label the outputs of the multiplexer with the output variables
• Value-fix the information inputs to the multiplexer using the
values from the truth table (for don’t cares, apply either 0 or 1)
Examples
Implementing Boolean functions of n variables with a MUX
Example
Example of Binary Adder
S(X , Y, Z) = m(1, 2, 4, 7)
C ( X , Y , Z ) = m(3, 5, 6, 7)
Alternate Implementation of Binary Adder