Lect#3
Lect#3
(ELC 1710)
Lecture 3
1
2
3
4 bit ripple carry adder circuit.
4
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
• Two distinct cost criteria we will use:
• Literal cost (L)
• Gate input cost (G)
• Gate input cost with NOTs (GN)
Chapter 2 - Part 2 5 5
Circuit Optimization
Gate input costs: The number of inputs to the gates in the implementation
corresponding exactly to the given equation or equations. (G - inverters not
counted, GN - inverters counted)
• G (gate input count) adds the remaining OR (AND) gate inputs
• GN (gate input count with NOTs) adds the inverter inputs.
• For SOP and POS equations, it can be found from the equation(s) by finding the
sum of:
• all literal appearances
• the number of terms excluding single literal terms (G) and
• optionally, the number of distinct complemented single literals (GN).
• Example:
F(A, B, C, D) = BD + AB C + AC D L= 8, G = 11, GN = 14
F(A, B, C, D) = BD + AB C + AB D + ABC L= 11, G = 15, GN = 19
F(A, B, C, D) = ( A + B)( A + D)( B + C + D )( B + C + D)
L=10, G = 14, GN = 17
Which solution is the best?
6
Circuit Optimization
Gate input cost with NOTs (GN)
• Example 1: GN = G + 2 = 9
L=5
•F=A+BC+ B C
G=L+2= 7
B
C
A F
8
Chapter 3
Gate-Level Minimization
9
Karnaugh (K) Maps
10
K-Maps
• 2 Variable K-Map (Number Form)
Gray code!
Minterm numbers
11
Two Variable Maps
• A 2-variable Karnaugh Map:
• Note that minterm m0 and minterm m1 are “adjacent”
and differ in the value of the variable y
• Similarly, minterm m0 and minterm m2 differ in the x variable.
• Also, m1 and m3 differ in the x variable as well.
• Finally, m2 and m3 differ in the value of the variable y
K-Map and Truth Tables
• The K-Map is just a different form of the truth table.
• Example – Two variable function:
• We choose a,b,c and d from the set {0,1} to implement a particular
function, F(x,y).
Function Table
K-Map
Input Function
Values Value
(x,y) F(x,y) y=0 y=1
00 a x=0 a b
01 b
10 c x=1 c d
11 d
K-Map Function Representation
• Example: F(x,y) = x F=x y=0 y=1
x=0 0 0
x=1 1 1
• For function F(x,y), the two adjacent cells containing 1’s
can be combined using the Minimization Theorem:
F(x, y) = x y + x y = x
K-Map Function Representation
• Example: G(x,y) = x + y G = x+y y = 0 y = 1
x=0 0 1
x=1 1 1
G (x , y ) = (x y + x y )+ (xy + x y )= x + y
Duplicate x y
Chapter 2 - Part 2 15
K-Maps
• 3 Variable K-Map (Number Form)
Gray code!
Minterm numbers
16
K-Maps
• 4 Variable K-Map (Number Form)
Gray code!
Minterm numbers
17
K-Maps
• 2 Variable K-Map (Variable Form)
18
K-Maps
• 3 Variable K-Map (Variable Form)
19
K-Maps
• 4 Variable K-Map (Variable Form)
20
My Preference…
Y Y
Z 21
Plotting Functions in K-Maps
Plot the function F1(X,Y,Z) = S(2,5,6,7)
X Y Z F1
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 0
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1
22
Plotting Functions in K-Maps
Plot the function F2(A,B,C,D) = S(6,7,8,14,15) Plot 0s!
23
Don’t Care
Outputs
Don’t Care Outputs
BCD
A B C D Prime
• Output of Function Doesn’t Matter 0 0 0 0 0 0
• Typically impossible input condition 1 0 0 0 1 1
2 0 0 1 0 1
• Use X instead of 0 or 1 3 0 0 1 1 1
4 0 1 0 0 0
5 0 1 0 1 1
6 0 1 1 0 0
7 0 1 1 1 1
8 1 0 0 0 0
9 1 0 0 1 0
. 1 0 1 0 X
. 1 0 1 1 X
. 1 1 0 0 X
. 1 1 0 1 X
. 1 1 1 0 X
. 1 1 1 1 X
25
Don’t Care Outputs
Compact Minterm and Maxterm Form
26
Plotting K-Maps from functions
in partially reduced form
F4(A,B,C,D) = ABCD + BCD + AB + C
p1 p2 p3 p4
27
Plotting K-Maps from functions
in partially reduced form
F4(A,B,C,D) = ABCD + ABCD + ABC
r1 r2 r3
28
K-Maps for functions of 5 variables
F(V,W,X,Y,Z)
m0 through m15
29
K-Maps for functions of 5 variables
F(V,W,X,Y,Z) = S(3,7,9,11,12,15,16,19,23,24,27,28,31)
+ Smd(4,18,20,26,30)
30
Using K-Maps
to Reduce
Functions
Using K-Maps to Reduce Functions
Assume you’ve plotted the K-map for F(X,Y,Z) as follows:
32
Using K-Maps to Reduce Functions
You want to obtain a reduced expression for F(X,Y,Z) in SOP form
33
Using K-Maps to Reduce Functions
You want to obtain a reduced expression for F(X,Y,Z) in SOP form
• Need to “cover” 1s
• Fewest product terms
• Simplest expressions
• (fewest variables)
34
Using K-Maps to Reduce Functions
• Circle all isolated 0-cubes
35
Using K-Maps to Reduce Functions
38
K-Map with no essential prime implicants
39
K-Map with no essential prime implicants
40
K-Map with no essential prime implicants:
alternative!
41
Covering Order is Essential
42
Using K-Maps to Reduce Functions
Given the following K-map, which minimum SOP form of the function
has the smallest literal count (the one for the 1s or the 0s)?
F(W,X,Y,Z) =
F(W,X,Y,Z) =
43
Using K-Maps to Reduce Functions
lc = 6
lc = 7
46
Using K-Maps to Reduce Functions
Given the following K-map, which minimum SOP form of the function
has the smallest literal count (the one for the 1s or the 0s)?
F(W,X,Y,Z) =
F(W,X,Y,Z) =
Only use don’t cares to allow larger cube
sizes to be covered
47
Using K-Maps to Reduce Functions
lc = 10
lc = 7
50
Circuits with Multiple Outputs
Product Term Sharing
x1
f1
x2 f2
x3
x4
51
Product Term Sharing
May Result in K-Maps Different from Optimizing Separate Functions
52
53