CSE 205 Digital Logic Design: MD Hasan Al Kayem
CSE 205 Digital Logic Design: MD Hasan Al Kayem
CSE 205 Digital Logic Design: MD Hasan Al Kayem
Md Hasan Al Kayem
Decoders
• A decoder converts binary information from n
input lines to a maximum of 2n output lines
5
Decoders: Truth Table
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
6
Decoders: AND implementation
7
2-to-4 Decoder: NAND implementation
8
How to build bigger decoders?
Generates from
0000 to 0111
Generates from
1000 to 1111
9
Combinational Logic Implementation
• A decoder provides the 2n minterms of n input variables.
11
Encoders
• Encoders perform the inverse operation of a
decoder:
12
Encoders: Truth Table
Outputs Inputs
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
13
Priority Encoders
Encoder limitations:
• If two inputs are active, the output is undefined.
Solution: we need to take into account priority.
• What if all inputs are 0?
Solution: we need a valid bit
Input Output
D0 D1 D2 D3 x y v
0 0 0 0 X X 0
1 0 0 0 0 0 1
X 1 0 0 0 1 1
X X 1 0 1 0 1
X X X 1 1 1 1
14
Priority Encoders: Map
15
Priority Encoders: Circuit
16
Multiplexers
• Multiplexer: selects one binary input from
many selections
• example: 2-to-1 MUX
17
4-to-1 MUX
Directs 1 of the 4 inputs to the output
18
Multi-bit selection logic
• Multiplexers can be combined with common
selection inputs to support multi-bit selection
logic
19
Implementing Boolean functions w/ MUX
• General rules for implementing any Boolean function with n
variables:
• Use a multiplexer with n-1 selection inputs and 2 n-1 data inputs
• List the truth tabel
• Apply the first n-1 variables to the selection inputs of
multiplexer
• For each combination evaluate the output as a function of the
last variable.
• The function can be 0, 1 the variable or the complement of the
variable.
20
Implementing Boolean functions w/ MUX
21
Implementing Boolean functions w/ MUX
22