Upload
phamphuc
View
230
Download
2
Embed Size (px)
Citation preview
Computer Organization I
Lecture 9: Karnaugh Maps
� What is Karnaugh Map?
� Truth Table and Karnaugh Map
� Logic Function and Karnaugh Map
� Apply Karnaugh Map to Simplify Logic Function
Overview
Objectives
� Understand what is Karnaugh map
� To know how to simplify logic function using Karnaugh map
Boolean Function Optimization- Approach 2: Karnaugh Maps (K-map)
• Why use K-map?
Provides a systematic means to obtain optimum or near optimum
SOP and POS forms for any given functions with small numbers
of variables (usually number of variables no more than 4).
• What is K-map? K-map is an array of squares, in which each square represents a
minterm; given Num. of Variables n, total num. of squares is 2n
y
m1m0
m2 m3
x
0
1
0 1y z
m1m0 m2
m4
m3
m5 m6m7
x
0
1
00 01 11 10
Boolean Function Optimization- Approach 2: Karnaugh Maps (K-map)
• What is physical adjacence in K-map? – In K-map, each square is physically adjacent to the
squares that are immediately next to it on any of its four side; e.g.
In 2 variable K-map, m1 and m0 are physically adjacent
y
m1m0
m2 m3
x
0
1
0 1
y z
m1m0 m2
m4
m3
m5 m6m7
x
0
1
00 01 11 10
Boolean Function Optimization- Approach 2: Karnaugh Maps (K-map)
• What is logical adjacence in K-map? – In K-map two squares are logically adjacent if the two squares
differ in only one variable which appears uncomplemented in one square and complemented in the other square; e.g.
In 2 variable K-map, m1 and m0 are logically adjacent
y
m1m0
m2 m3
x
0
1
0 1
y z
m1m0 m2
m4
m3
m5 m6m7
x
0
1
00 01 11 10
Boolean Function Optimization- Approach 2: Karnaugh Maps (K-map)
• Main feature of K-map? (1) Any two squares are physically adjacent means they are
logically adjacent (i.e.), e.g.
(2) Logically, squares in the top row are adjacent to the
corresponding row in the bottom, and
Similarly, squares in the outer left are logically adjacent to the
corresponding column in the outer right.
y
m1m0
m2 m3
x
0
1
0 1
y z
m1m0 m2
m4
m3
m5 m6m7
x
0
1
00 01 11 10
Boolean Function Optimization- Approach 2: Karnaugh Maps (K-map)
• Truth Table and K-map? (1) K-map is just a different form of truth table, e.g.
Truth Table of F(A,B) K-map of F(A,B)
In K-map, “1” means the corresponding minterm exists
B
11
0 1
A
0
1
0 1
A B
0 0
0 1
1 0
1 1
F (A,B)
1
1
0
1
Boolean Function Optimization- Approach 2: Karnaugh Maps (K-map)
• Example: given truth table, to draw K-map?
A B C F(ABC)
0 0 0 1
0 0 1 0
0 1 0 1
0 1 1 0
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1
B C
01 1
0
0
1 01
A
0
1
00 01 11 10
Boolean Function Optimization- Approach 2: Karnaugh Maps (K-map)
• K-map and Logic Function Expression? given K-map, logic function expression can be represented
by the logic sum (i.e. OR) of minterms corresponding to
“1” in K-map. For example:
F(A,B) = m0 + m1 + m3
= AB + AB + AB
= A + AB
= A + B
B
11
0 1
A
0
1
0 1
Boolean Function Optimization- Approach 2: Karnaugh Maps (K-map)
• K-map and Logic Function Expression (cont.) given logic function expression, to draw K-map. e.g.
If the function is in SOM, i.e. F (A,B,C) = ƩƩƩƩm (4,6,7)
If the function is in SOP, i.e. F (A,B,C) = AB + AC, then convert it
into SOM expression…or
write truth table first and then based on truth table, draw K-map
B C
00 0
1
0
0 11
A
0
1
00 01 11 10
Boolean Function Optimization- Approach 2: Karnaugh Maps (K-map)
• K-map simplification: combine 2 adjacent squares
CD
00 0
0
0
0 01
AB
0
1
00 01 11 10
00 0
0
1
0 00
1
0
0
0
1
1
A changed
after combination, the function
is simplified into BCD
Boolean Function Optimization- Approach 2: Karnaugh Maps (K-map)
• K-map simplification: combine 4 adjacent squares
CD
00 0
0
0
1 01
AB
0
1
00 01 11 10
10 0
0
1
0 00
1
0
0
0
1
1
A changed
after combination, the function
is simplified into BD
C changed
Boolean Function Optimization- Approach 2: Karnaugh Maps (K-map)
• K-map simplification: combine 8 adjacent squares
CD
00 0
1
0
1 11
AB
0
1
00 01 11 10
11 1
0
1
0 00
1
0
0
0
1
1
A changed
after combination, the function
is simplified into B
Both C and D changed
Boolean Function Optimization- Approach 2: Karnaugh Maps (K-map)
• Combination of adjacent squares for n variables K-map(1) in order to do simplification, the number of adjacent squares
in the circle must be 2i , i = 1,2,…
(2) by combining the 2i adjacent squares in the circle, there are i
variable to be eliminated. So, given n variable, the number of
variable after the 2i combination simplification is (n-i).
Boolean Function Optimization- Approach 2: Karnaugh Maps (K-map)
• Steps to simplify function using K-map(1) draw K-map based on given logic function
(2) circle all adjacent squares whose value is 1, note: the number
of squares in the circle is 2,4,8…
(3) the size of single circle should be as big as possible, and the
total number of circles should be as less as possible
(4) one square in a circle can be included in the other circles, but
in each circle, it should have at least one square that is circled
only one time
(5) the simplified logic function is the logic sum (OR) of simplified
terms represented by corresponding circles
Boolean Function Optimization- Approach 2: Karnaugh Maps (K-map)
• Example 1: F (A,B,C) = ƩƩƩƩm (0,1,2,4,6,7),
F (A,B,C) = AB + BC + AB + BC = AB + AB + C
B C
11 1
1
0
0 11
A
0
1
00 01 11 10
Boolean Function Optimization- Approach 2: Karnaugh Maps (K-map)
• Example 2: F (A,B,C,D) = ƩƩƩƩm (0,2,3,6,7,8,10,11),
F (A,B,C,D) = AC + BC + BD
CD
01 1
0
1
0 11
AB
0
1
00 01 11 10
00 0
1
0
0 11
1
0
0
0
1
1
Boolean Function Optimization- Approach 2: Karnaugh Maps (K-map)
• Example 3: F (A,B,C,D) = ƩƩƩƩm (0,4,5,6,7,12,14,15),
F (A,B,C,D) = ?
CD
01 0
1
0
1 11
AB
0
1
00 01 11 10
01 1
0
1
0 00
1
0
0
0
1
1
Boolean Function Optimization- Approach 2: Karnaugh Maps (K-map)
• Example 4: F (A,B,C,D) = ƩƩƩƩm (1,5,6,7,11,12,13,15),
F (A,B,C,D) = ?
CD
10 0
0
0
1 11
AB
0
1
00 01 11 10
11 0
0
1
0 01
1
0
0
0
1
1
Boolean Function Optimization- Approach 2: Karnaugh Maps (K-map)
• What is “Don’t Care” in K-mapSometimes a function table or map contains entries for which it
is known:
(1) the input values for the minterm will never occur, or
(2) the output value for the minterm is not used, i.e. the value
can be either 0 or 1
In these cases, these entries (in map) or terms (in function) are
defined “don't cares”
By placing “don't cares” into “x” (in map) or “d” in function, we
can simplify the corresponding logic expression.
Boolean Function Optimization- Approach 2: Karnaugh Maps (K-map)
• Simplifying logic function with “Don’t Care”For example: given logic function F (A,B,C,D) = ƩƩƩƩm
(0,1,5,7,8,11,14) + ƩƩƩƩd(3,9,12,15)
F = BC + AD + CD + ABC
or,
F = BC + AD + CD + ABD
CD
11 0
0
x
1 01
AB
0
1
00 01 11 10
0x 1
1
x
x 01
1
0
0
0
1
1
Boolean Function Optimization- Approach 2: Karnaugh Maps (K-map)
• Simplifying logic function with “Don’t Care”For example: given logic function F (A,B,C,D) = ƩƩƩƩm
(0,3,4,7,11) + ƩƩƩƩd(8,9,12,13,14,15)
F = CD + CD
CD
01 0
1
1
0 01
AB
0
1
00 01 11 10
xx x
x
x
x 01
1
0
0
0
1
1
Summary
• Applying Karnaugh map to simplify logic function with no more than 4 variables
Thank youQ & A