Encoder, Decoder, Multiplexers and Demultiplexers
Encoder, Decoder, Multiplexers and Demultiplexers
MP3 Player
Docking Station
D0
Laptop
D1
MUX
Sound Card Y
D2
D3
Data
inputs S Z
0 I0
Selector 1 I1
input
Z = A′.I0 + A.I1
2 to 1 MUX
I0
I1
Multiplexers
A B F
0 0 I0
0 1 I1
1 0 I2
1 1 I3
MSB LSB
MUX
Y
D2
D3
B A
B A Y
0 0 D0
0 1 D1
1 0 D2
1 1 D3
8
4-to-1 Multiplexer Waveforms
D0
D1
Input
Data
D2
D3
A Select
Line
Output
Y Data 9
D0 D1 D2 D3 D0 D1 D2 D3
Multiplexers
A B C F
0 0 0 I0
0 0 1 I1
0 1 0 I2
0 1 1 I3
1 0 0 I4
1 0 1 I5
1 1 0 I6
1 1 1 I7
MSB LSB
B/W Laser
Printer
Fax
Machine
D0
DEMUX
X D1
D2 Color Inkjet
Printer
D3
B A Selected Destination
0 0 B/W Laser Printer Pen
Plotter
0 1 Fax Machine
1 0 Color Inkjet Printer
1 1 Pen Plotter
15
Demultiplexers
Out0 W W = A'.B'.I
Out1 X X = A.B'.I
I In Out2 Y
Out3 Z Y = A'.B.I
S 1 S0 Z = A.B.I
A B
A B W X Y Z
0 0 I 0 0 0
0 1 0 I 0 0
1 0 0 0 I 0
1 1 0 0 0 I
1-to-4 De-Multiplexer (DEMUX)
D0
DEMUX
D1
X
D2
D3
B A
B A D0 D1 D2 D3
0 0 X 0 0 0
0 1 0 X 0 0
1 0 0 0 X 0
1 1 0 0 0 X
1-to-4 De-Multiplexer Waveforms
Input
X Data
S0
Select
Line
S1
D0
D1
Output
Data
D2
D3
Decoders
Decoders
A decoder has
N inputs
2N outputs
A decoder selects one outputs by decoding
the binary value on the N inputs.
Decoders
W = A'.B'
Out0 W
B I0 Out1 X X = A’.B
A I1 Out2 Y Y = A.B’
Out3 Z
msb Z = A.B
Active-high outputs
A B W X Y Z
0 0 1 0 0 0
0 1 0 1 0 0
1 0 0 0 1 0
1 1 0 0 0 1
Decoders
W = (A'.B')'
Out0 W
B I0 Out1 X y = (A.B')'
A I1 Out2 Y x = (A'.B)'
Out3 Z
msb Z = (A.B)'
Active-low outputs
A B W X Y Z
0 0 0 1 1 1
0 1 1 0 1 1
1 0 1 1 0 1
1 1 1 1 1 0
Decoders
msb
Decoder with Enable
Out0 W
B I0
high-level Out1 X
enable A I1
Out2 Y
Out3 Z
Enable En
En A B W X Y Z
1 0 0 1 0 0 0
1 0 1 0 1 0 0
enabled
1 1 0 0 0 1 0
1 1 1 0 0 0 1
disabled 0 x x 0 0 0 0
Decoder with Enable
Out0 W
B I0
low-level Out1 X
enable A I1
Out2 Y
Out3 Z
Enable En
En A B W X Y Z
0 0 0 1 0 0 0
0 0 1 0 1 0 0
enabled
0 1 0 0 0 1 0
0 1 1 0 0 0 1
disabled 1 x x 0 0 0 0
Encoders
Encoders
An encoder has
2N inputs
N outputs
An encoder outputs the binary value of the selected
(or active) input.
An encoder performs the inverse operation of a
decoder.
Issues
What if more than one input is active?
What if no inputs are active?
Encoders
D I0
C I1 Out0 Z
B I2
Out1 Y
A I3
A B C D Y Z
0 0 0 1 0 0
0 0 1 0 0 1
0 1 0 0 1 0
1 0 0 0 1 1
Priority Encoders
If more than one input is active, the higher-order input
has priority over the lower-order input.
The higher value is encoded on the output
A valid indicator, d, is included to indicate whether or
not the output is valid.
Output is invalid when no inputs are active
d=0
Output is valid when at least one input is active
d=1
Why is the valid indicator needed?
Priority Encoders
msb
Valid bit
Questions?