Combinational Logic Part 2: Karnaugh maps (quick).

34
Combinational Logic Part 2: Karnaugh maps (quick)

Transcript of Combinational Logic Part 2: Karnaugh maps (quick).

Page 1: Combinational Logic Part 2: Karnaugh maps (quick).

Combinational LogicPart 2:

Karnaugh maps (quick)

Page 2: Combinational Logic Part 2: Karnaugh maps (quick).

Sum of Minterms Implementation

• OR all of the minterms of truth table for which the functionvalue is 1

F = m0 + m2 + m5 + m7

F = X’Y’Z’ + X’YZ’+XY’Z + XYZ

2

Page 3: Combinational Logic Part 2: Karnaugh maps (quick).

Sum of Products Implementation

• Simplifying sum-of-minterms can yield a sum of products

• Difference is that each term need not have all variables

• Resulting gates • ANDs and one OR

F = Y’ + X’YZ’ + XY

3

Page 4: Combinational Logic Part 2: Karnaugh maps (quick).

Two-Level Implementation

• Sum of products has 2 levels of gates

Fig 2-6

4

Page 5: Combinational Logic Part 2: Karnaugh maps (quick).

More Levels of Gates?

• What’s best?♦ Hard to answer♦ More gate delays (more on this later)♦ But maybe we only have 2-input gates

5

Page 6: Combinational Logic Part 2: Karnaugh maps (quick).

Product of Maxterms Implementation

• Can express F as AND of Maxterms for all rows that should evaluate to 0

6431 MMMMF

))(( ZYXZYXF ))(( ZYXZYX

or

This makes one Maxterm fail each time F should be 0

6

Page 7: Combinational Logic Part 2: Karnaugh maps (quick).

Product of Sums Implementation

• ORs followed by AND

))(( ZYXZYXF

7

Page 8: Combinational Logic Part 2: Karnaugh maps (quick).

Karnaugh Map

• Graphical depiction of truth table

• A box for each minterm♦ So 2 variables, 4 boxes♦ 3 variable, 8 boxes♦ And so on

• Useful for simplification♦ by inspection♦ Algebraic manipulation harder

8

Page 9: Combinational Logic Part 2: Karnaugh maps (quick).

K-Map from Truth TableExamples

• There are implied 0s in empty boxes

9

Page 10: Combinational Logic Part 2: Karnaugh maps (quick).

Function from K-Map

• Can generate function from K-map

XYF XYYXYXF Simplifies to X + Y (in a moment)

10

Page 11: Combinational Logic Part 2: Karnaugh maps (quick).

In Practice:

• Karnaugh maps were mildly useful when people did simplification

• Computers now do it!• We’ll cover Karnaugh maps as a

way for you to gain insight, ♦ not as real tool

11

Page 12: Combinational Logic Part 2: Karnaugh maps (quick).

Three-Variable Map

• Eight minterms• Look at encoding of columns

and rows

12

Page 13: Combinational Logic Part 2: Karnaugh maps (quick).

Simplification

• Adjacent squares (horizontally or vertically) are minterms that vary by single variable

• Draw rectangles on map to simplify function

• Illustration next

13

Page 14: Combinational Logic Part 2: Karnaugh maps (quick).

Example

instead ofYXYXF

ZYXZYXZYXZYXF 14

Page 15: Combinational Logic Part 2: Karnaugh maps (quick).

Adjacency is cylindrical

• Note that wraps from left edge to right edge.

Z

15

Page 16: Combinational Logic Part 2: Karnaugh maps (quick).

Covering 4 Squares

is

ZXYZYXZYXZYXF ZXZXF ZF

16

Page 17: Combinational Logic Part 2: Karnaugh maps (quick).

Another Example

• Help me solve this one

17

Page 18: Combinational Logic Part 2: Karnaugh maps (quick).

In General

• One box -> 3 literals• Rectangle of 2 boxes -> 2

literals• Rectangle of 4 boxes -> 1 literal• Rectangle of 8 boxes -> Logic 1

(on 3-variable map)♦ Covers all minterms

18

Page 19: Combinational Logic Part 2: Karnaugh maps (quick).

Slight Variation

• Overlap is OK.

• No need to use full m5-- waste of input

19

Page 20: Combinational Logic Part 2: Karnaugh maps (quick).

4-variable map

• At limit of K-map

20

Page 21: Combinational Logic Part 2: Karnaugh maps (quick).

Also Wraps (toroidal topology)

21

Page 22: Combinational Logic Part 2: Karnaugh maps (quick).

Systematic Simplification

A Prime Implicant is a product term obtained by combining the maximum possible number of adjacent squares in the map into a rectangle with the number of squares a power of 2.

A prime implicant is called an Essential Prime Implicant if it is the only prime implicant that covers (includes) one or more minterms.

Prime Implicants and Essential Prime Implicants can be determined by inspection of a K-Map.

A set of prime implicants "covers all minterms" if, for each minterm of the function, at least one prime implicant in the set of prime implicants includes the minterm.

Chapter 2 - Part 2 22

Page 23: Combinational Logic Part 2: Karnaugh maps (quick).

DB

CB

1 1

1 1

1 1

B

D

A

1 1

1 1

1

Example of Prime Implicants

Find ALL Prime ImplicantsB’D’ and BD are ESSENTIAL Prime Implicants

C

BD

CD

BD

Minterms covered by single prime implicant

DB

1 1

1 1

1 1

B

C

D

A

1 1

1 1

1

AD

BA

Chapter 2 - Part 2 23

Page 24: Combinational Logic Part 2: Karnaugh maps (quick).

Prime Implicant Practice

Find all prime implicants for:13,14,15),10,11,12,(0,2,3,8,9 D)C,B,F(A, m

Chapter 2 - Part 2 24

cpe
Page 25: Combinational Logic Part 2: Karnaugh maps (quick).

Prime Implicant Practice

Find all prime implicants for:13,14,15),10,11,12,(0,2,3,8,9 D)C,B,F(A, m

1 1

1 1

1 1

B

D

A1 1

1

C

1 1

ACB

DB

Chapter 2 - Part 2 25

Page 26: Combinational Logic Part 2: Karnaugh maps (quick).

Algorithm to Find An Optimal Expression for A Function

Find all prime implicants. Include all essential prime implicants in the

solution Select a minimum cost set of non-essential

prime implicants to cover all minterms not yet covered.

The solution consists of all essential prime and the selected minimum cost set of non-essential prime implicants

minimum cost

selected minimum cost

Chapter 2 - Part 2 26

Page 27: Combinational Logic Part 2: Karnaugh maps (quick).

The Selection Rule

Obtaining a good simplified solution: Use the Selection Rule

Chapter 2 - Part 2 27

Page 28: Combinational Logic Part 2: Karnaugh maps (quick).

Prime Implicant Selection Rule

Minimize the overlap among prime implicants as much as possible.

In the solution, make sure that each prime implicant selected includes at least one minterm not included in any other prime implicant selected.

Chapter 2 - Part 2 28

Page 29: Combinational Logic Part 2: Karnaugh maps (quick).

Selection Rule Example

Simplify F(A, B, C, D) given on the K-map.

1

1

1

1 1

1

1

B

D

A

C

1

1

1

1

1

1 1

1

1

B

D

A

C

1

1

Essential

Minterms covered by essential prime implicants

Selected

Chapter 2 - Part 2 29

Page 30: Combinational Logic Part 2: Karnaugh maps (quick).

Don’t Care

• So far have dealt with functions that were always either 0 or 1

• Sometimes we have some conditions where we don’t care what result is

• Example: dealing with BCD♦ Only care about first 10

30

Page 31: Combinational Logic Part 2: Karnaugh maps (quick).

Mark With an X

• In a K-map, mark don’t care with X

• Simpler implementations• Can select an X either as 1 or 0

31

Page 32: Combinational Logic Part 2: Karnaugh maps (quick).

Example

or

What would we have if Xs were 0? 32

Page 33: Combinational Logic Part 2: Karnaugh maps (quick).

Selection Rule Example with Don't Cares

Simplify F(A, B, C, D) given on the K-map. Selected

Minterms covered by essential prime implicants

1

1

x

x

x x

x

1

B

D

A

C

1

1 1

1

x

x

x x

x

1

B

D

A

C

1

1

Essential

Chapter 2 - Part 2 33

Page 34: Combinational Logic Part 2: Karnaugh maps (quick).

Product of Sums Example

Find the optimum POS solution:

• Hint: Use and complement it to get the result.

,13,14,15)(3,9,11,12 D)C,B,F(A, m (1,4,6) d

F

34