Title: Lecture 4 Hamming Code,
1CS147
Lecture 4 Hamming Code, Circuit Minimization and
Karnaugh Maps
Prof. Sin-Min Lee Department of Computer Science
2(No Transcript)
3(No Transcript)
4(No Transcript)
5(No Transcript)
6(No Transcript)
7(No Transcript)
8(No Transcript)
9(No Transcript)
10(No Transcript)
11(No Transcript)
12(No Transcript)
13(No Transcript)
14(No Transcript)
15(No Transcript)
16(No Transcript)
17Since functions can be represented by a sum of
product form of minterms, any function can be
shown in the map by placing each a 1 in each
square which represents a minterm in the
function. EXAMPLE Draw the map for f X
Y 1. Determine which minterms are needed by
using truth table. X Y f X Y
minterm 0 0 0 m0 0 1 1 m1 1 0
1 m2 1 1 1 m3
182. Draw the map and place a 1 in each square for
required minterms.
Y
Y
X
1
0
X
1
f X Y m1 m2 m3 X Y X Y X Y
19Use the 2-Variable Karnaugh Map for Minimization
Example Given f (X,Y) ? (0, 2) Find
Simplified sum of products
Y
Y
X
m1
m0
m2
m3
X
202-Variable Karnaugh Map
1. Place the 1s corresponding to the minterms
on the map.
f (X,Y) ? (0, 2)
Y
Y
X
0
1
1
0
X
212-Variable Karnaugh Map
2. Now group the 1s into columns or rows in
this case we can group them in the first column.
f (X,Y) ? (0, 2)
Y
Y
X
0
1
1
0
X
3. This column is Y so the simplified function
f (X,Y) Y
222-Variable Karnaugh Map
Example 2 Given f (X,Y) ? (0, 2, 3) Find
Simplified sum of products
Y
Y
X
m1
m0
m2
m3
X
232-Variable Karnaugh Map
Example 3 Given f (X,Y) ? (0, 1) Find
Simplified sum of products
Y
Y
X
m1
m0
m2
m3
X
24Three Variable Map
m0 m1 m3 m2 m4 m5 m7 m6
Y
YZ
X
0 0 0 1 1 1
10
X Y Z X Y Z X Y Z X YZ
0
X Y Z XYZ X Y Z X Y Z
1
X
Z
25Three Variable Map
There are 2N 23 8 squares. The minterms are
arranged so that only one variable changes from
0 to 1 or from 1 to 0 as you move from square to
square in the vertical or horizontal direction.
For any two adjacent squares, only one literal
changes from complemented to non-complemented
(normal). From this property the left and right
ends of the map are adjacent.
26Y
YZ
X
0 0 0 1 1 1
10
XYZ X Y Z X Y Z X Y Z
0
1
X
X YZ X Y Z X Y Z X YZ
Z
Using the distributive and complement properties,
any two adjacent minterms can be combined and
simplified to a single term with one less
literal.
27 Combining terms on the Karnaugh Map simplifies
Boolean functions.
Example combine adjacent squares for X Y Z and
XYZ XY Z XYZ Y Z ( X X) Y Z 1
Y Z
Example Combine adjacent squares for X YZ and
X YZ XYZ X YZ X Z ( Y Y) X Z
1 X Z
Y
YZ
X
0 0 0 1 1 1
10
XYZ X Y Z X Y Z X Y Z
0
1
X
X YZ X Y Z X Y Z X YZ
Z
28Example Simplify f XY Z X Y Z XY Z
X Y Z
Y
YZ
0 0 0 1 1 1
10
X
1
1
1
0
1
1
X
Z
f XY Y Z
29Even if the function is not in its simplest form,
we can still use the map to simplify it
further. Example Simplify f X Y Y Z
X Z X Y Z
Y
YZ
0 0 0 1 1 1
10
X
1
1
1
0
1
1
1
X
Z
f Z X Y (by further grouping of minterms)
303-Variable Karnaugh Map
Example Given f (X,Y,Z) ? (0, 2, 3, 4,
7) Find Simplified sum of products
Y
YZ
X
m2
m3
m1
m0
m6
m5
m7
m4
X
Z
313-Variable Karnaugh Map
Example Given f (X,Y,Z) ? (0, 2, 3, 4,
7) Simplified sum of products f YZ YZ
XY
Y
YZ
X
1
1
0
1
0
0
1
1
X
Z
32Truth Table
f (X,Y,Z) ? (0, 2, 3, 4, 7) Simplified sum of
products f YZ YZ XY
The truth table for f
X Y Z f
0 0 0 1 0 0 1
0 0 1 0 1 0 1
1 1 1 0 0 1 1
0 1 0 1 1 0
0 1 1 1 1
33f (X,Y,Z) ? (0, 2, 3, 4, 7) YZ YZ XY
Y
Z
f
Y
Z
X
Y
343-Variable Karnaugh Map
Example 2 Given f (X,Y,Z) ? (2, 3, 4,
5) Find Simplified sum of products
Y
YZ
X
m2
m3
m1
m0
m6
m5
m7
m4
X
Z
353-Variable Karnaugh Map
Example 2 Given f (X,Y,Z) ? (1, 2, 5, 6,
7) Find Simplified sum of products
Y
YZ
X
m2
m3
m1
m0
m6
m5
m7
m4
X
Z
363-Variable Karnaugh Map
Example 3 Given f (X,Y,Z) XZ XY XYZ
YZ Find Sum of minterms expression
Y
YZ
X
m2
m3
m1
m0
m6
m5
m7
m4
X
Z
37Exclusive OR XOR
X Y f 0 0 0 0 1
1 1 0 1 1 1 0
38Exclusive OR
f (X,Y) ? (1, 2) X ? Y
Y
Y
X
1
0
0
1
X
39 XOR Truth Table
f (X,Y,Z) X ? Y ? Z ? (1, 2, 4, 7)
The truth table for f
X Y Z f
0 0 0 0 0 0 1
1 0 1 0 1 0 1
1 0 1 0 0 1 1
0 1 0 1 1 0
0 1 1 1 1
40Exclusive OR
X
Y
f (X,Y,Z) X ? Y ? Z
Z
41Four Variable Map
Y
YZ
0 0 0 1 1 1 10
WX
m0 m1 m3 m2 m4 m5 m7 m6
00
01
m12 m13 m15 m14 m8 m9
m11 m10
X
11
w x yz
W
10
Z
42Four Variable Map
N 4 variables 2N 24 16 square (minterms)
Row and column are numbered using a
reflected-code sequence. The minterm number can
be obtained by concatenation of the row and
column number . Example Row 4 10, Column 2
01 giving 1001 9 decimal for W X Y Z.
43 Y
YZ
0 0 0 1 1 1 10
wxyz
wxy z
00
01
X
11
W
10
Z
Notice that top and bottom edges and right and
left edges are adjacent.
441 square a term with 4 literals 2 square a
term with 3 literal 4 square a term with 2
literals 8 square a term with 1 literal 16
square a function equal to 1
Y
YZ
0 0 0 1 1 1 10
WX
00
01
X
11
W
10
Z
45Simplify f (W, X, Y, Z) W X Z W X Z W Y
Z f W Z Y Z f Z ( W Y)
Y
YZ
0 0 0 1 1 1 10
WX
00
01
X
11
W
10
Z
46Simplify f (W, X, Y, Z) ? ( 0, 1, 4, 5, 6, 8,
9, 12, 13, 14) f Y WZ XZ
Y
YZ
0 0 0 1 1 1 10
WX
00
01
X
11
W
10
Z
8 square 4 square
4 square
47 Simplify f W X Y XY Z W X Y Z W
X Y f X Z X Y
W Y Z
Y
YZ
0 0 0 1 1 1 10
WX
00
01
X
11
10
Z
48Simplification of kmap
- Generate all PIs
- Find EPIs
- If EPIs can cover all minterms, then it is
answer. Otherwise choose some non-essential PIs
(which has less cost) such that all minterms are
cover.
49Step 1
- Generate PIs
- Blue circle are PIs
- They are the largest circle you can drawn on kmap
50Step 2
- Find EPIs
- Red circle are EPIs
- Minterm 5, 14, 11 can only be cover by these 3
red circle
51Step 3
- EPIs cannot cover minterm 7
- Choose between green/blue circle to cover minterm
7 - Green is chosen as it is larger
- Less cost
52Final
- Final result is obtained
- x3x4 x2x3 x1x3 x2x3x4
53Complement and Product of Sums
On the K Map a 1 was placed in the squares which
represented minterms for a function. The squares
not used represent the complement of the
function. Mark these squares with 0, combine
them and read the complement as a sum of
products function, f. Using De Morgans Law on
f will give f, the original Function. It will be
in a product of sums form. Example Determine
the Product of sums form for f ( W, X, Y, Z) ?
(0, 1, 2, 5, 8, 9, 10) f W X YZ X Z
from the map f (W X) ( Y Z) ( X Z)
by De Morgans
54Complement and Product of Sums
Also, can determine the product of sums form
directly from The map by recognizing that the 0s
on the map represent maxterms. Remember that a 1
on the edge of the map Represents a complemented
literal for maxterms. Thus, for f ( W, X, Y, Z)
? (0, 1, 2, 5, 8, 9, 10).
(combine 0s on k-map) f ( Y Z) (W X)
( X Z)
55Y
YZ
0 0 0 1 1 1 10
WX
1 1 0 1
00
0 1 0 0
01
11
0 0 0 0
W
10
1 1 0 1
Z
f ( Y Z ) ( W X ) ( X Z)