karnaugh maps ellen spertus mcs 111 september 2, 2003

20
Karnaugh Maps Ellen Spertus MCS 111 September 2, 2003

Upload: shana-clarke

Post on 17-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Karnaugh Maps Ellen Spertus MCS 111 September 2, 2003

Karnaugh Maps

Ellen Spertus

MCS 111

September 2, 2003

Page 2: Karnaugh Maps Ellen Spertus MCS 111 September 2, 2003

2

Big Picture

• Any number can be represented as 0s and 1s• Functions can be represented as a table• Any table of 0s and 1s can be interpreted as

a truth table• Any truth table can be converted into a

boolean function• We can implement boolean functions with

switches

Page 3: Karnaugh Maps Ellen Spertus MCS 111 September 2, 2003

3

Homework 1

A B C f(A,B,C) 0 0 0 1 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 1 1 0 1 0 1 1 0 0 1 1 1 0

A

B

C

Page 4: Karnaugh Maps Ellen Spertus MCS 111 September 2, 2003

4

Sum of products form

A B C f(A,B,C) 0 0 0 1 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 1 1 0 1 0 1 1 0 0 1 1 1 0

• Product refers to and (·)

• Sum refers to or (+)

Page 5: Karnaugh Maps Ellen Spertus MCS 111 September 2, 2003

5

Practice

A B C f(A,B,C) 0 0 0 1 0 0 1 0 0 1 0 1 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1

Page 6: Karnaugh Maps Ellen Spertus MCS 111 September 2, 2003

6

Homework 3: Nand is universal

• “Universal” means that you can build any boolean function out of it

• You must be able to construct– and– or– not

• All you need is nand gates!

f1(A)A

A

Bf2(A,B)

f3(A,B)

A

B

Page 7: Karnaugh Maps Ellen Spertus MCS 111 September 2, 2003

7

Optimizing formulas

• Why is it better to have simpler formulas?

• What makes one function simpler than another?

• Given a truth table, is there a way to automatically generate the simplest possible function?

Page 8: Karnaugh Maps Ellen Spertus MCS 111 September 2, 2003

8

Building a Karnaugh map

A B C f 0 0 0 1 0 0 1 0 0 1 0 1 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1

C

AB

0

1

00

01

11

10

Page 9: Karnaugh Maps Ellen Spertus MCS 111 September 2, 2003

9

Using a Karnaugh map

• Circle each horizontal/vertical region of 1s.

• Convert each term into a boolean product (i.e., and the variables or their negations together).

• Build a sum of the products (i.e., or the products together).

Page 10: Karnaugh Maps Ellen Spertus MCS 111 September 2, 2003

10

Practice

A B C f 0 0 0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 0 1 1 0 1 1 1 1 1

C

AB

0

1

00

01

11

10

Page 11: Karnaugh Maps Ellen Spertus MCS 111 September 2, 2003

11

Rules for Karnaugh maps• Label each axis with a gray code, i.e., only

change one bit at a time.• Regions can stretch horizontally or vertically.• Each side of a region must be a power of 2

(e.g., 1, 2, or 4).• For simplest formula, choose ________region

and make use of “don’t care”s.• Regions may wrap around the edges.• Practice with 4-input Karnaugh map…

Page 12: Karnaugh Maps Ellen Spertus MCS 111 September 2, 2003

12

Putting it together• Definitions:

– An integer greater than 1 is prime if it has no divisors besides 1 and itself.

– An integer greater than 1 is composite if it is not prime.

• Let’s design a circuit that will tell whether its 3-digit binary input is composite or prime

• Result should be 0 for composite, 1 for prime.

Page 13: Karnaugh Maps Ellen Spertus MCS 111 September 2, 2003

13

Big Picture

• Any number can be represented as 0s and 1s.

• Any table of 0s and 1s can be interpreted as a truth table.

• We can implement boolean functions with switches.

Any truth table can be converted into a boolean function.

Page 14: Karnaugh Maps Ellen Spertus MCS 111 September 2, 2003

14

4-variable Karnaugh mapA B C D f 0 0 0 0 1 0 0 0 1 1 0 0 1 0 0 0 0 1 1 0 0 1 0 0 1 0 1 0 1 0 0 1 1 0 1 0 1 1 1 1 1 0 0 0 0 1 0 0 1 0 1 0 1 0 0 1 0 1 1 1 1 1 0 0 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 0

AB

00

01

11

10C D

0 0

0 1

1 1

1 0

Page 15: Karnaugh Maps Ellen Spertus MCS 111 September 2, 2003

15

n n prime? A B C f

0

1

2

3

4

5

6

7

Page 16: Karnaugh Maps Ellen Spertus MCS 111 September 2, 2003

16

Karnaugh map for primes

Page 17: Karnaugh Maps Ellen Spertus MCS 111 September 2, 2003

17

Lab 1

• Get familiar with your lab kit and logic gates

• Build a full adder

• Make use of a 4-bit adder

• The voice of experience says:– Read the directions carefully– Draw your wiring diagram

properly

Page 18: Karnaugh Maps Ellen Spertus MCS 111 September 2, 2003

18

Wiring diagrams 1/2

• The drawing is neat, with straight horizontal and vertical (not diagonal) lines. (Use rulers and templates.)

• Chips are drawn not as rectangles but in shapes that suggest their function.

• Chips are labeled with their part number (e.g., LS283).

• Signal names (e.g., A3) appear inside the chip, pin numbers outside.

Page 19: Karnaugh Maps Ellen Spertus MCS 111 September 2, 2003

19

Wiring diagrams 2/2

• The connections of the upper-right pin to power and the lower-left pin to ground are not shown.

• Inputs and outputs are clearly labeled and grouped together.

• If colors are used, they should be used logically and consistently.

Page 20: Karnaugh Maps Ellen Spertus MCS 111 September 2, 2003

20

LS283

B3 B2 B1 B0A3 A2 A1 A0

Cout Cin

3 2 1 0

14 12 3 5 11 15 2 6

79

10 13 1 4

L3 L2 L1 L0

S3 S2 S1 S0 S7 S6 S5 S4inputs

outputs