Digital Design ch3
Digital Design ch3
Lecture Three
Gate-Level Minimization
Circuit Optimization
Goal: To obtain the simplest
implementation for a given function
Optimization is a more formal approach to
simplification that is performed using a
specific procedure or algorithm
Optimization requires a cost criterion to
measure the simplicity of a circuit
Distinct cost criteria we will use:
Literal cost (L)
Gate input cost (G)
Gate input cost including inverters (GN)
Circuit Optimization 2
Literal Cost
Literal a variable or it complement
Literal cost the number of literal
appearances in a Boolean expression
corresponding to the logic circuit diagram
Example: Boolean expressions for F
F = B D + AB C + AC D
L= 8
F = B D + AB C + AB D + AB C
L = 11
F = (A+B)(A+D)(B+C+D)(B+C+D)
L = 10
Example:
F= B D + AB C + AC D
L = 8 G = L+3 = 11
GN = G+3 = 14
Circuit Optimization 4
B
C
A
A
B
C
F = A B C + AB C
L = 6 G = 8 GN = 11
F = (A + C)( B + C)( A + B)
L = 6 G = 9 GN = 12
Circuit Optimization 6
Two-Variable K-Map
A 2-variable Karnaugh Map:
Minterm m0 and minterm m1 are adjacent
y=0
y=1
x = 0 m0 = x y m1 = x y
x = 1 m2 = x y m3 = x y
Circuit Optimization 11
Function
Value
F(x,y)
00
01
10
11
1
0
1
1
K-Map
y
y=0
y=1
x=0
x=1
Circuit Optimization 12
K-Map
y
y=0
y=1
x=0
x=1
m0 + m2 = x y + x y = (x + x) y = y
m2 + m3 = x y + x y = x (y + y) = x
Therefore, F can be simplified as F = x + y
Circuit Optimization 13
yz=00
yz=01
yz=11
yz=10
x=0
m0
m1
m3
m2
x=1
m4
m5
m7
m6
yz
yz=01
yz=11
yz=10
x=0 x y z
xyz
xyz
xyz
xyz
xyz
xyz
x=1
yz=00
xyz
Note that if the binary value for an index differs in one bit
position, the minterms are adjacent on the K-Map
Circuit Optimization 14
yz
00
14
00 01 11 10
x
x
z
Circuit Optimization 15
Example Functions
By convention, we represent the minterms of F by a 1
in the map and leave the entries that contain 0 blank
y
Example 1:
F(x, y, z) = (2, 3, 4, 5)
x 41
1
5
Example 2:
G(x, y, z) = (3, 4, 6, 7)
Learn the locations of the 8
indices based on the variable
order shown
y
0
x 41
1
7
1
2
6
z
Circuit Optimization 16
Combining Squares
On a 3-variable K-Map:
One square represents a minterm with 3 variables
Two adjacent squares represent a term with 2 variables
Four adjacent squares represent a term with 1 variable
Eight adjacent square is the function 1 (no variables)
Circuit Optimization 17
Example:
F = (2, 3, 6, 7)
1
7
1
1
6
1
z
Applying the Minimization Theorem 3 times:
F( x , y , z ) x y z x y z x y z x y z
yz y z
y
Thus the four terms that form a 2 2 square
correspond to the term y.
Circuit Optimization 18
z
Circuit Optimization 19
xy
xz
z
yz
Circuit Optimization 20
xy
1
F=z+xy+xy
z
1
1
2
6
xy
Circuit Optimization 21
Four-Variable K-Map
wx
yz
00
01
11
10
00 m0 = w x y z m1 = w x y z m3 = w x y z m2 = w x y z
01 m4 = w x y z m5 = w x y z m7 = w x y z m6 = w x y z
11 m12 = w x y z m13 = w x y z m15 = w x y z m14 = w x y z
W
10 m8 = w x y z m9 = w x y z m11 = w x y z m10 = w x y z
X
X
Z
Circuit Optimization 22
Z
W
12
13
15
14
11
10
Z
Circuit Optimization 24
XZ
XZ
0
12
13
15
14
11
10
WY
Z
Circuit Optimization 25
WXZ
0
1
12
13
15
14
11
10
WYZ
WXZ
Z
Circuit Optimization 26
12
13
15
14
11
10
1
WX
W
1
F=WX +YZ +WZ
WZ
Z
Circuit Optimization 27
12
13
15
14
1
1
11
1
1
10
X
W
12
13
15
14
11
10
1
1
Circuit Optimization 28
Product-of-Sum Simplification
Step 1: Draw the K-map for F, replacing the 0s of
F with 1s in F and vice versa
Step 2: Obtain a minimal Sum-of-Product (SOP)
expression for F
Step 3: Use DeMorgans Theorem to obtain F = F
The result is a minimal Product-of-Sum (POS)
expression for F
Step 4: Compare the cost of the minimal SOP and
POS expressions to find which one is better
Circuit Optimization 29
Five-Variable K-Maps
For five variable problems, we use two adjacent 4-variable
K-maps that can be visualized to be on top of each other
Each square in the A=0 map is adjacent to the
corresponding square in the A=1 map (e.g. m4 and m20)
A=0
D
A=1
D
16
17
19
18
20
21
23
22
12
13
15
14
28
29
31
30
11
10
24
25
27
26
C
B
Circuit Optimization 30
12
13
15
14
11
10
A=1
D
16
17
19
18
20
21
23
22
28
29
31
30
24
25
27
26
1
C
B
E
Circuit Optimization 31
1 8 1 9 X11 X10
z
Circuit Optimization 33
Product-of-Sums Example
Find the optimum POS expression for :
F(A, B, C, D) = (3,9,11,12,13,14,15) + d (1,4,6)
Where d indicates the dont care minterms
Solution: Find F = (0, 2, 5, 7, 8, 10) + d (1,4,6)
F= B D + AB
1 0 X1
12
X4 1 5 1 7 X6
F = (B + D) (A + B)
Gate input cost (G = 6)
12
13
15
14
18
11
1 10
Circuit Optimization 34
Systematic Simplification
A Prime Implicant is a product term obtained by combining the
maximum possible number of adjacent squares in the map into
a rectangle, with the number of squares equal to a power of 2
BD
1
BD
A
AB
D
AD
BD
1
1
B
BD
A
1
B
1
BC
A, B C, B D
All 3 prime
implicants are
A
essential
A
1
1
C
0
12
13
15
14
1
1
1
1
11
1
1
BC
B
10
Circuit Optimization 37
Optimization Algorithm
Find all prime implicants
Include all essential prime implicants in the solution
Select a minimum cost set of non-essential prime
implicants to cover all minterms not yet covered
Prime implicant selection rule:
Minimize the overlap among prime implicants
In particular, in the final solution, make sure that each
prime implicant selected includes at least one minterm not
included in any other prime implicant selected
Circuit Optimization 38
1
1
A
1
Essential
Selected
1
D
1
D
1
A
x
1
1
D
Essential
Selected
B
A
x
1
D
Minterms covered by essential prime implicants
Circuit Optimization 40
Gate classifications
Primitive gate - a gate that can be described using a
single primitive operation type (AND or OR) plus
optional inversion(s).
Complex gate - a gate that requires more than one
primitive operation type for its description
NAND Gate
The basic NAND gate has the following symbol and
truth table:
X Y NAND
AND-Invert (NAND) Symbol:
X
Y
XY
0
0
1
1
0
1
0
1
1
1
1
0
X + Y = X Y = NAND
XY
XY
X
Y
XY
X+Y
X
Y
X
Y
X Y= X+Y
Additional Gates and
NOR Gate
The basic NOR gate has the following symbol and
truth table:
X Y NOR
OR-Invert (NOR) Symbol:
0 0 1
0 1 0
X
1 0 0
X+Y
1 1 0
Y
NOR represents NOT OR. The small bubble circle
represents the invert function.
The NOR gate is also implemented efficiently in
CMOS technology in terms of chip area and speed
Additional Gates and
X Y = X + Y = NOR
X+Y
X+Y
X
Y
X+Y
XY
X
Y
X + Y= X Y
Y
Additional Gates and
NANDNAND Implementation
Consider the Following SOP Expression:
F XZ WY Z
A 2-level AND-OR circuit can be converted easily
to a NAND-NAND implementation
X
Z
W
Y
Z
X
Z
W
Y
Z
X
Z
W
Y
Z
F
NORNOR Implementation
Consider the Following POS Expression:
F ( X Z )(W Y Z )
A 2-level OR-AND circuit can be converted easily
to a NOR-NOR implementation
X
Z
W
Y
Z
X
Z
W
Y
Z
X
Z
W
Y
Z
F
Additional Gates and
AND-NOR Function:
F XY W X Z
AND-NOR
X
Y
W
X
Z
NAND-AND
F
X
Y
W
X
Z
X
Y
W
X
Z
OR-NAND Function:
F ( X Y )(W X Z )
OR-NAND
X
Y
W
X
Z
NOR-OR
F
X
Y
W
X
Z
X
Y
W
X
Z
Circuit Optimization 52
Circuit Optimization 53
XNOR
X Y
0 0
XY
0
0 0
XY
1
0 1
0 1
1 0
1 0
1 1
1 1
X Y
XOR Symbol
XNOR Symbol
XOR Implementations
SOP implementation
NAND only
for XOR:
implementation
X Y= XY+ XY
for XOR:
X Y
X Y
X 1 X
XX 0
XX 1
XY YX
XY XY= X Y
( X Y) Z X ( Y Z ) = X Y Z
( X Y) Z X ( Y Z ) = X Y Z
Odd Function
The XOR function can be extended to 3 or more variables
For 3 or more variables, XOR is called an odd function
The function is 1 if the total number of 1s in the inputs is odd
00
11
0
1
01
10
1
1
X Y Z
YZ
00
WX
1
1
10
1
1
11
10
11
00
01
01
1
1
W X Y Z
X
Y
Z
Sender
Generator
(n+1)-bit
code
Parity
Checker
Error
Receiver