CS 140 Lecture 3

advertisement

CSE20 Lecture 15

Karnaugh Maps

Professor CK Cheng

CSE Dept.

UC San Diego

1

Example

Given F =

S m (3, 5), D =

S m (0, 4) c b

0 2 6 4

0 0 -

1 3 7 5

0 1 0 1 a

Primes:

S m (3),

S m (4, 5)

Essential Primes:

S m (3),

S m (4, 5)

Min exp: f(a,b,c) = a’bc + ab’

2

Boolean Expression K-Map

Variable x i and its compliment x i

 Two half planes Rx i

, and Rx i

Product term P

(

P x i

* e.g. b’c’)

Intersect of Rx i

* for all i in P e.g. Rb’ intersect Rc’

Each minterm 

One element cell

Two minterms are adjacent iff they differ by one and only one variable, eg: abc’d, abc’d’

The two cells are neighbors

Each minterm has n adjacent minterms

Each cell has n neighbors

3

Procedure Input: Two sets of F R D

1) Draw K-map.

2) Expand all terms in F to their largest sizes (prime implicants).

3) Choose the essential prime implicants.

4) Try all combinations to find the minimal sum of products. (This is the most difficult step)

4

Example

Given F =

S m (0, 1, 2, 8, 14)

D =

S m (9, 10)

1. Draw K-map b

0 4 12 8

1 0 0 1

1 5 13 9

1 0 0 -

3 7 15 11

0 0 0 0 c

2 6 14 10

1 0 1 a d

5

2. Prime Implicants: Largest rectangles that intersect On Set but not Off Set that correspond to product terms.

S m (0, 1, 8, 9),

S m (0, 2, 8, 10),

S m (10, 14)

3. Essential Primes: Prime implicants covering elements in F that are not covered by any other primes.

S m (0, 1, 8, 9),

S m (0, 2, 8, 10),

S m (10, 14)

4. Min exp:

S m (0, 1, 8, 9) +

S m (0, 2, 8, 10) +

S m (10, 14) f(a,b,c,d) = b’c’ + b’d’+ acd’

6

Another example

Given F =

S m (0, 3, 4, 14, 15)

D =

S m (1, 11, 13)

1. Draw K-map b

0 4 12 8

1 1 0 0

1 5 13 9

0 0

3 7 15 11

1 0 1 c

2 6 14 10

0 0 1 0 a d

7

2. Prime Implicants: Largest rectangles that intersect On Set but not Off Set that correspond to product terms.

E.g.

S m (0, 4),

S m (0, 1),

S m (1, 3),

S m (3, 11),

S m (14, 15),

S m (11, 15),

S m (13, 15)

3. Essential Primes: Prime implicants covering elements in F that are not covered by any other primes.

E.g.

S m (0, 4),

S m (14, 15)

4. Min exp:

S m (0, 4),

S m (14, 15), (

S m (3, 11) or

S m (1,3) ) f(a,b,c,d) = a’c’d’+ abc+ b’cd (or a’b’d)

8

d c

0 4 12 8

1 5 13 9

3 7 15 11

2 6 14 10

Five variable K-map e d c

16 20 28 24

17 21 29 25

19 23 31 27

18 22 30 26 b b a e

Neighbors of m

5

Neighbors of m

10 are: minterms 1, 4, 7, 13, and 21 are: minterms 2, 8, 11, 14, and 26

9

e d

0 4 12 8

Six variable K-map d

16 20 28 24

1 5 13 9

3 7 15 11

2 6 14 10 f e

17 21 29 25

19 23 31 27

18 22 30 26 e c d

32 36 44 40

33 37 45 41

35 39 47 43

34 38 46 42 f e c d

48 52 60 56

49 53 61 57

51 55 63 59

50 54 62 58 c c b f f a

10

Implicant : A product term that has non-empty intersection with on-set F and does not intersect with off-set R .

Prime Implicant : An implicant that is not covered by any other implicant .

Essential Prime Implicant : A prime implicant that has an element in on-set F but this element is not covered by any other prime implicants .

Implicate : A sum term that has non-empty intersection with off-set

R and does not intersect with on-set F.

Prime Implicate : An implicate that is not covered by any other implicate.

Essential Prime Implicate : A prime implicate that has an element in off-set R but this element is not covered by any other prime implicates .

11

Min product of sums

Given F =

S m (3, 5), D =

S m (0, 4) c b

0 2 6 4

0 0 -

1 3 7 5

0 1 0 1 a

Prime Implicates:

P

M (0,1),

P

M (0,2,4,6),

P

M (6,7)

Essential Primes Implicates:

P

M (0,1),

P

M (0,2,4,6),

P

M (6,7)

Min exp: f(a,b,c) = (a+b)(c )(a’+b’)

12

a b a’ b’ c

Corresponding Circuit f(a,b,c,d)

13

Quiz

Given F =

S m (0, 6), D =

S m (2, 7),

1. Fill the Karnaugh map.

2. Identify all prime implicates

3. Identify all essential primes.

4. Find a minimal expression in product of sums format.

14

Another min product of sums example

Given R =

S m (3, 11, 12, 13, 14)

D =

S m (4, 8, 10)

K-map c b

0 4 12 8

1 0 -

1 5 13 9

1 1 0 1

3 7 15 11

0 1 1 0

2 6 14 10

1 1 0 a d

15

Prime Implicates:

P

M (3,11),

P

M (12,13),

P

M(10,11),

P

M (4,12),

P

M (8,10,12,14)

Essential Primes:

P

M (8,10,12,14),

P

M (3,11),

P

M(12,13)

Exercise: Derive f(a,b,c,d) in minimal product of sums expression.

16

Summary

Karnaugh Maps: Two dimensional truth table which mimics an n-variable cube with imaginary adjacency.

Theme: Relation between Boolean algebra and Karnaugh maps.

Key words: Primes, Essential Primes

Goal: Minimal expression in the format of sum-of-products or product-of-sums.

17

Download