in karnaugh map

advertisement
Objectives:
1. Karnaugh Map definition.
2. Karnaugh map construction.
 Two variables K-maps.
 Three variables K-maps.
 Four variables K-maps.
3. Summary
1) Karnaugh map definition
 The karnaugh map (k-map) is a graphical tool used to simplify (minimize) the logic
functions, so that it can be implemented with minimum number of gates (minimum
number of product terms and minimum number of literals).
 The K-map is used to convert a truth table to its corresponding logic circuit.
2) Karnaugh map construction
 Two variables K-maps.
 A two- variable function has four possible minterms, we can rearrange these
minterms into a karnaugh map:
𝒙
0
0
1
1
𝒚
0
1
0
1
Minterms
̅𝒚
̅
𝒙
̅𝒚
𝒙
xy̅
𝒙𝒚
x
0
( y)
1
0
xy
xy
y (y)
( x)
1
(x)
xy
xy
y (y)
x
0
( y)
1
0
m0
m1
m2
m3
( x)
1
(x)
Example:
̅
𝑭 = 𝒙𝒚 + 𝒙𝒚
 The Karnaugh map for this function will be:
Note: we can easily from the k-map see which
(y)
y (y)
1
0
minterms contain common literal:
x
̅
 Minterms on the left and right sides contain 𝒚
0
0
0
and 𝒚 respectively.
( x)
F = xy + xy
1
(x)
1
1
̅ and 𝒙 respectively.
 Minterms in the top and bottom rows contain 𝒙
(y)
y
0
x
𝑥̅ 𝑦̅
xy
( x) 0
( x)
x 𝑦̅
xy
1
𝑥̅ y
( y)
1
xy
x y xy
Note: each case in the
truth table
corresponds to a
square in the K-map
 Karnaugh map simplification:
 The K-map squares labeled so that horizontally adjacent square differ only in one
variable.
Example 1:- Imagine a two-variable sum of minterms, both of these minterms
appear in the top row of a karnaugh map, which means that they both contain
̅.
the literal 𝒙
y (y)
0
x
(y)
1
xy xy
0
( x)
xy
1
(x)


F  x y  xy  x y  y  x
xy
̅ 𝒚 + 𝒙𝒚 –minimize it using K-map.
Example 2: 𝒇 = 𝒙
Solution:
 Both minterms appear in the right- side where 𝒚 is uncomplemented.
̅ 𝒚 + 𝒙𝒚 = just to 𝒚.
 Thus, we can reduce 𝒙
y
x
0
( y)
0
( y)
1
0
1
0
1
( x)
1
( x)
F  y
̅ 𝒚 + 𝒙𝒚 = 𝒚(𝒙 + 𝒙
̅) = 𝒚
𝒇= 𝒙
̅𝒚
̅ + 𝒙
̅ 𝒚 + 𝒙𝒚 –minimize it using K-map.
Example 3: 𝒛 = 𝒙
Solution:
x
0
( y)
1
0
1
1
0
1
y (y)
x
( x)
1
(x)
y
̅ ̅𝒚 + 𝒙
̅𝒚 in the top row,

We have 𝒙
̅
corresponding to 𝒙
̅ 𝒚 + 𝒙𝒚 in the right side

There's also 𝒙
corresponding to 𝒚.
̅ + 𝒚.

The result 𝒛 = 𝒙
Using algebraic simplification:
̅𝒚
̅ + 𝒙
̅ 𝒚 + 𝒙𝒚 = 𝒙
̅ (𝒚
̅ + 𝒚) + 𝒙𝒚
𝒛= 𝒙
̅ + 𝒙𝒚 = (𝒙 + 𝒙
̅) (𝒙
̅ + 𝒚) = 𝒙
̅+𝒚
=𝒙
 Three- variables K-map
 For 𝑭(𝑨, 𝑩, 𝑪) there are 𝟐𝟑 = 𝟖 minterms.
 Representation truth table using K-map
o Different versions:
B
B
BC
A
A
BC
00
1
BC
BC
01
2
11
3
C
Or
10
4
0 A B C A BC
ABC AB C
5
6
A 1 A B C A BC
7
8
ABC AB C
C
BC
BC
00
BC
01
11
10
0
m0
m1
m3
m2
A 1
m4
m5
m7
m6
BC
C
BC
A
A
BC
Grouping (ordering, looping)
 The groups can be 2, 4, or 8 adjacent squares:
 2 squares
1 variable can be canceled.
 4 squares
2 variables can be canceled.
 8 squares
3 variables can be canceled.
 Examples:-
Common
Literal (s)
Squares
̅𝑩
̅
𝑨
̅𝑪
𝑨
(1) and (2)
(2) and (3)
(1) and (4)
(1), (2), (5) and (6)
(3), (4), (7) and (8)
(1), (2), (3) and (4)
(5), (6), (7) and (8)
(1), (5), (4) and (8)
̅
̅𝑪
𝑨
̅
𝑩
𝑩
̅
𝑨
𝑨
̅
𝑪
(Wrapping case is also adjacent)
 To proof the wrapping case (the last one in the table) algebraically, we can write:
̅ + 𝑨𝑩
̅ + 𝑨
̅ + 𝑨𝑩𝑪
̅
̅𝑩
̅𝑪
̅𝑪
̅𝑩𝑪
𝑭= 𝑨
̅ (𝑨
̅𝑩
̅ + 𝑨𝑩
̅ +𝑨
̅ 𝑩 + 𝑨𝑩)
= 𝑪
̅ (𝑩
̅ (𝑨
̅ + 𝑨) + 𝑩 (𝑨
̅ + 𝑨))
= 𝑪
̅ (𝑩
̅
̅ + 𝑩) = 𝑪
=𝑪
 "Adjacency" includes wrapping around the left and right side.
BC
A
.
BC
00
BC
BC
BC
01
11
10
A 0
m0
m1
m3
m2
A 1
m4
m5
m7
m6
wrapping adjacency (group)
Example 1: Simplify the following logical function using K-map.
̅𝒛+ 𝒙𝒛
𝑭 (𝒙, 𝒚, 𝒛) = 𝒙 𝒚 + 𝒚
Solution:
Step 1: the expression must be in a sum of minterms form, so we should convert it:(two
ways to do that):
1. Using logical rules (algebraically).
̅𝒛 + 𝒙𝒛
𝑭= 𝒙𝒚 + 𝒚
̅ 𝒛(𝒙 + 𝒙
̅) + 𝒙 𝒛 (𝒚 + 𝒚
̅)
= 𝒙 𝒛 (𝒛 + 𝒛̅) + 𝒚
̅𝒛 +𝒙
̅ 𝒚
̅ 𝒛+ 𝒙𝒚𝒛 + 𝒙𝒚
̅𝒛
= 𝒙 𝒚 𝒛 + 𝒙 𝒚 𝒛̅ + 𝒙 𝒚
̅𝒛 +𝒙
̅ 𝒚
̅ 𝒛
= 𝒙 𝒚 𝒛 + 𝒙 𝒚 𝒛̅ + 𝒙 𝒚
= 𝒎𝟏 + 𝒎𝟓 + 𝒎𝟔 + 𝒎𝟕
2. Make the truth table and read the minterms.
̅𝒛 + 𝒙𝒛
𝑭= 𝒙𝒚 +𝒚
Output
inputs
𝒙
0
0
0
0
1
1
1
1
𝑦
0
0
1
1
0
0
1
1
𝑧
0
1
0
1
0
1
0
1
Terms
replacement
𝑭(𝒙, 𝒚, 𝒛)
0
1
0
0
0
1
1
1
̅𝒚
̅𝒛 + 𝒙 𝒚
̅ 𝒛 + 𝒙 𝒚 𝒛̅ + 𝒙 𝒚 𝒛
𝑭(𝒙, 𝒚, 𝒛) = 𝒙
= 𝒎𝟏 + 𝒎𝟓 + 𝒎𝟔 + 𝒎𝟕
̅𝒛
𝒚
̅𝒛
𝒙𝒛 and 𝒚
𝒙𝒚
𝒙𝒚 and 𝒙𝒛
Step 2: fill one's (for the minterms) in karnaugh map; zero's for other squares.
yz
00
01
10
x
11
0
0
1
0
0
1
0
1
1
1
yz
Step 3: grouping (looping):
2 groups:
Step 4: simplify:
̅𝒛
𝑭= 𝒙𝒚 + 𝒚
 To proof the result:
xy
(m1) and (m5)
(m6) and (m7)
̅𝒚
̅𝒛 + 𝒙𝒚
̅𝒛 + 𝒙𝒚𝒛 + 𝒙𝒚𝒛̅
𝑭=𝒙
̅𝒛(𝒙 + ̅
=𝒚
𝒙) + 𝒙𝒚(𝒛 + 𝒛̅)
̅𝒛 + 𝒙𝒚
=𝒚
Grouping the minterms: Grouping together all the 𝟏𝒔 in the K-map.
o Make rectangles of 2n (1, 2, 4, …).
o All the 𝟏𝒔 in the map should be included in at least one rectangle.
o Do not include any of the 𝟎𝒔 .
o Each group corresponds to one product term.
o Make each rectangle as large as possible.
o We can overlap the rectangles, if that makes them lager.
Example 2: Simplify the following logical function using K-map.
̅+𝑨
̅
̅𝑪
̅𝑩
̅𝑪
𝒁 = 𝑨𝑩 + 𝑨𝑩
Solution:
̅+𝑨
̅ = 𝑨𝑩𝑪
̅ + 𝑨𝑩𝑪 + 𝑨𝑩
̅+𝑨
̅
̅𝑪
̅𝑩
̅𝑪
̅𝑪
̅𝑩
̅𝑪
𝒁 = 𝑨𝑩 + 𝑨𝑩
BC
BC
00
BC
01
11
10
A 0
1
0
0
0
A 1
1
0
1
1
BC
A
BC
F  B C  AB
Note : Ignore !!
Example 3: Simplify the following logical function using K-map.
̅ + 𝑨𝑩
̅ + 𝑨𝑩𝑪
̅𝑩
̅ 𝑪 + 𝑨𝑩
̅𝑪
̅ 𝑪 + 𝑨𝑩𝑪
𝒁=𝑨
Solution:
BC
A
BC
00
BC
BC
BC
01
11
10
A 0
0
1
0
0
1 Couple
A 1
1
1
1
1
1 Quad
Z  A  BC
Quad:
̅ + 𝑨𝑩𝑪
̅ + 𝑨𝑩𝑪 = 𝑨(𝑩
̅ + 𝑩𝑪
̅ + 𝑩𝑪)
̅ 𝑪 + 𝑨𝑩
̅𝑪
̅𝑪 + 𝑩
̅𝑪
𝑨𝑩
̅ ) + 𝑩(𝑪
̅ + 𝑪)) = 𝑨(𝑩
̅ (𝑪 + 𝑪
̅ + 𝑩) = 𝑨
= 𝑨(𝑩
Couple:
̅𝑩
̅ 𝑪 + 𝑨𝑩
̅𝑪 = 𝑩
̅ 𝑪(𝑨 + 𝑨) = 𝑩
̅𝑪
𝑨
Download