Docsity

Karnaugh Map - Logic Design - Notes | CS 120A, Study notes of Computer Science

Toggle sidebar
bg1
Section 4.1 - Karnaugh Map Page 1 of 7
4.1 Karnaugh Map
The Karnaugh map method is a simple, straightforward procedure for minimizing the number of operations in
standard-form expressions.
The Boolean n-cubes provide the basis for these maps.
Each vertex in each n-cube represents a minterm of an n-variable Boolean function.
Each Boolean function could be represented visually in the form of an n-cube by marking those vertices in which the
value of that function is a 1, i.e. the 1-minterms.
Ex., for the carry and sum functions:
cixiyici+1 si
0000 0
0010 1
0100 1
0111 0
1000 1
1011 0
1101 0
1111 1
To find the standard form of a function that contains the minimal number of operators, we use the concept of a
Boolean subcube.
In general, an m-subcube of an n-cube can be defined as that set of 2m vertices in which n - m of the variables will
have the same value at every vertex, while the remaining m variables will take
on the 2m possible combinations of the values 0 and 1.
For example, in the 3-cube:
The 2-subcube is defined as that set of 2m = 22 = 4 vertices in which n - m = 3 - 2
= 1 of the variable will have the same value at every vertex (0xx, or 1xx)
while the remaining variables will take on the 2m = 22 = 4 possible
combinations (x00, x01, x10, and x11).
The 1-subcube is defined as that set of 2m = 21 = 2 vertices in which n - m = 3 - 1
= 2 of the variables will have the same value at every vertex (00x, 01x, 10x,
or 11x) while the remaining variable will take on the 2m = 21 = 2 possible
combinations (xx0, and xx1).
Each subcube can be characterized by the n - m variable values that are the same for every vertex in the subcube.
If a Boolean function has a value of 1 in each vertex of the m-subcube, the 2m 1-minterms in that subcube could be
expressed by a single term of n - m literals.
For example, in the carry function ci+1, the two 1-minterms (011, and 111) form a 1-subcube which could be
expressed by the single term of n - m = 3-1 = 2 literals xy.
• To minimize the number of OR operators, we have to choose as few subcubes as possible while still covering
all its 1-minterms.
• To minimize the number of AND operators, we have to choose the largest possible subcubes.
We can determine and select the subcubes visually from a cube representation, or we could derive them from the
two-dimensional form of this cube which is called a Karnaugh map, or map for short.
There is a one-to-one correspondence between Boolean cubes and Karnaugh maps. Karnaugh maps are just two-
dimensional representation of Boolean cubes.
The map is an array of squares. Each square corresponds to one vertex of the cube, i.e. one minterm of the Boolean
function.
000 001
010 011
100 101
110 111
si = c'x'y + c'xy' + cx'y' + cxy
000 001
010 011
100 101
110 111
xy
cx
cy
ci+1 = c'xy + cx'y + cxy' + cxy
= xy + cy + cx
000 001
010 011
100 101
110 111
pf3
pf4
pf5

Partial preview of the text

Download Karnaugh Map - Logic Design - Notes | CS 120A and more Study notes Computer Science in PDF only on Docsity!

4.1 Karnaugh Map

The Karnaugh map method is a simple, straightforward procedure for minimizing the number of operations in standard-form expressions. The Boolean n -cubes provide the basis for these maps. Each vertex in each n -cube represents a minterm of an n -variable Boolean function. Each Boolean function could be represented visually in the form of an n -cube by marking those vertices in which the value of that function is a 1, i.e. the 1-minterms. Ex., for the carry and sum functions:

c (^) i x (^) i y (^) i c (^) i +1 si 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1

To find the standard form of a function that contains the minimal number of operators, we use the concept of a Boolean subcube.

In general, an m -subcube of an n -cube can be defined as that set of 2 m^ vertices in which n - m of the variables will have the same value at every vertex, while the remaining m variables will take on the 2 m^ possible combinations of the values 0 and 1. For example, in the 3-cube: The 2-subcube is defined as that set of 2 m^ = 2 2 = 4 vertices in which n - m = 3 - 2 = 1 of the variable will have the same value at every vertex (0xx, or 1xx) while the remaining variables will take on the 2 m^ = 2 2 = 4 possible combinations (x00, x01, x10, and x11). The 1-subcube is defined as that set of 2 m^ = 2 1 = 2 vertices in which n - m = 3 - 1 = 2 of the variables will have the same value at every vertex (00 x , 01x, 10 x , or 11x) while the remaining variable will take on the 2 m^ = 2 1 = 2 possible combinations (xx0, and xx1). Each subcube can be characterized by the n - m variable values that are the same for every vertex in the subcube. If a Boolean function has a value of 1 in each vertex of the m -subcube, the 2 m^ 1-minterms in that subcube could be expressed by a single term of n - m literals. For example, in the carry function c (^) i +1, the two 1-minterms (011, and 111) form a 1-subcube which could be expressed by the single term of n - m = 3-1 = 2 literals xy.

  • To minimize the number of OR operators, we have to choose as few subcubes as possible while still covering all its 1-minterms.
  • To minimize the number of AND operators, we have to choose the largest possible subcubes.

We can determine and select the subcubes visually from a cube representation, or we could derive them from the two-dimensional form of this cube which is called a Karnaugh map , or map for short. There is a one-to-one correspondence between Boolean cubes and Karnaugh maps. Karnaugh maps are just two- dimensional representation of Boolean cubes.

The map is an array of squares. Each square corresponds to one vertex of the cube, i.e. one minterm of the Boolean function.

0 0 0 0 0 1

0 1 0 0 1 1

1 0 0 1 0 1

1 1 0 1 1 1

si = c ' x ' y + c ' xy ' + cx ' y ' + cxy

0 0 0 0 0 1

0 1 0 0 1 1

1 0 0 1 0 1

1 1 0 1 1 1 x y

c x

c y

c (^) i +1 = c ' xy + cx ' y + cxy ' + cxy = xy + cy + cx

0 0 0 0 0 1

0 1 0 0 1 1

1 0 0 1 0 1

1 1 0 1 1 1

A two-variable map consists of 4 squares which correspond to the 4 minterms of a two-variable Boolean function. The largest subcube in a two- variable map is a 1-cube, which represents a single variable or its complement.

A three-variable map consists of 8 squares. The largest subcubes are of size 2. These 2-subcubes can be expressed by a single literal. The 1-subcubes can be expressed by two literals.

A four-variable map consists of 16 squares.

If the minterm is a 1-minterm, a 1 will be placed inside its square, otherwise, it is left empty. Example, for the carry and sum functions:

1

x'y' x ' y

x y ' x y

0

0

1

xy 0 1

2 3

0 1

0

1

xy 0 1

2 3

s u b c u b e x ' s u b c u b e y ' s u b c u b e y s u b c u b e x

m i n t e r mn u m b e r s

0 0 0 1

0

1

x 0 1

4 5

1 1 1 0 3 2

7 6

y z z z' x

t h r e e - v a r i a b l e m a p E x a m p l e s o f 2 - s u b c u b e s E x a m p l e s o f 1 - s u b c u b e s

0 0 0 1

0

1

x 0 1

4 5

1 1 1 0 3 2

7 6

y z x'z y z y'z' xy'

y z 0 1

x'y'z' x'y'z

xy'z' x y ' z

0 0

0

1

x 0 1

4 5

1 1 1 0

x ' y z x'yz'

x y z x y z '

3 2

7 6

z z'

w

f o u r - v a r i a b l e m a p E x a m p l e s o f 3 - s u b c u b e s E x a m p l e s o f 2 a n d 1 - s u b c u b e s

w x ' y'z'

w x y z

y z (^) 0 1

w'x' y'z'

w'x' y'z w ' x y'z'

w ' x y'z

0 0

0 0

0 1

w x 0 1

4 5

1 1 1 0

w'x' y z

w'x' yz' w ' x y z

w ' x yz'

3 2

7 6

w x y'z'

w x y'z w x ' y'z

8 9

w x yz' w x ' y z

w x ' yz'

1 0

1 1

1 0

1 1

1 2 1 3 1 5 1 4

y z (^) 0 0 0 1

0 0

0 1

w x 0 1

4 5

1 1 1 0 3 2

7 6

8 9 1 0

1 1

1 0

1 1

1 2 1 3 1 5 1 4

y z (^) 0 0 0 1

0 0

0 1

w x 0 1

4 5

1 1 1 0 3 2

7 6

8 9 1 0

1 1

1 0

1 1

1 2 1 3 1 5 1 4

w ' z w'yz'

xy'z'

x'y'

x y 0 1

1

1

0 0

0

1

c 0 1

4 5

1 1 1 0

1

1

3 2

7 6

si =^ c ' x ' y +^ c ' xy ' +^ cx ' y ' +^ cxy

x y 0 1

1

0 0

0

1

c 0 1

4 5

1 1 1 0

1

1 1

3 2

7 6

c (^) i +1 = xy + cy + cx

Example: Using the map method, simplify the Boolean function F = w ' x ' yz ' + w ' xy + wxz + wx ' y ' + w ' x ' y ' z '.

PI list: w ' x ' z ', w ' xy , wxz , wx ' y ', and x ' y ' z ', wy ' z , xyz , w ' yz '.

EPI list: empty

Cover lists: (1) w ' x ' z ', w ' xy , wxz , wx ' y '. (2) x ' y ' z ', wy ' z , xyz , w ' yz '.

The two simplified equivalent functional expressions are: (1) F = w ' x ' z ' + w ' xy + wxz + wx ' y '. (2) F = x ' y ' z ' + wy ' z + xyz + w ' yz '.

However, bad if we had selected the two PIs w ' x ' z ' and xyz , because now we would need 5 PIs to cover all the 1- minterms. e.g. w ' x ' z ', xyz , w ' xy , wxz , and wx ' y '.

4.3 Don't-Care Conditions

Previously, we have considered only those Boolean functions that are completely specified. There are situations where the outputs are not specified for some input combinations, i.e. we do not specify whether the output is a 0 or a 1 for an input combination. Such a Boolean function is called an incompletely specified function , and the minterms for which the function is not specified are called don't-care minterms ( d-minterms ) or don't-care conditions. We can use d-minterms to further simplify the Boolean expression because we can assign either a 0 or a 1 to them in a way that will make our subcubes larger. Example: Convert BCD to nine's complements:

Input Output Decimal x 3 x 2 x 1 x 0 Decimal y 3 y 2 y 1 y 0 0 0000 9 1001 1 0001 8 1000 2 0010 7 0111 3 0011 6 0110 4 0100 5 0101 5 0101 4 0100 6 0110 3 0011 7 0111 2 0010 8 1000 1 0001 9 1001 0 0000 10 - 15 don't care 10 - 15 don't care

1

1

y z (^) 0 1

1

0 0

0 0

0 1

w x 0 1

4 5

1 1 1 0

1

1 1

3 2

7 6

1

1

8 9 1 0

1 1

1 0

1 1

1 2 1 3 1 5 1 4

w'x'z'

w ' x y

wx'y'

w x z

x'y'z' w y ' z x y z w'yz'

X

x 1 x 0 (^) 0 1

1 1

0 0

0 0

0 1

x 3 x 2 0 1

4 5

1 1 1 0

1 1

3 2

7 6

X X 8 9

X

X X

1 0

1 1

1 0

1 1

1 2 1 3 1 5 1 4

y 2 = x 2 x 1' + x 2 ' x 1 = x 2 ⊕ x 1

X

x 1 x 0 (^) 0 1

1 1

0 0

0 0

0 1

x 3 x 2 0 1

4 5

1 1 1 0 3 2

7 6

X X 8 9

X

X X

1 0

1 1

1 0

1 1

1 2 1 3 1 5 1 4

y 3 = x 3' x 2 ' x 1 '

X

x 1 x 0 (^) 0 0 0 1

0 0

0 1

x 3 x 2 0 1

4 5

1 1 1 0

1 1

1 1

3 2

7 6

X X 8 9

X

X X

1 0

1 1

1 0

1 1

1 2 1 3 1 5 1 4

y 1 = x 1

1

X

x 1 x 0 (^) 0 1

1

1

0 0

0 0

0 1

x 3 x 2 0 1

4 5

1 1 1 0

1

1

3 2

7 6

X X 8 9

X

X X

1 0

1 1

1 0

1 1

1 2 1 3 1 5 1 4

y 0 = x 0'

4.4 Tabulation Method

Previously, finding subcubes in a map is essentially a trial-and-error procedure because it requires a person to recognize subcube patterns in a map. Gets more difficult with more variables. The tabulation method is an algorithmic exhaustive search method to find the subcubes in a map. Quite tedious for human but good for computers.

Example: Find the prime implicants for the Boolean function F = w ' y ' z ' + wz + xyz + w ' y.

From figure 4.13, we see that there are ten 1-minterms.

Step (1): Generate a list of 0-subcubes.

Group the 1-minterms such that each group G (^) i contains those minterms whose 1's count (number of variables whose values are equal to 1) is equal to i. Thus, in G 0 the minterms have no 1's. In G 1, the minterms have one 1's. In G 2 , the minterms have two 1's. etc.

The "yes" and "no" flag indicates whether or not that subcube is covered by a larger subcube. The flag will be set to "yes" or "no" after we have generated the list of next-larger subcubes.

Step (2): Generate a list of 1-subcubes.

In the list of 0-subcubes, compare each of the minterms in group G (^) i with each of the minterms in group G (^) i +1 and generate a 1-subcube for group G (^) i in the list of 1-subcubes if these minterms differ in one variable.

Note that "-" is not an indication of the value of a variable but is rather a placeholder for a variable that has already been eliminated from the expression.

Step (3): Generate a list of 2-subcubes.

In the list of 1-subcubes, compare each of the minterms in group G (^) i with each of the minterms in group G (^) i +1 and generate a 2-subcube for group G (^) i in the list of 2-subcubes if these minterms differ in one variable.

Step (4): Repeat until all the subcube covered are "no". From the subcube values of all the "no" rows, the prime implicants are: w ' z ', w ' y , yz , wz.

Group Subcube Value ID

Subcube Minterms (^) w x y z

Subcube Covered G 0 m 0 0 0 0 0 yes G 1 m 2 0 0 1 0 yes m 4 0 1 0 0 yes G 2 m 3 0 0 1 1 yes m 6 0 1 1 0 yes m 9 1 0 0 1 yes G 3 m 7 0 1 1 1 yes m 11 1 0 1 1 yes m 13 1 1 0 1 yes G 4 m 15 1 1 1 1 yes List of 0-subcubes

Group Subcube Value ID

Subcube Minterms (^) w x y z

Subcube Covered G 0 m 0, m 2 0 0 - 0 yes m 0, m 4 0 - 0 0 yes G 1 m 2, m 3 0 0 1 - yes m 2, m 6 0 - 1 0 yes m 4, m 6 0 1 - 0 yes G 2 m 3, m 7 0 - 1 1 yes m 3, m 11 - 0 1 1 yes m 6, m 7 0 1 1 - yes m 9, m 11 1 0 - 1 yes m 9, m 13 1 - 0 1 yes G 3 m 7, m 15 - 1 1 1 yes m 11, m 15 1 - 1 1 yes m 13, m 15 1 1 - 1 yes List of 1-subcubes

Group Subcube Value ID

Subcube Minterms w x y z

Subcube Covered G 0 m 0, m 2 m 4, m 6 0 - - 0 no G 1 m 2, m 3 m 6, m 7 0 - 1 - no G 2 m 3, m 7 m 11, m 15 - - 1 1 no m 9, m 11 m 13, m 15 1 - - 1 no List of 2-subcubes

Example: Find the minimal cover for the function with the 1-minterms 2, 6, 7, 8, 9, 13, 15.

Function Minterms

Prime Implicant Name

Prime Implicant Expression

Implicant Minterms 2 6 7 8 9 13 15 P 1 w'yz' (2, 6) (^) ⊗ × P 2 wx ' y ' (8, 9) (^) ⊗ × P 3 w'xy (6, 7) (^) × × P 4 wy'z (9, 13) (^) × × P 5 xyz (7, 15) (^) × × P 6 wxz (13,15) (^) × × EPI covered minterms: 2 6 8 9 Not covered minterms: 7 13 15

Three minterms left uncovered: m 7, m 13, m 15. m 7 can be covered by P 3 or P (^) 5. m 13 can be covered by P 4 or P 6. m 15 can be covered by P 5 or P 6. This can be expressed in terms of the following product of sums of these PIs: (P 3 + P (^) 5)(P 4 + P 6 )(P 5 + P (^) 6)

Multiplying the second and third sums produces the following expression: (P 3 + P (^) 5)(P 4 P 5 + P 5 P 6 + P (^) 4P 6 + P 6 )

Since P 6 covers the same minterms as do P (^) 5P 6 (because the set of minterms covered by P (^) 5P 6 is a subset of the set of minterms covered by P (^) 6) and P 5 P 6 has fewer PIs, we can remove P (^) 5P 6 from the expression. Similarly, we can remove P 4 P 6. This reduces the cover expression to (P 3 + P (^) 5)(P 4 P 5 + P (^) 6)

Multiplying out this expressions yields P (^) 3P 4 P 5 + P (^) 4P 5 + P 3 P 6 + P (^) 5P (^6)

Again we can remove P (^) 3P (^) 4P 5 because it is a subset of P (^) 4P (^) 5. Thus the final expression is P (^) 4P 5 + P 3 P 6 + P (^) 5P (^6)

Finally, by combining these three options with the EPIs, we get the three different minimal covers: F = P 1 + P 2 + P 4 + P 5 = w'yz' + wx ' y ' + wy'z + xyz. F = P 1 + P 2 + P 3 + P 6 = w'yz' + wx ' y ' + w'xy + wxz. F = P 1 + P 2 + P 5 + P 6 = w'yz' + wx ' y ' + xyz + wxz.

Group Subcube Value ID

Subcube Minterms (^) w x y z

Subcube Covered G 1 m 2 0 0 1 0 yes m 8 1 0 0 0 yes G 2 m 6 0 1 1 0 yes m 9 1 0 0 1 yes G 3 m 7 0 1 1 1 yes m 13 1 1 0 1 yes G 4 m 15 1 1 1 1 yes List of 0-subcubes

Group Subcube Value ID

Subcube Minterms (^) w x y z

Subcube Covered G 1 m 2, m 6 0 - 1 0 no m 8, m 9 1 0 0 - no G 2 m 6, m 7 0 1 1 - no m 9, m 13 1 - 0 1 no G 3 m 7, m 15 - 1 1 1 no m 13, m 15 1 1 - 1 no List of 1-subcubes