ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Week 3 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN
Week 3 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering
Overview
K-maps: an alternate approach to representing Boolean functions
K-map representation can be used to minimize Boolean functions
Easy conversion from truth table to K-map to minimized SOP representation.
Simple rules (steps) used to perform minimization Leads to minimized SOP representation.
Much faster and more more efficient than previous minimization techniques with Boolean algebra.
x y F 0 0 1 0 1 1 1 0 0 1 1 0
Karnaugh maps
0 1 y
x 0
1
1
0 0
1
0 1 y
x 0
1
x’y’
xy’ xy
x’y
x
y F = Σ(m0,m1) = x’y + x’y’
x y F 0 0 1 0 1 1 1 0 0 1 1 0
Karnaugh maps Alternate way of representing Boolean function
All rows of truth table represented with a square Each square represents a minterm
Easy to convert between truth table, K-map, and SOP Unoptimized form: number of 1’s in K-map equals
number of minterms (products) in SOP Optimized form: reduced number of minterms
0 1 y
x 0
1
1
0 0
1
0 1 y
x 0
1
x’y’
xy’ xy
x’y
x
y F = Σ(m0,m1) = x’y + x’y’
Karnaugh Maps A Karnaugh map is a graphical tool for assisting in the
general simplification procedure. Two variable maps.
0 A
1 0
1
B 0 1 0 1
F=AB ʹ′+A’B 0 A
1 1
1
B 0 1 0 1
° Three variable maps.
0 A
1 1
1
00 01 0 1
BC
0
1 1
1
11 10
F=AB’C’ +AB ʹ′C +ABC +ABC ʹ′ + A’B’C + A’BC’
F=AB +Aʹ′B +AB ʹ′
A B C F 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 1
+
Rules for K-Maps We can reduce functions by circling 1’s in the K-
map Each circle represents minterm reduction Following circling, we can deduce minimized and-or
form. Rules to consider 1. Every cell containing a 1 must be included at least
once. 2. The largest possible “power of 2 rectangle” must
be enclosed. 3. The 1’s must be enclosed in the smallest possible
number of rectangles.
Karnaugh Maps A Karnaugh map is a graphical tool for assisting in the
general simplification procedure. Two variable maps.
0 A
1 0
1
B 0 1 0 1
F=AB ʹ′+A’B 0 A
1 1
1
B 0 1 0 1
° Three variable maps.
0 A
1 1
1
00 01 0 1
BC
0
1 1
1
11 10
F=AB +Aʹ′B +AB ʹ′
F=AB’C’ +AB ʹ′C +ABC +ABC ʹ′ + A’B’C + A’BC’
Karnaugh Maps A Karnaugh map is a graphical tool for assisting in the
general simplification procedure. Two variable maps.
0 A
1 0
1
B 0 1 0 1
F=AB ʹ′+A’B 0 A
1 1
1
B 0 1 0 1 F=A+B
° Three variable maps.
0 A
1 1
1
00 01 0 1
BC
0
1 1
1
11 10
F=AB +Aʹ′B +AB ʹ′
F=AB’C’ +AB ʹ′C +ABC +ABC ʹ′ + A’B’C + A’BC’
Karnaugh Maps A Karnaugh map is a graphical tool for assisting in the
general simplification procedure. Two variable maps.
0 A
1 0
1
B 0 1 0 1
F=AB ʹ′+A’B 0 A
1 1
1
B 0 1 0 1 F=A+B
° Three variable maps.
F=A+B ʹ′C +BC ʹ′ 0
A
1 1
1
00 01 0 1
BC
0
1 1
1
11 10
F=AB +Aʹ′B +AB ʹ′
F=AB’C’ +AB ʹ′C +ABC +ABC ʹ′ + A’B’C + A’BC’
Karnaugh maps
Numbering scheme based on Gray–code e.g., 00, 01, 11, 10 Only a single bit changes in code for adjacent map
cells This is necessary to observe the variable transitions
00 01 AB
C 0
1
11 10
C
B
A
F(A,B,C) = Σm(0,4,5,7)
G(A,B,C) = 0 0
0 0
1 1
1 1 C
B
A
1 0
0 0
0 1
1 1 C
B
A
A
= AC + B’C’
More Karnaugh Map Examples
Examples
g = b'
0 1 0 1
a b
c ab
00 01 11 10 0 1
0 1 0 1
a b
c ab
00 01 11 10 0 1
0 1 0 1 f = a
0 0 1 0 0 1 1 1
cout = ab + bc + ac
1 1 0 0
0 0 1 1 0 0 1 1
f = a
1. Circle the largest groups possible. 2. Group dimensions must be a power of 2. 3. Remember what circling means!
Application of Karnaugh Maps: The One-bit Adder
Adder
Cin
Cout
S B
A
A B Cin S Cout 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1
+
S = A’B’Cin + A’BCin’ + AB’Cin’ + ABCin
Cout = A’BCin + A B’Cin + ABCin’ + ABCin
= A’BCin + ABCin + AB’Cin + ABCin + ABCin’ + ABCin
= BCin + ACin + AB
= (A’ + A)BCin + (B’ + B)ACin + (Cin’ + Cin)AB = 1·BCin + 1· ACin + 1· AB
How to use a Karnaugh Map instead of the
Algebraic simplification?
Application of Karnaugh Maps: The One-bit Adder
Adder
Cin
Cout
S B
A
Karnaugh Map for Cout
Now we have to cover all the 1s in the Karnaugh Map using the largest rectangles and as few rectangles as we can.
A
B
Cin
0
0
0
1 1 1
0 1
A
B
Cin
Application of Karnaugh Maps: The One-bit Adder
Adder
Cin
Cout
S B
A
0
0
0 0 1
1 1 1
Karnaugh Map for Cout
Now we have to cover all the 1s in the Karnaugh Map using the largest rectangles and as few rectangles as we can.
Cout = ACin
A
B
Cin
Application of Karnaugh Maps: The One-bit Adder
Adder
Cin
Cout
S B
A
0
0
0 0 1
1 1 1
Karnaugh Map for Cout
Now we have to cover all the 1s in the Karnaugh Map using the largest rectangles and as few rectangles as we can.
Cout = Acin + AB
A
B
Cin
Application of Karnaugh Maps: The One-bit Adder
Adder
Cin
Cout
S B
A
0
0
0 0 1
1 1 1
Karnaugh Map for Cout
Now we have to cover all the 1s in the Karnaugh Map using the largest rectangles and as few rectangles as we can.
Cout = ACin + AB + BCin
A
B
Cin
Application of Karnaugh Maps: The One-bit Adder
Adder
Cin
Cout
S B
A
0
1
1 1 0
0 1 0
Karnaugh Map for S
S = A’BCin’
A
B
Cin
Application of Karnaugh Maps: The One-bit Adder
Adder
Cin
Cout
S B
A
0
1
1 1 0
0 1 0
Karnaugh Map for S
S = A’BCin’ + A’B’Cin
A
B
Cin
Application of Karnaugh Maps: The One-bit Adder
Adder
Cin
Cout
S B
A
0
1
1 1 0
0 1 0
Karnaugh Map for S
S = A’BCin’ + A’B’Cin + ABCin
A
B
Cin
Application of Karnaugh Maps: The One-bit Adder
Adder
Cin
Cout
S B
A
0
1
1 1 0
0 1 0
Karnaugh Map for S
S = A’BCin’ + A’B’Cin + ABCin + AB’Cin’
No Possible Reduction!
Can you draw the circuit diagrams?
Summary
Karnaugh map allows us to represent functions with new notation
Representation allows for logic reduction. Implement same function with less logic
Each square represents one minterm Each circle leads to one product term Not all functions can be reduced Each circle represents an application of:
Distributive rule -- x(y + z) = xy + xz
Complement rule – x + x’ = 1
Overview
Karnaugh maps with four inputs Same basic rules as three input K-maps
Understanding prime implicants Related to minterms
Covering all implicants Using Don’t Cares to simplify functions
Don’t care outputs are undefined
Summarizing Karnaugh maps
Karnaugh Maps for Four Input Functions
Represent functions of 4 inputs with 16 minterms Use same rules developed for 3-input functions Note bracketed sections shown in example.
F(A,B,C,D) = Σm(0,2,3,5,6,7,8,10,11,14,15) F = C + B’D’
Karnaugh map 4-variable example
D
A
B
1 0
0 1
0 1
0 0
1 1
1 1
1 1
1 1 C
+ A’BD
0 4
1 5
12 8
13 9
3 7
2 6
15 11
14 10
Implicants
An implicant is a rectangle of 1, 2, 4, 8, . . . (any power of 2) 1’s. May not include any 0’s.
Prime Implicant
A prime implicant is an implicant that (from the point of view of the map) is not fully contained in any one other implicant.
An essential prime implicant is a prime implicant that includes at least one 1 that is not included in any other prime implicant. Prime implicant, but not essential
prime implicant
A' B' D + A' C + B' C D
B C' D' + A C' + A B D'
LT = EQ = GT =
K-map for LT K-map for GT
Design examples
0 0
1 0
0 0
0 0 D
A
1 1
1 1
0 1
0 0 B
C
K-map for EQ
1 0
0 1
0 0
0 0 D
A
0 0
0 0
1 0
0 1 B
C
0 1
0 0
1 1
1 1 D
A
0 0
0 0
0 0
1 0 B
C
Can you draw the truth table for these examples?
A'B'C'D' + A'BC'D + ABCD + AB'CD’
A B C D
EQ
Physical Implementation
° Step 1: Truth table
° Step 2: K-map
° Step 3: Minimized sum-of-products
° Step 4: Physical implementation with gates
K-map for EQ
1 0
0 1
0 0
0 0 D
A
0 0
0 0
1 0
0 1 B
C
Karnaugh Maps
Four variable maps.
0 AB
1 1
0
00 01 00 01
CD
0
0 1
1
11 10 F=Aʹ′BC ʹ′+Aʹ′CD ʹ′+ABC +AB ʹ′Cʹ′D ʹ′+ABC ʹ′+AB ʹ′C
1
1 0
1 11 10
1
1 1
1
° Need to make sure all 1’s are covered
° Try to minimize total product terms.
° Design could be implemented using NANDs and NORs
Karnaugh Maps
Four variable maps.
F=BC ʹ′+CD ʹ′+ AC+ AD ʹ′
0 AB
1 1
0
00 01 00 01
CD
0
0 1
1
11 10 F=Aʹ′BC ʹ′+Aʹ′CD ʹ′+ABC +AB ʹ′Cʹ′D ʹ′+ABC ʹ′+AB ʹ′C
1
1 0
1 11 10
1
1 1
1
° Need to make sure all 1’s are covered
° Try to minimize total product terms.
° Design could be implemented using NANDs and NORs
Karnaugh maps: Don’t cares In some cases, outputs are undefined We “don’t care” if the logic produces a 0 or a 1 This knowledge can be used to simplify functions.
0 0
1 1
X 0
X 1 D
A
1 1
0 X
0 0
0 0
B
C
CD AB
00
01
11
10
00 01 11 10
- Treat X’s like either 1’s or 0’s - Very useful - OK to leave some X’s uncovered
+ C’D
Karnaugh maps: Don’t cares
f(A,B,C,D) = Σ m(1,3,5,7,9) + d(6,12,13) without don't cares
f =
0 0
1 1
X 0
X 1 D
A
1 1
0 X
0 0
0 0
B
C
A’D
CD AB
00
01
11
10
00 01 11 10
C f 0 0 0 1 1 0 1 1 0 0 0 1 1 X 1 0 0 1 1 0 0 1 1
D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
1 0 1 0 0 X X 0 0
A 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
+
B 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
+
Don’t Care Conditions In some situations, we don’t care about the value of a
function for certain combinations of the variables. these combinations may be impossible in certain contexts or the value of the function may not matter in when the
combinations occur
In such situations we say the function is incompletely specified and there are multiple (completely specified) logic functions that can be used in the design. so we can select a function that gives the simplest circuit
When constructing the terms in the simplification procedure, we can choose to either cover or not cover the don’t care conditions.
Prime Implicants
A prime implicant is a rectangle of 1, 2, 4, 8, …1’s or X’s not included in any one larger rectangle. Thus, from the point of view of finding prime implicants, i.e., X’s (don’t cares) are treated as 1’s.
An essential prime implicant is a prime implicant that covers at least one 1 not covered by any other prime implicant (as always). Don’t cares (X’s) do not make a prime implicant essential.
Map Simplification with Don’t Cares
F=Aʹ′Cʹ′D+B+AC 0
AB
x x
1
00 01 00 01
CD
0
x 1
0
11 10
1
x 0
1 11 10
1
1 1
x
0 AB
x x
1
00 01 00 01
CD
0
x 1
0
11 10
1
x 0
1 11 10
1
1 1
x
F=Aʹ′Bʹ′Cʹ′D+ABCʹ′+BC+AC
° Alternative covering.
Karnaugh maps: don’t cares (cont’d)
f(A,B,C,D) = Σ m(1,3,5,7,9) + d(6,12,13) f = A'D + B'C'D without don't cares f = with don't cares
don't cares can be treated as 1s or 0s
depending on which is more advantageous
0 0
1 1
X 0
X 1 D
A
1 1
0 X
0 0
0 0 B
C
A'D
by using don't care as a "1" a 2-cube can be formed rather than a 1-cube to cover this node
+ C'D
50
Five-variable K-maps – f(V,W,X,Y,Z)
V= 0 V= 1
Y m 16 m 17 m 19 m 8 m 20 m 21 m 23 m 22 m 28 m 29 m 31 m 30
X W
m 24 m 25 m 27 m 26 Z
51
Simplify f(V,W,X,Y,Z)=Σm(0,1,4,5,6,11,12,14,16,20,22,28,30,31)
V= 0 V= 1
1 1
1 1 1
1
1 1
1
1 1
1 1 1
f = XZ’ Σm(4,6,12,14,20,22,28,30) + V’W’Y’ Σm(0,1,4,5) + W’Y’Z’ Σm(0,4,16,20) + VWXY Σm(30,31) + V’WX’YZ m11