lec07 karnaugh maps
Post on 04-Apr-2018
235 Views
Preview:
TRANSCRIPT
-
7/31/2019 Lec07 Karnaugh Maps
1/26
Based on slides by:Charles Kime & Thomas Kaminski
2004 Pearson Education, Inc.
ECE/CS 352: Digital System Fundamentals
Lecture 7 Karnaugh Maps
-
7/31/2019 Lec07 Karnaugh Maps
2/26
Chapter 2 2
Outline
Circuit Optimization Literal cost Gate input cost
Two-Variable Karnaugh Maps
Three-Variable Karnaugh Maps
-
7/31/2019 Lec07 Karnaugh Maps
3/26
Chapter 2 3
Circuit Optimization
Goal: To obtain the simplestimplementation for a given functionOptimization is a more formal approachto simplification that is performed usinga specific procedure or algorithmOptimization requires a cost criterion tomeasure 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)
-
7/31/2019 Lec07 Karnaugh Maps
4/26
Chapter 2 4
D
Literal a variable or its complementLiteral cost the number of literalappearances in a Boolean expression
corresponding to the logic circuitdiagramExamples:
F = BD + A C + A F = BD + A C + A + AB F = (A + B)(A + D)(B + C + )( + + D) Which solution is best?
Literal Cost
DB CB B D C
B C
L=8
L=11L=10
-
7/31/2019 Lec07 Karnaugh Maps
5/26
Gate Input Cost
Gate input costs - the number of inputs to the gates in theimplementation corresponding exactly to the given equationor equations. (G - inverters not counted, GN - inverters counted)For SOP and POS equations, it can be found from theequation(s) by finding the sum of: all literal appearances the number of terms excluding terms consisting only of a single
literal,(G) and optionally, the number of distinct complemented single literals (GN).
Example: F = BD + A C + A F = BD + A C + A + AB F = (A + )(A + D)(B + C + )( + + D) Which solution is best?
DB CB B D C
B D B C
G=11,GN=14G=15,GN=18
G=14,GN=17
-
7/31/2019 Lec07 Karnaugh Maps
6/26
Chapter 2 6
Example 1:F = A + B C +
Cost Criteria (continued)
A
BC
F
B C L = 5
L (literal count) counts the AND inputs and the singleliteral OR input.
G = L + 2 = 7
G (gate input count) adds the remaining OR gate inputs
GN = G + 2 = 9
GN(gate input count with NOTs) adds the inverter inputs
-
7/31/2019 Lec07 Karnaugh Maps
7/26Chapter 2 7
Example 2:F = A B C +L = 6 G = 8 GN = 11F = (A + )( + C)( + B)L = 6 G = 9 GN = 12Same function and sameliteral cost
But first circuit has bettergate input count and bettergate input count with NOTsSelect it!
Cost Criteria (continued)
B C
A
ABC
F
C B
F
AB
C
A
-
7/31/2019 Lec07 Karnaugh Maps
8/26Chapter 2 8
Why Use Gate Input Counts?
CMOS logic gates:
Each input adds:P-type transistor to pull-up networkN-type transistor to pull-down network
F
+V
X
Y
+V
X
+V
X
Y
(a) NOR
G = X + Y
(b) NAND (c) NOT
X . Y
X
-
7/31/2019 Lec07 Karnaugh Maps
9/26Chapter 2 9
Boolean Function Optimization
Minimizing the gate inputs reduces circuit cost.Some important questions: When do we stop trying to reduce the cost? Do we know when we have a minimum cost?
Two-level SOP & POS optimum or near-optimumfunctionsKarnaugh maps (K-maps) Graphical technique useful for up to 5 inputs
-
7/31/2019 Lec07 Karnaugh Maps
10/26Chapter 2 10
Two Variable K-Maps
A 2-variable Karnaugh Map:
Similar to Gray Code Adjacent minterms differ by one variable
y = 0 y = 1
x = 0m 0 = m 1 =
x = 1 m 2 = m 3 =
yx yx
yx yx
-
7/31/2019 Lec07 Karnaugh Maps
11/26Chapter 2 11
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-MapInput
Values(x,y)
FunctionValueF(x,y)
0 0 a0 1 b1 0 c1 1 d
y = 0 y = 1
x = 0 a bx = 1 c d
-
7/31/2019 Lec07 Karnaugh Maps
12/26Chapter 2 12
Karnaugh Maps (K-map)
A K-map is a collection of squares Each square represents a minterm The collection of squares is a graphical representation
of a Boolean function
Adjacent squares differ in the value of one variable Alternative algebraic expressions for the same functionare derived by recognizing patterns of squares
The K-map can be viewed as
A reorganized version of the truth table
-
7/31/2019 Lec07 Karnaugh Maps
13/26Chapter 2 13
Some Uses of K-Maps
Finding optimum or near optimum SOP and POS standard forms, and two-level AND/OR and OR/AND circuit
implementations
for functions with small numbers of variablesDemonstrate concepts used by computer-aided design programs to simplify largecircuits
-
7/31/2019 Lec07 Karnaugh Maps
14/26Chapter 2 14
K-Map Function Representation
Example: F(x,y) = x
For function F(x,y), the two adjacent cellscontaining 1s can be combined using theMinimization Theorem:
F = x y = 0 y = 1x = 0 0 0
x = 1 1 1
xyxyx)y,x(F
-
7/31/2019 Lec07 Karnaugh Maps
15/26Chapter 2 15
K-Map Function Representation
Example: G(x,y) = x + y
For G(x,y), two pairs of adjacent cells containing1s can be combined using the Minimization
Theorem:
G = x+y y = 0 y = 1
x = 0 0 1
x = 1 1 1
yxyxxyyxyx)y,x(G Duplicate x y
-
7/31/2019 Lec07 Karnaugh Maps
16/26Chapter 2 16
Three Variable Maps
A three-variable K-map:
Where each minterm corresponds to the productterms:
Note that if the binary value for an index differs in onebit position, the minterms are adjacent on the K-Map
yz=00 yz=01 yz=11 yz=10
x=0 m 0 m 1 m 3 m 2
x=1 m 4 m 5 m 7 m 6
yz=00 yz=01 yz=11 yz=10
x=0
x=1
zyx zyx zyx zyx
zyx zyx zyx zyx
-
7/31/2019 Lec07 Karnaugh Maps
17/26Chapter 2 17
Alternative Map Labeling
Map use largely involves: Entering values into the map, and Reading off product terms from the
map.
Alternate labelings are useful:y
z
x
10 2
4
3
5 67
xy
zz
y y z
z
10 2
4
3
5 67
x
0
1
00 01 11 10
x
-
7/31/2019 Lec07 Karnaugh Maps
18/26Chapter 2 18
Example Functions
By convention, we represent the minterms of F by a "1"in the map and leave the minterms of blank Example:
Example:
Learn the locations of the 8indices based on the variableorder shown (x, most significantand z, least significant) on themap boundaries
y
x
10 2
4
3
5 67
1
111
z
x
y10 2
4
3
5 671 111
z
(2,3,4,5)z)y,F(x, m
(3,4,6,7)c)b,G(a, m
F
-
7/31/2019 Lec07 Karnaugh Maps
19/26Chapter 2 19
Combining Squares
By combining squares, we reduce number of literals in a product term, reducing the literal cost,thereby reducing the other two cost criteria
On a 3-variable K-Map: One square represents a minterm with three
variables Two adjacent squares represent a product term
with two variables
Four adjacent terms represent a product termwith one variable
Eight adjacent terms is the function of all ones (novariables) = 1.
-
7/31/2019 Lec07 Karnaugh Maps
20/26Chapter 2 20
Example: Combining Squares
Example: Let
Applying the Minimization Theorem threetimes:
Thus the four terms that form a 2 2 squarecorrespond to the term "y".
yzyyz
zyxzyxzyxzyx)z,y,x(F
x
y10 24
3
5 671 1
11
z
m(2,3,6,7)F
-
7/31/2019 Lec07 Karnaugh Maps
21/26Chapter 2 21
Three-Variable Maps
Reduced literal product terms for SOP standardforms correspond to rectangles on K-mapscontaining cell counts that are powers of 2.
Rectangles of 2 cells represent 2 adjacentminterms; of 4 cells represent 4 minterms thatform a pairwise adjacent ring. Rectangles can contain non-adjacent cells due to
wrap-around at edges
-
7/31/2019 Lec07 Karnaugh Maps
22/26
Chapter 2 22
Three-Variable Maps
Topological warp of 3-variable K-mapsthat shows all adjacencies:
-
7/31/2019 Lec07 Karnaugh Maps
23/26
Chapter 2 23
Three-Variable Maps
Example Shapes of 2-cell Rectangles:y0 1 3 2
5 64 7x
z
XY
YZ
XZ
-
7/31/2019 Lec07 Karnaugh Maps
24/26
Chapter 2 24
Three-Variable Maps
Example Shapes of 4-cell Rectangles:
Read off the product terms for therectangles shown
y0 1 3 2
5 64 7x
z
Y
Z
Z
-
7/31/2019 Lec07 Karnaugh Maps
25/26
Chapter 2 25
Three Variable Maps
z)y,F(x,
y
1 1
x
z
1 1
1
z
z
yx
yx
K-Maps can be used to simplify Boolean functions bysystematic methods. Terms are selected to cover the1sin the map.
Example: Simplify )(1,2,3,5,7z)y,F(x, m
-
7/31/2019 Lec07 Karnaugh Maps
26/26
Summary
Circuit Optimization Literal cost Gate input cost
Two-Variable Karnaugh Maps
Three-Variable Karnaugh Maps
top related