0% found this document useful (0 votes)
81 views66 pages

Decoders: Reference: Chapter 3 Moris Mano 4 Edition

The document discusses decoders and minterms. It explains that a decoder takes n inputs and generates 2n minterms (product terms) as outputs, with only one minterm turning on at a time to indicate the input combination in binary. The minterms correspond to the possible combinations of the input variables. A decoder diagram and truth table are provided to illustrate this concept. Decoder blocks are used to convert binary codes to one-hot encodings at their outputs.

Uploaded by

EishaAhmad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views66 pages

Decoders: Reference: Chapter 3 Moris Mano 4 Edition

The document discusses decoders and minterms. It explains that a decoder takes n inputs and generates 2n minterms (product terms) as outputs, with only one minterm turning on at a time to indicate the input combination in binary. The minterms correspond to the possible combinations of the input variables. A decoder diagram and truth table are provided to illustrate this concept. Decoder blocks are used to convert binary codes to one-hot encodings at their outputs.

Uploaded by

EishaAhmad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 66

Decoders

Reference: Chapter 3
Moris Mano 4th Edition
Minterms
Total Variables = 3
All Possible Minterms/Combinations/Product Terms = 2^3 = 8
Minterm0
Test m0 on (000)2 = (0)10

0 1
X
0 1 1
Y m0 = X’Y’Z’

0 1
Z

Output = 1
Minterm0
Test m0 on (001)2 = (1)10

0 1
X
0 1 0
Y m0 = X’Y’Z’

1 0
Z

Output = 0
Minterm0
Test m0 on (001)2 = (1)10

0 1
X
0 1 0
Y m0 = X’Y’Z’

1 0
Z

Conclusion:
mi gives output 1 only on binary equivalent of (i)10
For other combinations, output is 0.
Combining all Minterms of 3 Variables

= m0

= m1

= m2

= m3

= m4

= m5

= m6

= m7

Circuit containing all the minterms of 3 variables


Combining all Minterms of 3 Variables
Which output signal will be ON on input (110)2?

= m0

= m1
0
= m2

1 = m3

1 = m4

= m5

= m6

= m7

Circuit containing all the minterms of 3 variables


Combining all Minterms of 3 Variables

= m0

= m1

= m2

= m3

= m4

= m5
1
= m6

= m7

Circuit containing all the minterms of 3 variables


Combining all Minterms of 3 Variables
What will be the behavior of other output signals?

= m0

= m1
0
= m2

1 = m3

1 = m4

= m5
1
= m6

= m7

Circuit containing all the minterms of 3 variables


Combining all Minterms of 3 Variables

0
= m0

0 = m1

0 = m2

0
= m3
0
= m4
0
= m5
1
= m6
0
= m7

Circuit containing all the minterms of 3 variables


How Minterms Work?
Input Output
m0 m1 m2 m3 m4 m5 m6 m7
X Y Z
X’Y’Z’ X’Y’Z X’YZ’ X’YZ XY’Z’ XY’Z XYZ’ XYZ
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

Truth Table of circuit generating all minterms


Circuit to generate all Minterms
= m0

= m1

= m2

= m3

= m4

= m5

= m6

= m7

This is called Decoder


Decoder
Objective:

-Take n inputs
- Generate 2n minterms (i.e. D0

all possible product terms) D1


A0 D2
n to 2n
OR …
Decoder .
- Take input signal = (i)10 An-1 m = 2n .
- Generate signal 1 at Di and .
0 at rest of the outputs
Dm-1
n inputs

2n Minterms
- Only 1 minterm will be 1 at a time, rest will be 0
- Di will be 1 for its corresponding combination
Decoder…
Input 1 1 1 0

4-to-16
Decoder

?
Decoder…
Input 1 1 1 0

4-to-16
Decoder

(1110)2 = (14)10

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Output
Decoder…
Input 1 1 1 0

4-to-16
Decoder

(1110)2 = (14)10

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Output
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1-to-2 Line Decoder

Input Output D0
1×2
A D0 D1 A Decoder D1
0 1 0
1 0 1 Decoder Block
(High level Diagram)

We need equation
for every output
wire

D0 = A’ (i.e. m0)
D1 = A (i.e. m1)
(Minterms)
Detailed Logic Diagram
2-to-4 Line Decoder
Input Output D0
A0
A1 A0 D0 D1 D2 D3 2×4 D1
A1 Decoder D2
0 0 1 0 0 0
D3
0 1 0 1 0 0
1 0 0 0 1 0
Decoder Block
1 1 0 0 0 1

D0 = A1’A0’
D1 = A1’A0
D2 = A1A0’
D3 = A1A0
(All possible Minterms)
Detailed Logic Diagram
3-to-8 Line Decoder
Decoder with Enable Input
Decoder with Enable Input
Decoder Outputs

Input Output
EN A1 A0 D0 D1 D2 D3
0 X X 0 0 0 0
1 0 0 1 0 0 0
1 0 1 0 1 0 0
1 1 0 0 0 1 0
1 1 1 0 0 0 1

2-to-4 Line Decoder with Enable Input


Enabling Circuit

Application: MagicBulb with Secret Switch


Decoder with Enable Input
Decoder Outputs

Input Output
0
EN A1 A0 D0 D1 D2 D3
0 X X 0 0 0 0
0
1 0 0 1 0 0 0
1 0 1 0 1 0 0 0
1 1 0 0 0 1 0
1 1 1 0 0 0 1 0

2-to-4 Line Decoder with Enable Input


Enabling Circuit

Application: MagicBulb with Secret Switch


Decoder with Enable Input
Decoder Outputs

Input Output
0 0
EN A1 A0 D0 D1 D2 D3
0 X X 0 0 0 0
0 0
1 0 0 1 0 0 0
1 0 1 0 1 0 0 0 0
1 1 0 0 0 1 0
1 1 1 0 0 0 1 0 0

2-to-4 Line Decoder with Enable Input


Enabling Circuit
0.X=0
Application: MagicBulb with Secret Switch
Decoder with Enable Input
Decoder Outputs

Input Output
EN A1 A0 D0 D1 D2 D3
0 X X 0 0 0 0
1 0 0 1 0 0 0
1 0 1 0 1 0 0
1 1 0 0 0 1 0
1 1 1 0 0 0 1

2-to-4 Line Decoder with Enable Input


Enabling Circuit
1.X=X
Application: MagicBulb with Secret Switch
Implementing Functions using
Decoder
Decoder-Based Combinational Circuit
Example: Decoder and OR-Gate Implementation of 1-Bit Binary Adder

Input Output
X Y Z C S
0 0 0 0 0
0 0 1 0 1
S(X,Y,Z) = ∑m(1,2,4,7)
0 1 0 0 1
C(X,Y,Z) = ∑m(3,5,6,7)
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

Truth Table for 1-bit Binary Adder


Decoder-Based Combinational Circuit
Example: Decoder and OR-Gate Implementation of 1-Bit Binary Adder

S(X,Y,Z) = ∑m(1,2,4,7)
Input Output
C(X,Y,Z) = ∑m(3,5,6,7)
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

Truth Table for 1-bit Binary Adder

Test circuit on any combination. Logic Diagram


Decoder-Based Combinational Circuit
Example: Decoder and OR-Gate Implementation of 1-Bit Binary Adder

S(X,Y,Z) = ∑m(1,2,4,7)
Input Output
C(X,Y,Z) = ∑m(3,5,6,7)
X Y Z C S
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
1
0 1 1 1 0 0
0
1 0 0 0 1
1 0 1 1 0 0
1 1 0 1 0 0
0
1 1 1 1 1

Truth Table for 1-bit Binary Adder

Test circuit on any combination. Logic Diagram


Decoder-Based Combinational Circuit
Example: Decoder and OR-Gate Implementation of 1-Bit Binary Adder

S(X,Y,Z) = ∑m(1,2,4,7)
Input Output
C(X,Y,Z) = ∑m(3,5,6,7)
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 0
0
1 0 0 0 1
1 0 1 1 0 1
1 1 0 1 0 1
1
1 1 1 1 1 1

Truth Table for 1-bit Binary Adder

Test circuit on any combination. Logic Diagram


Decoder-Based Combinational Circuit
Example: Decoder and OR-Gate Implementation of 1-Bit Binary Adder

S(X,Y,Z) = ∑m(1,2,4,7)
Input Output
C(X,Y,Z) = ∑m(3,5,6,7)
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
1
1 0 0 0 1
1 0 1 1 0 1
1 1 0 1 0 1
1
1 1 1 1 1
1
Truth Table for 1-bit Binary Adder

Test circuit on any combination. Logic Diagram


Decoder-Based Combinational Circuit

To implement a function with n inputs and m


outputs using Decoder and OR gates we need
- An n x 2^n Line Decoder
- m OR Gates
Encoder
A Digital function that performs inverse of a
Decoder

I0 Y0
I1 Y1
I2
m-to-n
.
.
Encoder
. (m = 2n)
Im Yn
Octal to Binary Encoder
Functionality:
- Take an octal digit
- Produce its Binary Equivalent

D0
D1 A0
D2
. Octal-to-Binary A1
. Encoder
. A2

D7
Octal to Binary Encoder

Assumption: Only 1 input has value = 1 at any given time.


Can you write equations for A0, A1 and A2?
Octal to Binary Encoder

A0 = D 1 + D 3 + D 5 + D 7
A1 = D 2 + D 3 + D 6 + D 7
A2 = D 4 + D 5 + D 6 + D 7 Can you make circuit for this Octal to Binary Encoder?
Limitations of Encoder
• Only 1 input should be one at a time otherwise
answer will be wrong

• E.g. if D3 = D6 = 1
A0 = D1 + D3 + D5 + D7 = 0+1+0+0 = 1
A1 = D2 + D3 + D6 + D7 = 0+1+1+0 = 1
A2 = D4 + D5 + D6 + D7 = 0+0+1+0 = 1

i.e. Encoder Output = (A2A1A0) = (111)2 = (7)8


Which is neither 3 nor 6

Solution: If D3 and D6 both are 1 at the same time, give priority to


D6 and output (110)2  Priority Encoder
Priority Encoder

Truth Table for 4-input Priority Encoder


Priority Encoder
Priority Encoder

Logic Diagram of 4-Bit Priority Encoder


3-to-8 Line Decoder (Two-Level Implementation)
3-to-8 Line Decoder
(Hierarchical Design)

X
3-to-8 Line Decoder
(Hierarchical Design)

Z’
Z Z
Y’
Y Y

X’
X
X
3-to-8 Line Decoder
(Hierarchical Design)

Z’
Z Y’Z’
Z
Y’ Y’Z
Y Y
YZ’
YZ

X’
X
X
3-to-8 Line Decoder
(Hierarchical Design)

Z’
Z Y’Z’ X’Y’Z’
Z
Y’ Y’Z X’Y’Z
Y Y
YZ’ X’YZ’
YZ X’YZ
X’ XY’Z’
X
X XY’Z
XYZ’
XYZ
6 x 64 Decoder (Non-Hierarchical Design)
Level 1 Level 2 … ANDs
Inverters D0

D1

A0
D2
.
.
.
A1 .
.
.
.
.
.
A2 .

A3

D61
A4
D62

A5
D63
6-to-64 Decoder (Hierarchical Design)
Two-Level Implementation
vs
Hierarchical Design
Gate Input Cost
Gate Input Cost = I + ∑ m × n

I = Total No. of inverters


m = Total gates each with n input
3-to-8 Line Decoder
(Hierarchical Design)
Gate Input Cost = ?

I=3
m = 8+4 = 12 ANDs
n = 2 (2 inputs per gate)

Gate Input Cost =


3 + (12 × 2)
= 27
6 x 64 Decoder (Non-Hierarchical Design)
Level 1 Level 2 … ANDs
Inverters D0

D1
Gate Input Cost = ?
A0
D2
I=6 .
.
m = 64 .
A1 .
n = 6 (Each gate with 6 Inputs) .
.
.
.
Gate Input Cost = .
A2 .
I + (n x m)
= 6 + (64 x 6) = 390
A3

D61
A4
D62

A5
D63
6-to-64 Decoder (Hierarchical Design)
Gate Input Cost

I=6

Total AND Gates:


m = 64 + 2x8 +
2x4 = 88

n = 2 (Each AND
gate with 2
inputs)

Gate Input Cost=


I + (n x m)
= 6 + (2x88)
= 182

390 vs 182
Which design is better?
Constructing 4x16 Decoder using 1x2
Decoders Only
D0
D1
A0 D2
D3
A1 D4

A2 4x16 D5
D6
D7
D8
A3
Decoder D9
D10
D11
D12
D13
D14
D15
Constructing 4x16 Decoder using 2x4
Decoders Only
D0
D1
A0 D2
D3
A1 D4

A2 4x16 D5
D6
D7
D8
A3
Decoder D9
D10
D11
D12
D13
D14
D15
Constructing 4x16 Decoder using 2x4
Decoders Only
A0 A0 D0 D0
A1 A1 D1 D1
D2 D2
1 E
D3 D3
D0 D4
A0
A1 D1 D5
D2 D6
A2 1 E D7
D3
D0 D8
A0
A3 A1 D1 D9
D2 D10
1 E D3 D11
D0 D12
A0
A1 D1 D13
D2 D14
1 E D3 D15
Constructing 4x16 Decoder using 2x4
Decoders Only
A0 A0 D0 D0
A1 A1 D1 D1
D2 D2
1 E
D3 D3
D0 D4
A0
A1 D1 D5
D2 D6
A2 1 E D7
D3
D0 D8
A0
A3 A1 D1 D9
D2 D10
1 E D3 D11
D0 D12
A0
A1 D1 D13
D2 D14
Input: 1 E D3 D15
1000D8 = 1
Constructing 4x16 Decoder using 2x4
Decoders Only
0 0
A0 A0 D0 D0 = 1
A1 0 0 A1 D1 D1
D2 D2
1 E
D3 D3
0 D0 D4 = 1
A0
0 A1 D1 D5
D2 D6
A2 1 E D7
D3
0 A0 D0 D8 = 1
A3 D1 D9
0 A1
D2 D10
1 E D3 D11
0 A0 D0 D12 = 1
D1 D13
0 A1 D14
D2
Input: 1 E D3 D15
1000D8 = 1
Constructing 4x16 Decoder using 2x4
Decoders Only
0 0
A0 A0 D0 D0
A1 1 1 A1 D1 D1
D2 D2=1
1 E
D3 D3
0 D0 D4
A0
1 A1 D1 D5
D2 D6=1
A2 1 E D7
D3
0 A0 D0 D8
A3 D1 D9
1 A1
D2 D10=1
1 E D3 D11
0 A0 D0 D12
D1 D13
1 A1 D14=1
D2
Input: 1 E D3 D15
1010D10 = 1
Constructing 4x16 Decoder using 2x4
Decoders Only
0
A0 A0 D0 D0
A1 0
A1 2x4 D1 D1
D2 D2
D0 E
D3 D3
D0 D4
A0
A1 D1 D5
0 2x4 D2 D6
A2 A0 D1 E D7
D3
D0 D8
1 A0
A3 A1 D1 D9
A1 2x4
D2 D2 D10
E D3 D11
2x4 D12
A0 D0
Decoder D1 D13
A1
2x4 D2 D14
D3 E D3 D15
Input:
1000D8 = 1
Constructing 4x16 Decoder using 2x4
Decoders Only
0
A0 A0 D0 D0 = 0
A1 0
A1 2x4 D1 D1 = 0
D2 D2 = 0
D0 E
0 D3 D3 = 0
D0 D4 = 0
A0
A1 D1 D5 = 0
0 0 2x4 D2 D6 = 0
A2 A0 D1 E D7 = 0
D3
0 A0 D0 D8 = 1
1
A3 0 A1 D1 D9 = 0
A1 1 2x4
D2 D2 D10 = 0
E D3 D11 = 0
2x4 D12 = 0
A0 D0
Decoder D1 D13 = 0
A1
0 2x4 D2 D14 = 0
D3 E D3 D15 = 0
Input:
1000D8 = 1
Constructing 4x16 Decoder using 2x4
Decoders Only
1
A0 A0 D0 D0 = 0
A1 0
A1 2x4 D1 D1 = 0
D2 D2 = 0
D0 E
0 D3 D3 = 0
D0 D4 = 0
A0
A1 D1 D5 = 0
1 0 2x4 D2 D6 = 0
A2 A0 D1 E D7 = 0
D3
D0 D8 = 0
1 A0
A3 A1 D1 D9 = 0
A1 0 2x4
D2 D2 D10 = 0
E D3 D11 = 0
2x4 D12 = 0
1 A0 D0
Decoder D1 D13 = 1
0 A1
1 2x4 D2 D14 = 0
D3 E D3 D15 = 0
Input:
1101D13 = 1
Constructing 3x8 Decoder using two 2x4
Decoders

Output
A2 A1 A0
1 at
0 0 0 D0
0 0 1 D1

0 1 0 D2
0 1 1 D3

1 0 0 D4

1 0 1 D5

1 1 0 D6

1 1 1 D7
Constructing 5x32 Decoder using four
3x8 and one 2x4 Decoder(s) Only
D0
D1
A0 D2
D3
A1 D4

A2 5x32 D5
D6
D7
D8
A3

A4
Decoder D9
D10
.
.
.
D30
D31
Constructing 5x32 Decoder using four
3x8 and one 2x4 Decoder(s) Only
A0 A2 - A0 A0 D7 … D 0
A1 3x8
A2
A1 D0
E

A2 A2 - A0 A0 D15 … D8
A1
A2 3x8
A3 A0 D1
E
A0 D23… D16
A4 A2 - A0
A1 A1 3x8
D2 A2
E
2x4
Decoder A2 - A0 A0 D31…D24
A1
A2 3x8
D3
E
Constructing 5x32 Decoder using four
3x8 and one 2x4 Decoder(s) Only
0
A0 A2 - A0 A0 D7 - D0
A1 3x8
1 A2
A1 D0
E
1
A2 A2 - A0 A0 D15 - D8
A1
0 A2 3x8
A3 A0 D1
E
1 A0 D23 - D16
A4 A2 - A0
A1 A1 3x8
D2 A2
E
2x4
Decoder A2 - A0 A0 D31 - D24
A1
A2 3x8
D3
Input: E
10110D22 = 1
Constructing 5x32 Decoder using four
3x8 and one 2x4 Decoder(s) Only
0
A0 A2 - A0 A0 D7 - D0
A1 3x8
1 0 A2
A1 D0
E
1
A2 A2 - A0 A0 D15 - D8
A1
0 A2 3x8
A3 A0 D1 0
E
1 A0 D23 - D16
A4 110 A2 - A0
A1 A1 3x8
D2 1 A2 D22 = 1
E
2x4
Decoder A2 - A0 A0 D31 - D24
0 A1
A2 3x8
D3
Input: E
10110D22 = 1
Constructing 5x32 Decoder using four
3x8 and one 2x4 Decoder(s) Only
0
A0 A2 - A0 A0 D7 - D0
A1 3x8
1 0 A2
A1 D0
E
1
A2 A2 - A0 A0 D15 - D8
A1
0 A2 3x8
A3 A0 D1 0
E
1 A0 D23 - D16
A4 110 A2 - A0
A1 A1 3x8
D2 1 A2 D22 = 1
E
2x4
E=0 Decoder A2 - A0 A0 D31 - D24
E E 0 A1
A2 3x8
D3
Input: E
10110What will be the output now?

You might also like