5_KMaps
5_KMaps
Jia Chen
[email protected]
Karnaugh map
• A systematic and graphical way to reduce the product or
sum terms in an expression.
• Key: apply the uniting property/theorem/law as judiciously as
possible
Application examples:
x1x2x3 + x1x2x3’ = x1x2 , where a = x1x2, b=x3
( x1 + x2 + x3) (x1 + x2 + x3’ ) = x1 + x2 , where a = x1 + x2, b=x3
2
Karnaugh maps for SoP
Truth table f=1
If x3=0, f=1
regardless of the
Use Boolean algebra: values of x1 and x2
f = m0 + m2 + m4 + m5 + m6
= (m0 + m2 + m4 + m6) m0 + m2 + m4 + m6 = x3’
+ (m4 + m5)
= (x1’x2’x3’+ x1’x2 x3’+ x1x2’x3’+ x1x2x3’) f=1
+ (x1x2’x3’+ x1x2’x3)
= x1’x3’ + x1x3’ + x1x2’
= x3’ + x1x2’
If x1 =1 and x2 =0, f=1
How to easily discover groups of minterms for f=1 regardless of the
that can be combined into single terms? value of x3
4
m4 + m5= x1x2’
Karnaugh map
• An alternative to the truth-table form for representing a function
5
Location of two-variable minterms
x x
1 2 x
x 1
2 0 1
0 0 m0
0 1 m1 0 m0 m2
1 0 m2
1 m1 m3
1 1 m3
B B 1 1 0
0 1
A
0 m0 m2 Combining m0 + m1 = A’
1 m1 m3 Output = m0 + m1 + m2 = A’ + B’
7
Observation
A’ A Output = A’ + B’
B
0 1
A • In the two cells (A=0,B=0), & (A=1,B=0)
• Result doesn’t include A as A has two different
B’ 0 1 1 values 0 and 1
• Result only includes B as B is always 0
• As B=0 in both cells, result is B’
B 1 1 0
9
How to get a SINGLE product term (Step 3)?
• A product terms include only those variables having the same value for all
cells in the group represented by this term
• The larger the group of 1s, the fewer the number of variables in the
corresponding product term
11
Practicing 2-variable K-map
• What’s the simplified function of the given K-map?
A. A’
B. A’B
C. AB’
B A 0 1
D. B
E. A
0 0 0
1 1 1
12
Practicing 2-variable K-map
• What’s the simplified function of the given K-map?
A. A’
B. A’B
B A 0 1
C. AB’
D. B
0 0 0
E. A
B (as B has the same
1 1 1 value 1 in both cells
while A has different
values 0/1 in two cells)
13
3-variable K-map example
• One dimension (row or column) will represent two variables and the other dimension represents
one variable
• Adjacent cells should differ by only 1 bit; so we only change one variable in the neighboring
columns and rows Solution 1:
Input
A’B’ A’B AB AB’
Output
A B C C AB 0,0 0,1 1,1 1,0
0 0 0 1
0 0 1 1 C’ 0 1 1 1 1 C’
0 1 0 1
0 1 1 1 C 1 1 1 0 0
1 0 0 1
1 0 1 0 A’
1 1 0 1
1 1 1 0 Output = A’ + C’
14
Observation
Solution 1:
A’B’ A’B AB AB’
C AB 0,0 0,1 1,1 1,0 C’ (only C is
C’ 0 1 1 1 1 always 0 for all
the four cells,
C 1 1 1 0 0
A=0/1, B=0/1)
A’ (only A is always 0 in all
the four cells, B=0/1, C=0/1)
Output = A’ + C’
15
Schedule for rows/columns is not unique
• One dimension (row or column) will represent two variables and the other dimension represents
one variable
• Adjacent cells should differ by only 1 bit; so we only change one variable in the neighboring
columns and rows Solution 2:
B’C’ B’C BC BC’
Input
Output
A B C A BC 0,0 0,1 1,1 1,0
0 0 0 1
0 0 1 1 A’ 0 1 1 1 1 A’
0 1 0 1
0 1 1 1 A 1 1 0 0 1
1 0 0 1
1 0 1 0
1 1 0 1
C’
1 1 1 0 The most left and the most right columns are adjacent;
The most top and16the most bottom rows are adjacent.
Schedule for rows/columns is not unique
• One dimension (row or column) will represent two variables and the other dimension represents
one variable
• Adjacent cells should differ by only 1 bit; so we only change one variable in the neighboring
columns and rows Solution 3:
B’ B
Input
Output Output = A’ + C’
A B C AC B 0 1
0 0 0 1
0 0 1 1 AC 1,1 0 0
0 1 0 1
0 1 1 1 A’C 0,1 1 1
1 0 0 1 A’
A’C’ 0,0 1 1
1 0 1 0
1 1 0 1
C’
AC’ 1,0 1 1
1 1 1 0
17 And more solutions …
Combine/circle adjacent cells
Circle 2=21 adjacent cells
B’ B B’ B
AC B 0 1 AC B 0 1
AC 1,1 1 0 AC 1,1 1 0
18
Combine/circle adjacent cells
Circle 4=22 adjacent cells
B’ B B’ B
AC B 0 1 AC B 0 1
AC 1,1 1 1 AC 1,1 1 1
19
Combine/circle adjacent cells
Circle 8=23 adjacent cells
B’ B
AC B 0 1
AC 1,1 1 1
A’C Output = 1
0,1 1 1
Special case!
A’C’ 0,0 1 1
AC’
1,0 1 1
20
4-variable K-map
• Usually, row represents 2 variables and column represents 2 variables
• Adjacent columns/rows should differ by only 1 bit; so we only change one variable
in the neighboring column/row
23
Alternatives of 4-variable K-map
A’B’C’ AB’C' ABC' A'BC' A'BC ABC AB’C A’B'C
D’ 0
1
D
24
Karnaugh maps for PoS
Steps to find the simplest PoS
Step 1) Create a 2 dimensional truth table with input variables on each dimension, and
adjacent column(j)/row(i) only change one bit in the variable.
Step 2) Fill each (i , j) with the corresponding result in the truth table
Step 3) Combine neighboring 2, 4, 8, 16 , …, 2n Maxterms to obtain a SINGLE sum term
➢ Therefore, in a K map, we can only circle 2, 4, 8, 16 , …, 2n adjacent cells to obtain a
single term!
➢ How to get a SINGLE sum term (see next slide)
Step 4) Find the “minimum cover” that covers all 0 s in the map
Step 5) AND all the sum terms from the "minimum cover"
26
How to get a SINGLE sum term ?
• A sum term includes only those variables having the same value for
all cells in the group represented by this term
• The larger the group of 0 s, the fewer the number of variables in the
corresponding sum term
28
Simplest PoS: 2-variable K-map
• What’s the simplified function of the given K-map?
B A 0 1
The resulting sum term is B because:
(1) B has the same value 0 in both cells
0 0 0 while A has different values 0/1 in
two cells
(2) B = 0, uncomplemented form, aka B
1 1 1
29
Simplest PoS: 3-variable K-map
B’C’ B’C BC BC’
30
x1 x2 Simplest PoS: 4-variable K-map
x3x4
00 01 11 10
( x 3 + x 4)
The resulting sum is x3 + x4 because:
00 0 0 0 0
• In the four cells, x3 = 0, x4 = 0, x1 = 0/1 , x2 = 0/1
01 0 1 1 0
( x 2 + x 3) • Only variables with constant values are kept
11 1 1 0 1 which are x3 , x4
• As x3 = 0, uncomplemented form, aka x3
10 1 1 1 1
• As x4 = 0, uncomplemented form, aka x4
( x 1 + x 2 + x 3 + x 4)
The resulting sum is x2 + x3 because:
• In the four cells, x2 = 0, x3 = 0, x1 = 0/1 , x4 = 0/1
The resulting sum is 𝑥1ҧ + 𝑥ҧ2 +𝑥ҧ3 +𝑥ҧ4 • Only variables with constant values are kept
because: which are x2 , x3
• No neighbors; a single Maxterm • As x3 = 0, uncomplemented form, aka x3
• As all the variables are 1, • As x2 = 0, uncomplemented form, aka x2
complemented form
31 F = (x3 + x4)(x2 + x3)(x1’ + x2’ + x3’ + x4’)
Karnaugh maps for Incompletely
Specified Functions
Incompletely Specified Functions
• Situations where the output of a function can be either 0 or 1
for a particular combination of inputs
• This is specified by a don’t care in the truth table
• This happens when
• The input does not occur. e.g. Decimal numbers 0… 9 use 4 bits,
so (1,1,1,1) does not occur.
• The input may happen but we don’t care about the output. E.g. The
output driving a seven segment display – we don’t care about
illegal inputs (greater than 9)
33
Recall: Truth table with Don’t Cares
1 0 1 0 x x x x x x x
1 0 1 1 x x x x x x x
Don’t-care 1
1
1 0 0
1 0 1
x
x
x
x
x x x
x x x
x x
x x
conditions 1 1 1 0 x x x x x x x
1 1 1 1 x x x x x x x
1 0 1 0 x x x x x x x 11 X X X X
1 0 1 1 x x x x x x x
Don’t-care 1
1
1 0
1 0
0
1
x
x
x
x
x
x
x
x
x
x
x
x
x
x 10 1 1 X X
conditions 1 1 1 0 x x x x x x x
1 1 1 1 x x x x x x x
x1 x0
x3 x2
00 01 11 10
00 1 0 1 1
01 0 1 1 1 Green “1”s have been circled
Red “1”s have not been circled
11 X X X X
10 1 1 X X
42
The simplest SoP with Don’t Cares
What is the simplest product term including the “1” on
the left top corner?
x1 x0
x3 x2
00 01 11 10
00 1 0 1 1
01 0 1 1 1
11 X X X X
10 1 1 X X
43
The simplest SoP with Don’t Cares
What is the simplest product term including the “1” on
the left top corner? (circle as many cells as possible)
x1 x0
x3 x2
00 01 11 10
00 1 0 1 1 We can circle as many as four cells
01 0 1 1 1
x0’x2’
11 X X X X
10 1 1 X X(1)
44
The simplest SoP with Don’t Cares
x1 x0
x3 x2
00 01 11 10
00 1 0 1 1
01 0 1 1 1 Green “1”s have been circled
Red “1”s have not been circled
11 X X X X
10 1 1 X X
45
The simplest SoP with Don’t Cares
What is the simplest product term including the “1”
x1 x0
x3 x2
00 01 11 10
00 1 0 1 1
01 0 1 1 1 Green “1”s have been circled
Red “1”s have not been circled
11 X X X X
10 1 1 X X
46
The simplest SoP with Don’t Cares
What is the simplest product term including the “1”
x1 x0
x3 x2
00 01 11 10
00 1 0 1 1 We can circle as many as four cells
01 0 1 1 1
x0x2
11 X X(1) X(1) X
10 1 1 X X
47
The simplest SoP with Don’t Cares
x1 x0
x3 x2
00 01 11 10
00 1 0 1 1
01 0 1 1 1 Green “1”s have been circled
Red “1” has not been circled
11 X X X X
10 1 1 X X
48
The simplest SoP with Don’t Cares
What is the simplest product term including the “1”
x1 x0
x3 x2
00 01 11 10
00 1 0 1 1
01 0 1 1 1
11 X X X X
10 1 1 X X
49
The simplest SoP with Don’t Cares
Which of the following circling will lead to the simplest product term including the “1”
(1). (2).
(3). (4).
50
The simplest SoP with Don’t Cares
Which of the following circling will lead to the simplest product term including the “1”
(1). (2).
(3). (4). x3
51
Summary
x1 x0
x3 x2
00 01 11 10
00 1 0 1 1
01 0 1 1 1
1 0 1 0 x x x x x x x 11 X X X X
1 0 1 1 x x x x x x x
Don’t-care 1
1
1 0
1 0
0
1
x
x
x
x
x
x
x
x
x
x
x
x
x
x 10 1 1 X X
conditions 1 1 1 0 x x x x x x x
1 1 1 1 x x x x x x x
a = x1 + x0’x2’ + x0x2 + x3
52