0% found this document useful (0 votes)
9 views52 pages

5_KMaps

The document provides an overview of Karnaugh maps, a graphical method for simplifying Boolean expressions by reducing product or sum terms. It explains the uniting theorem, the process of grouping minterms, and the steps to find the simplest Sum of Products (SoP) using Karnaugh maps. Additionally, it includes examples and observations on how to derive simplified functions from 2-variable and 3-variable K-maps.

Uploaded by

mlope589
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views52 pages

5_KMaps

The document provides an overview of Karnaugh maps, a graphical method for simplifying Boolean expressions by reducing product or sum terms. It explains the uniting theorem, the process of grouping minterms, and the steps to find the simplest Sum of Products (SoP) using Karnaugh maps. Additionally, it includes examples and observations on how to derive simplified functions from 2-variable and 3-variable K-maps.

Uploaded by

mlope589
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

Karnaugh maps

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

Uniting Theorem a b + a b’ = a (a + b)·(a + b’)=a

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

• A map consists of cells corresponding to the rows of the truth


table

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

(a) Truth table (b) Karnaugh map

• Advantage: minterms in any two cells that are adjacent, either


in the same row or the same column, can be combined.

• Test m2+m3 ? m2+m3 = x1x2’+ x1x2 = x1


6
2-variable K-map example
Input
Output A’ A
A B
0 0 1 m0 B
0 1 1 m1 0 1
A
1 0 1 m2
1 1 0 m3 B’ 0 1 1 Combining m0+m2 = B’

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

• In the two cells (A=0,B=0), & (A=0,B=1)


• Result doesn’t include B as B has two different values 0 and 1
• Result only includes A as A is always 0
• As A=0 in both cells, result is A’
Conclusion:
(1) A resulting term from a combination only contains the variables having constant values
(2) If the variable (denoted as X)=0 in all cells combined, X’ shows up in the resulting term;
otherwise X shows up in the resulting term. 8
Steps to find the simplest SoP
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 output result in the truth table
Step 3) Combine neighboring 2, 4, 8, 16 , …, 2n Minterms to obtain a SINGLE product 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 product term (see next slide)
Step 4) Find the “minimum cover” that covers all 1s in the map
Step 5) OR the product terms in the "minimum cover"

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

• If the variable is 1 in the group, it appears uncomplemented ( e.g., X )

• If the variable is 0 in the group, it appears complemented ( e.g., X’ )


Strategy for SoP simplification
• Intuitive strategy: find as few as possible for the number of groups &
as large as possible for the number of cells with 1s for each group

• Each group of 1s has to comprise cells that can be represented by a


single product 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

A’C 0,1 1 0 A’C 0,1 0 0


A’C’ 0,0 0 0 A’C’ 0,0 0 0
AC’ AC’
1,0 1 1 1,0 1 1

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

A’C 0,1 1 1 A’C 0,1 0 0


A’C’ 0,0 0 0 A’C’ 0,0 0 0
AC’ AC’
1,0 0 0 1,0 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

A’B’ A’B AB AB’


A’B’C’
00 01 11 10
C’D’ 00 1 0 0 0
C’D 01 1 0 0 0 F(A, B, C) = A’B’C’+B’CD’
CD 11 0 0 0 0
CD’ 10 1 0 0 1
21
B’CD’
Observation
The resulting product is A’B’C’ because:
A’B’ A’B AB AB’
• In the two cells, A=0,B=0,C=0,D=0/1
00 01 11 10 • Only variables with constant values are
kept which are A, B, C
C’D’ 00 1 0 0 0 • As A=0, complemented form, aka A’
• Similarly for B, C
C’D 01 1 0 0 0
CD 11 0 0 0 0 The resulting product is B’CD’ because:
• In the two cells, A=0/1,B=0,C=1,D=0
CD’ 10 1 0 0 1 • Only variables with constant values are
kept which are B, C, D
• As B=0, complemented form, aka B’
• As C=1, uncomplemented form, aka C
• As D=0, complemented form, aka D'
F(A, B, C) = A’B’C’+B’CD’ 22
Alternatives of 4-variable K-map
D’B’ D’B DB DB’
00 01 11 10

C’A’ 00 Fill the cell with 0 if output = 0


when A = 1, B = 1, C = 0, D = 0
C’A 01 ? Fill the cell with 1 if output = 1
CA 11 when A = 1, B = 1, C = 0, D = 0
CA’ 10

23
Alternatives of 4-variable K-map
A’B’C’ AB’C' ABC' A'BC' A'BC ABC AB’C A’B'C

000 100 110 010 011 111 101 001

D’ 0

1
D

BUT, not very convenient!

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

• If the variable is 1 in the group, it appears complemented (e.g., X’)

• If the variable is 0 in the group, it appears uncomplemented (e.g., X)


Strategy for POS simplification
• Intuitive strategy: find as few as possible for the number of groups &
as large as possible for the number of cells with 0s for each group

• Each group of 0 s has to comprise cells that can be represented by a


single sum 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’

Input A BC 0,0 0,1 1,1 1,0


Output
A B C
0 0 0 1 A’ 0 1 1 0 0
0 0 1 1
0 1 0 0 A 1 1 1 0 0
0 1 1 0
1 0 0 1 The resulting sum term is B’ because:
1 0 1 1 (1) B has the same value 1 in all the
1 1 0 0 four cells while A, C have different
1 1 1 0 values 0/1
(2) B = 1, complemented form, aka B’

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

• Each “x” for these valuations is either 1 or 0, whichever is more useful


34
K-map with Don’t Cares
x1 x0 Consider the output a
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

• Each “X” for these valuations is either 1 or 0, whichever is more useful


35
The simplest SoP with Don’t Cares
You can treat “X” as either 0 or 1
— depending on which is more advantageous
x1 x0
x3 x2
00 01 11 10
00 1 0 1 1 What is the simplest
01 0 1 1 1 product term including
the “1” ?
11 X X X X
10 1 1 X X
36
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 If we circle one cell
01 0 1 1 1
x3’ x2’ x1 x0
11 X X X X
10 1 1 X X
37
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 If we circle two cells
01 0 1 1 1
x3’ x2’ x1
11 X X X X
10 1 1 X X
38
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 If we circle four cells
01 0 1 1 1
x3’ x1
11 X X X X
10 1 1 X X
39
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 If we circle eight cells
01 0 1 1 1
x1
11 X X X X
The simplest!
10 1 1 X X
40
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 If we circle eight cells
01 0 1 1 1
x1
11 X X X(1) X(1)
Treat the four “X”s as “1”
10 1 1 X(1) X(1)
41
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
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

You might also like