Karnaugh Map
• Asimple straightforward method for “minimizing” a
Boolean expression.
• This method utilizes a map, called a Karnaugh map or
K-map, representation of the truth table.
• Each map is made up of squares called cells.
• Each minterm/maxterm is represented by a cell.
• The cells are arranged such that adjacent cells are
assigned to adjacent minterms/maxterms.
2.
Karnaugh Map
• Thecells contain the Boolean values of the expression.
• The Boolean expression is minimized by recognizing
various patterns in the Karnaugh map.
• The simplest recognizable patterns lead to either a
sum-of-product terms (SOP) expression or a product-of-
sum terms (POS) expression with a minimum number of
literals.
3.
Two-Variable Karnaugh Map
AB F(A ,B )
0 0 A'B' B
0 1 A'B A 0 1
1 0 AB' 0 A'B' A'B
1 1 AB 1 AB' AB
• There are four minterms for two variables.
• Each minterm is associated with a cell
identified by the intersection of the values of
A and B.
• The K-map of an expression is obtained by filling
up the map with the values corresponding to
each input combination
4.
Two-Variable Karnaugh MapExamples
A B Y
0 0 0 B
0 1 0 A 0 1
1 0 1 0 0 0
1 1 1 1 1 1
A B Y
0 0 0 B
0 1 1 A 0 1
1 0 1 0 0 1
1 1 0 1 1 0
Example 1
Example 2
5.
Three-Variable Karnaugh Map
AB C F(A,B,C )
0 0 0 A'B'C'
0 0 1 A'B'C' BC
0 1 0 A'BC' A 00 01 11 10
0 1 1 A'BC 0 m 0 m 1 m 3 m 2
1 0 0 AB'C' 1 m 4 m 5 m 7 m 6
1 0 1 AB'C
1 1 0 ABC'
1 1 1 ABC
• Take note that the columns are labeled in reflected order
and not in binary progression. This is to maintain the
property that adjacent minterms occupy adjacent cells.
• It should also be noted that both ends are adjacent to each
other.
6.
Three-Variable Karnaugh MapExample
A B C Y
0 0 0 0
0 0 1 1 BC
0 1 0 1 A 00 01 11 10
0 1 1 0 0 0 1 0 1
1 0 0 0 1 0 1 1 0
1 0 1 1
1 1 0 0
1 1 1 1
7.
Four-Variable Karnaugh Map
CD
AB00 01 11 10
00 m 0 m 1 m 3 m 2
01 m 4 m 5 m 7 m 6
11 m 12 m 13 m 15 m 14
10 m 8 m 9 m 11 m 10
• Both the columns and the rows are labeled in
reflected order.
Karnaugh Maps andSum-of-Product (SOP) Terms
CD
AB 00 01 11 10
00
01
11
10
D
A
B
C
ABCD
ABC'D
- Each minterm/cell can be interpreted as the
intersection of the areas labeled as below.
- The labels are the literals that are 1 within the
area.
- The Boolean expression can be obtained by getting
the sum of the minterms.
12.
Karnaugh Maps andSum-of-Product (SOP) Terms
• Adjacent minterms can be factored to remove one of
the literals, e.g.,
ABD
C
C
ABD
D
C
AB
ABCD
)
(
• The resulting product term represents a
rectangular area that is the intersection of the
areas of each of the literals.
• This may be extended to larger groupings.
• The size of each area is always a power of 2.
13.
Example 1
Given theequation
AC
D
B
A
Y
This can be expanded into a sum-of-minterms form into
)
15
,
14
,
11
,
10
,
3
,
1
(
)
)(
(
)
(
ABCD
D
ABC
CD
B
A
D
C
B
A
CD
B
A
D
C
B
A
D
D
B
B
AC
C
C
D
B
A
AC
D
B
A
Y
14.
Example 1
The K-mapis given by
CD
AB 00 01 11 10
00 0 1 1 0
01 0 0 0 0
11 0 0 1 1
10 0 0 1 1
D
A
B
C
By comparison, it can be seen that
• corresponds to the intersection of , , and D,
• corresponds to the intersection of A and C, and
• Y corresponds to the union of the two areas.
D
B
A A B
AC
15.
Example 2
Determine theK-map of
D
ABC
C
B
A
D
B
Y
Solution
CD
AB 00 01 11 10
00 0 1 1 0
01 0 0 0 0
11 0 0 0 1
10 1 1 1 0
D
A
B
C
AB'C' B'D
ABCD'
16.
Example 3
Determine theK-map of
C
B
A
AC
BD
Y
Solution
CD
AB 00 01 11 10
00 1 1 0 0
01 0 1 1 0
11 0 1 1 1
10 0 0 1 1
D
A
B
C
A'B'C' BD
AC
17.
Example 4
• Itmay be necessary to convert a given expression
into a sum-of-product-terms form in order to get
the K-map more easily.
• Determine the K-map of
)
(
)
( D
C
A
D
C
B
A
Y
• Solution
D
C
A
D
A
C
A
B
A
D
C
A
D
C
A
B
A
D
C
A
D
C
A
B
A
Y
)
(
)
(
CD
AB 00 01 11 10
00 1 0 1 1
01 1 1 1 1
11 1 1 1 1
10 1 1 1 1
D
A
B
C
18.
Karnaugh Maps andProduct-of-Sum (POS) Terms
• Similarly, the Boolean expression can be taken from the
maxterms.
• Each maxterm/cell can be interpreted as the
intersection of the areas labeled below.
CD
AB 00 01 11 10
00
01
11
10
D'
A'
B'
C'
A'+B'+C+D' A'+B'+C'+D'
- The labels are the literals that are 0 within the area.
19.
Karnaugh Maps andProduct-of-Sum (POS) Terms
• The Boolean expression can be obtained by getting the
product of the maxterms.
• Adjacent maxterms can be factored to remove one of
the literals, e.g.,
• The resulting sum term represents a rectangular area
that is the intersection of the areas of each of the
literals.
• This may be extended to larger groupings.
• The size of each area is always a power of 2.
D
B
A
C
C
D
B
A
D
C
B
A
D
C
B
A
)
(
)
)(
(
20.
Example 1
Given theequation
)
)(
( B
A
D
C
A
Y
This can be expanded into a product-of-maxterms form
into
)
14
,
10
,
3
,
2
,
1
,
0
(
)
)(
)(
(
)
)(
)(
(
)
)
)((
)
((
)
)(
(
D
C
B
A
D
C
B
A
D
C
B
A
D
C
B
A
D
C
B
A
D
C
B
A
D
D
C
C
B
A
B
B
D
C
A
B
A
D
C
A
Y
21.
Example 1
The K-mapis given by
By comparison, it can be seen that
• corresponds to the intersection of , ,
and D,
• corresponds to the intersection of A and B, Y
corresponds to the union of the two areas.
A
)
( D
C
A
C
)
( B
A
CD
AB 00 01 11 10
00 0 0 0 0
01 1 1 1 1
11 1 1 1 0
10 1 1 1 0
D'
A'
B'
C'
22.
Example 2
Determine theK-map of
Solution
)
)(
)(
( D
C
B
A
C
B
A
D
B
Y
CD
AB 00 01 11 10
00 0 0 1 1
01 1 0 0 1
11 1 0 0 0
10 1 1 1 1
D'
A'
B'
C'
B'+D'
A+B+C
A'+B'+C'+D
23.
Example 3
Determine theK-map of
Solution
)
)(
)(
( D
C
B
D
C
C
A
Y
CD
AB 00 01 11 10
00 0 0 1 0
01 0 0 1 0
11 0 1 1 0
10 1 1 1 0
D'
A'
B'
C'
B'+C+D A+C
C'+D
24.
Simplification Using K-Maps
•The Boolean expression can be simplified using its K-map by
determining a minimum group of cells that will completely
describe the expression.
– Grouping of all 1’s lead to the SOP expression.
– Grouping of all 0’s lead to the POS expression.
• Grouping rules
– The size of each group is always a power of 2, i.e., 1, 2,
4, 8, etc.
– The dimensions of the group are always powers of 2, i.e.,
no diagonal groupings.
25.
Simplification Using K-Maps
•The simplest SOP or POS expression has the following
properties:
– At least one member of each group is not a member
of any other group.
– Each group is the largest possible group that
includes its members.
26.
Simplification Using K-Maps
•Implicants
Implicant – any group of equal valued cells
Prime Implicant – any implicant which cannot be a part
of another (largest)
Essential Prime Implicant – a prime implicant with at
least one member that is not a member of any other
prime implicant
Example 1
CD
AB 00 01 11 10
00 1 1 1
01 1 1
11 1
10 1 1
27.
Simplification Using K-Maps
CD
AB00 01 11 10
00 1 1
01 1 1
11 1 1 1
10 1
- Simplified expression is composed of all essential
prime implicants and possibly some (non-
essential) prime implicants.
Example 2
28.
Simplification Using K-Maps
1.Procedure
2. Search for prime implicants of size 1.
(loners)
3. Search for prime implicants of size 2 with at least one
member that is not a member of another prime
implicant.
(only one way)
4. Repeat step 2 for size of 4, 8, 16, etc.
5. Select from among remaining prime implicants to
complete specification with a minimum number of
literals.
6. Write expression.
29.
Simplification Using K-MapsExamples
CD
AB 00 01 11 10
00 1
01
11 1 1 1
10 1 1
AC
ABD
D
C
B
A
F
CD
AB 00 01 11 10
00 1 1
01 1 1 1
11 1 1
10 1
BCD
D
A
D
C
A
F
Example 1
Example 2
30.
Simplification Using K-MapsExamples
CD
AB 00 01 11 10
00 1 1
01 1
11 1 1 1
10 1 1 1
C
AB
ACD
D
C
B
C
B
D
C
A
ACD
D
C
B
C
B
F
CD
AB 00 01 11 10
00 1 1
01 1 1
11 1 1 1
10 1
D
C
B
ABC
D
C
B
C
A
ABD
ABC
D
C
B
C
A
F
Example 3 Example 4
31.
Simplification Using K-MapsExamples
CD
AB 00 01 11 10
00 1 1
01 1 1
11 1 1
10 1 1
D
B
A
BC
A
ABD
C
B
A
D
C
B
D
C
A
BCD
D
C
A
F
CD
AB 00 01 11 10
00 1 1
01 1 1 1
11 1 1 1
10 1 1
D
B
A
C
B
A
BC
D
B
F
Example 5 Example 6
32.
Simplification Using K-MapsExamples
CD
AB 00 01 11 10
00 0 0
01 0 0
11 0
10 0 0 0
)
)(
)(
)(
( C
A
C
B
D
B
A
D
C
B
A
F
CD
AB 00 01 11 10
00 0 0
01 0
11 0
10 0 0
)
)(
)(
( D
B
A
D
C
B
C
B
A
F
Example 7 Example 8
33.
5-Variable K-Map Example
DE
BC00 01 11 10 00 01 11 10
00 1 1 00 1 1 1
01 1 1 1 01 1 1
11 1 11 1
10 1 10 1
A = 0 A = 1
D
B
E
AD
E
C
B
A
E
D
B
A
E
C
B
A
F
34.
6-Variable K-Map Example
EF
CD00 01 11 10 00 01 11 10
00 00 1
01 1 1 01 1 1
11 1 11
10 10
00 01 11 10 00 01 11 10
00 00
01 1 1 1 01 1 1 1
11 1 1 1 11
10 10
B = 0 B = 1
A
=
0
A
=
1
DF
C
DE
C
A
DF
B
A
F
E
CD
B
F
E
D
C
B
A
F
35.
Don’t-Care Conditions
• Usually,the values in the K-map are assumed to
be either 0 or 1 only.
- We can indicate only the 0’s or the 1’s in
the map the rest are understood to be
the complement.
• In some cases, especially when designing logic
circuits, not all possible combinations of the
input are specified.
• The unspecified combinations either
- are not valid inputs and system is well-
designed that these never occur, or
- are valid but we do not care what the
corresponding output in these cases are.
K-Map Simplification withDon’t-Care Values
• The don’t-care values are distinguished from
the 0’s and 1’s using the symbol .
• In the list notation, these are written as
d(list of don’t-care inputs)
so that
F(inputs) = (list of minterms) +
d(list of don’t-care inputs)
F(inputs) = (list of maxterms) +
d(list of don’t-care inputs)
38.
K-Map Simplification withDon’t-Care Values
• The don’t-care values are used only if their
inclusion can simplify the Boolean expression,
i.e.,
»used to find the prime implicants, but
»not used in identifying the essential prime
implicants.
39.
Don’t Care ConditionExample 1
Z = (1,3,7,11,15) + d(0,2,5)
AB 00 01 11 10
00 1 1
01 0 1 0
11 0 0 1 0
10 0 0 1 0
CD
CD
D
A
Z
40.
Don’t Care ConditionExample 2
)
15
,
14
,
12
,
9
,
8
(
d
)
13
,
11
,
6
,
5
,
1
(
Z
AB 00 01 11 10
00 0 1 0 0
01 0 1 0 1
11 1
10 1 0
CD
D
BC
D
C
AD
Z
41.
Don’t Care ConditionExample 3
)
13
,
9
,
7
,
3
(
d
)
12
,
6
,
5
,
4
(
Z
AB 00 01 11 10
00 0 0 0
01 1 1 1
11 1 0 0
10 0 0 0
CD
C
B
B
A
Z
42.
Don’t Care ConditionExample 4
)
13
,
9
,
7
,
3
(
d
)
15
,
14
,
11
,
10
,
8
,
2
,
1
,
0
(
Z
AB 00 01 11 10
00 0 0 0
01 1 1 1
11 1 0 0
10 0 0 0
CD
)
( C
A
B
Z