Karnaugh maps

90
Karnaugh Maps -- A tool for representing Boolean functions

description

Karnaugh maps SOP POS HAZARDS

Transcript of Karnaugh maps

Page 1: Karnaugh maps

Karnaugh Maps

-- A tool for representing

Boolean functions

Page 2: Karnaugh maps

We can come close to our aim by using a graphical notation named Karnaugh Map that

will be defined in next slides

Page 3: Karnaugh maps

Karnaugh Map Technique

• A K-Map is simply a folded truth table, where physical adjacency implies logical adjacency

• K-Maps are most commonly used hand method for logic minimization.

• K-Maps are a graphical technique used to simplify a logic equation.

• K-Maps are procedural and much cleaner than Boolean simplification.

• K-Maps can be used for any number of input variables, BUT are only practical for two, three, and four variables.

3

Page 4: Karnaugh maps

Terminology

•Implicant : Product term that implies function

•Prime Implicant : An Implicant that is not completely covered by any other Implicant but itself

•Essential prime Implicant : A prime Implicant that has a minter not covered by any other prime Implicant

•Product term : An and expression

4

Terms

Page 5: Karnaugh maps

Terminology

• Minterm : We define a Minterm to be a product that contains all variables of that particular switching function in either complemented or non-complemented form

• Maxterm : We define a Maxterm to be a sum that contains all variables of that particular switching function in either complemented or non-complemented form

• Standard SOP(Sum Of Products) : In standard SOP, the products are obtained directly from the Karnaugh map or truth table, so the SOP contains all of the variables of the function

• Standard POS(Product Of Sums) : In standard POS, the products are obtained directly from the Karnaugh map or truth table, so the POS contains all of the variables of the function

5

Terms

Page 6: Karnaugh maps

6

minterm

ID A B f(A,B) minterm

0 0 0 0

1 0 1 1 A’B

2 1 0 1 AB’

3 1 1 1 AB

An example of 2-variable function f(A,B)=A+B

Page 7: Karnaugh maps

Simplification Goals

• Goal -- minimize the cost of realizing a switching function

• Cost measures and other considerations

– Number of gates

– Number of levels

– Interconnection complexity

– Preventing hazards

• Two-level realizations

– Minimize the number of gates (terms in switching function)

Page 8: Karnaugh maps

Minimization of Boolean expressions

• The minimization will result in reduction of the number of gates (resulting from less number of terms) and the number of inputs per gate (resulting from less number of variables per term)

• The minimization will reduce cost, efficiency and power consumption.

• y(x+x`)=y.1=y

• y+xx`=y+0=y

• (x`y+xy`)=xy

• (x`y`+xy)=(xy)`

Page 9: Karnaugh maps

Karnaugh Maps

• Boolean algebra helps us simplify expressions and circuits

• Karnaugh Map: A graphical technique for simplifying a Boolean expression into either form:

– sum of products (SOP)

– product of sums (POS)

• Goal of the simplification.

– There are a minimal number of product/sum terms

– Each term has a minimal number of literals

• Circuit-wise, this leads to a minimal two-level implementation

Page 10: Karnaugh maps

Minimum SOP

• f= (xyz +x`yz+ xy`z+ …..)

Is called sum of products.

The + is sum operator which is an OR gate.The product such as xy is an AND gate for the two inputs x and y.

Page 11: Karnaugh maps

Examples

• Two variable K-map f(A,B)=m(0,1,3)=A`B`+A`B+AB

1 0

1 1

A 0 1B 0 1

Page 12: Karnaugh maps

V

0 0

0 0

B

A

A

Groups of One – 4

Two Variable K-Map Groupings

B A

1

BA

1 1

A B

BA

1

B

12

Page 13: Karnaugh maps

V

0 0

0 0

B

A

A

Groups of Two – 4

Two Variable K-Map Groupings

B

A

1 1

A

1 1

1

B

1

1

B

1

13

Page 14: Karnaugh maps

V

1 1

1 1

B

A

A

Group of Four – 1

Two Variable K-Map Groupings

1

B

14

Page 15: Karnaugh maps

Three Variable K-Map Groupings

V

0 0

0 0

0 0

0 0

C C

B A

B A

BA

BA

B A

1 1

B A

1 1

B A

1 1

B A

1 1

1

C A

1

1

C A

1

1

C A

1

1

C B

1

1

C B

1

1

C A

11

C B

1

1

C B

1

Groups of One – 8 (not shown)Groups of Two – 12

15

Page 16: Karnaugh maps

Groups of Four – 6

Three Variable K-Map Groupings

V

0 0

0 0

0 0

0 0

C C

B A

B A

BA

BA

1

C

1

1

1

1

C

1

1

1

A

1 1

1 1

B

1 1

1 1

A

1 1

1 1

B

1 1

1 1

16

Page 17: Karnaugh maps

Group of Eight - 1

Three Variable K-Map Groupings

V

1 1

1 1

1 1

1 1

C C

B A

B A

BA

BA

1

17

Page 18: Karnaugh maps

Three variable map

• f(A,B,C) = m(0,3,5)= A`B`C`+A`BC+AB`C

1

1

A`BC

1

AB`C

A`B`0 0

A`B0 1

A B1 1

A B`1 0

C`0

C1

A`B`C`

Page 19: Karnaugh maps

19

minterm

ID A B f(A,B) minterm

0 0 0 0

1 0 1 1 A’B

2 1 0 1 AB’

3 1 1 1 AB

An example of 2-variable function f(A,B)=A+B

Page 20: Karnaugh maps

20

Function can be represented by sum of minterms:f(A,B) = A’B+AB’+AB

This is not minimal however! We want to minimize the number of literals and terms.We factor out common terms –

A’B+AB’+AB= A’B+AB’+AB+AB=(A’+A)B+A(B’+B)=B+A

Hence, we havef(A,B) = A+B

Page 21: Karnaugh maps

21

K-Map: Truth Table in 2 Dimensions

A = 0 A = 1

B = 0

B = 1

0 2

1 3

0 1

1 1

A’B

AB’

AB

f(A,B) = A + B

Page 22: Karnaugh maps

22

ID A B f(A,B) minterm

0 0 0 0

1 0 1 1 A’B

2 1 0 0

3 1 1 1 AB

Another Example f(A,B)=B

f(A,B)=A’B+AB=(A’+A)B=B

Page 23: Karnaugh maps

23

On the K-map:

A = 0 A= 1

B= 0

B = 1

0 2

1 3

0 0

1 1

A’B AB

f(A,B)=B

Page 24: Karnaugh maps

24

ID A B f(A,B) Maxterm

0 0 0 0 A+B

1 0 1 1

2 1 0 0 A’+B

3 1 1 1

Using Maxterms

f(A,B)=(A+B)(A’+B)=(AA’)+B=0+B=B

Page 25: Karnaugh maps

Maxterm example

f(A,B,C) = M(1,2,4,6,7)=(A+B+C`)(A+B`+C)(A`+B+C) )(A`+B`+C) (A`+B`+C`)Note that the complements are (0,3,5) which are the minterms of the previous example

0 0 0

0 0

A`B` A`B AB AB`

C`

C

(A+B) (A+B`) (A`+B`) (A`+B)

C

C`

Page 26: Karnaugh maps

Re-arranging the Truth Table

• A two-variable function has four possible minterms. We can re-arrangethese minterms into a Karnaugh map

• Now we can easily see which minterms contain common literals

– Minterms on the left and right sides contain y’ and y respectively

– Minterms in the top and bottom rows contain x’ and x respectively

x y minterm

0 0 x’y’

0 1 x’y

1 0 xy’

1 1 xy

Y

0 1

0 x’y’ x’yX

1 xy’ xy

Y

0 1

0 x’y’ x’yX

1 xy’ xy

Y’ Y

X’ x’y’ x’y

X xy’ xy

Page 27: Karnaugh maps

Karnaugh Map Simplifications

• Imagine a two-variable sum of minterms:

x’y’ + x’y

• Both of these minterms appear in the top row of a Karnaugh map, which

means that they both contain the literal x’

• What happens if you simplify this expression using Boolean algebra?x’y’ + x’y = x’(y’ + y) [ Distributive ]= x’ 1 [ y + y’ = 1 ]= x’ [ x 1 = x ]

Y

x’y’ x’y

X xy’ xy

Page 28: Karnaugh maps

More Two-Variable Examples

• Another example expression is x’y + xy

– Both minterms appear in the right side, where y is uncomplemented

– Thus, we can reduce x’y + xy to just y

• How about x’y’ + x’y + xy?

– We have x’y’ + x’y in the top row, corresponding to x’

– There’s also x’y + xy in the right side, corresponding to y

– This whole expression can be reduced to x’ + y

Y

x’y’ x’y

X xy’ xy

Y

x’y’ x’y

X xy’ xy

Page 29: Karnaugh maps

A Three-Variable Karnaugh Map

• For a three-variable expression with inputs x, y, z, the arrangement ofminterms is more tricky:

YZ00 01 11 10

0 x’y’z’ x’y’z x’yz x’yz’X

1 xy’z’ xy’z xyz xyz’

YZ00 01 11 10

0 m0 m1 m3 m2X1 m4 m5 m7 m6

Page 30: Karnaugh maps

Terminology ( cont. )

30

0 0 0 1

1 1 0 1

0 01 11 10

0

1

Karnaugh Map

1 3 2

4 5 7 6

0

ABC

Page 31: Karnaugh maps

Figure K-map illustrating implicants

1

C

A B

0 0 0 1 1 1 1 00 2 6 4

3 7 5

0

1

B

1 1

1 1 1

A

C

Minterms: {AB C, A BC, A BC, ABC, ABC}

Groups of two minterms: {A B, AB, A C, BC, BC}

Groups of four minterms: {B}

Prime implicants: {A C, B}Cover = {A C, B}

MSOP = A C + B

Page 32: Karnaugh maps

Generating and Selecting Prime Implicants

1. Count the number of adjacencies for each minterm on the K-map.

2. Select an uncovered minterm with the fewest number of adjacencies. Make an arbitrary choice if more than one choice is possible.

3. Generate a prime implicant for this minterm and put it in the cover. If this minterm is covered by more than one prime implicant, select the one that covers the most uncovered minterms.

4. Repeat steps 2 and 3 until all minterms have been covered.

Page 33: Karnaugh maps

Generating and Selecting Prime Implicants (Revisited)

1. Circle all prime implicants on the K-map.

2. Identify and select all essential prime implicants for the cover.

3. Select a minimum subset of the remaining prime implicants to complete the cover, that is, to cover those minterms not covered by the essential prime implicants.

Page 34: Karnaugh maps

Example

f(a,b,c,d) = m(3,7,11,12,13,14,15)

=a`b`cd + a`bcd + ab`cd + abc`d`+ abc`d + abcd` + abcd =cd(a`b` + a`b + ab`) + ab(c`d` + c`d + cd` + cd )=cd(a`[b` + b] + ab`) + ab(c`[d` + d] + c[d` + d])=cd(a`[1] + ab`) + ab(c`[1] + c[1])=ab+ab`cd + a`cd =ab+cd(ab` + a`)=ab+ cd(a + a`)(a`+b`)= ab + a`cd + b`cd = ab +cd(a` + b`)

Page 35: Karnaugh maps

f(A,B,C,D) = m(1,2,3,6) = AC + BC

1

C

A B

0 0 0 1 1 1 1 00 2 6 4

3 7 5

0

1

B

1 1

1 1

A

C

Page 36: Karnaugh maps

Proper ordering ?

• With this ordering, any group of 2, 4 or 8 adjacent squares on the map contains common literals that can be factored out

• “Adjacency” includes wrapping around the left and right sides:

• We’ll use this property of adjacent squares to do our simplifications.

x’y’z + x’yz= x’z(y’ + y)= x’z 1= x’z

x’y’z’ + xy’z’ + x’yz’ + xyz’= z’(x’y’ + xy’ + x’y + xy)= z’(y’(x’ + x) + y(x’ + x))= z’(y’+y)= z’

Y

x’y’z’ x’y’z x’yz x’yz’

X xy’z’ xy’z xyz xyz’

Z

Y

x’y’z’ x’y’z x’yz x’yz’

X xy’z’ xy’z xyz xyz’

Z

Page 37: Karnaugh maps

Three-Variable K-Maps

C B(0,4)f BA (4,5)f B(0,1,4,5)f A(0,1,2,3)f

BC00

0

01

1

11 10A

1 0 0 0

1 0 0 0

BC00

0

01

1

11 10A

0 0 0 0

1 1 0 0

BC00

0

01

1

11 10A

1 1 1 1

0 0 0 0

BC00

0

01

1

11 10A

1 1 0 0

1 1 0 0

C A(0,4)f CA (4,6)f C A(0,2)f C(0,2,4,6)f

BC00

0

01

1

11 10A

0 1 1 0

0 0 0 0

BC00

0

01

1

11 10A

0 0 0 0

1 0 0 1

BC00

0

01

1

11 10A

1 0 0 1

1 0 0 1

BC00

0

01

1

11 10A

1 0 0 1

0 0 0 0

Page 38: Karnaugh maps

Four Variable K-Map Groupings

V

0 0 0 0

0 0 0 0

0 0 0 0

0 0 0 0

B A

B A

BA

BA

D C D C D C D C

Groups of One – 16 (not shown)Groups of Two – 32 (not shown)Groups of Four – 24 (seven shown)

C B

1 1

1 1

D B

1 1

1 1D A

1

1

1

1

C B

1 1

1 1

D B1

1

1

1D A

1

1

1

1 D B11

11

38

Page 39: Karnaugh maps

Four Variable K-Map Groupings

V

0 0 0 0

0 0 0 0

0 0 0 0

0 0 0 0

B A

B A

BA

BA

D C D C D C D C

Groups of Eight – 8 (two shown)

B

1 1 1 1

1 1 1 1

D1

1

1

1

1

1

1

1

39

Page 40: Karnaugh maps

Four Variable K-Map Groupings

V

1 1 1 1

1 1 1 1

1 1 1 1

1 1 1 1

B A

B A

BA

BA

D C D C D C D C

Group of Sixteen – 1

140

Page 41: Karnaugh maps

Four-Variable K-Maps

DCB(0,8)f DCB(5,13)f DBA(13,15)f DBA(4,6)f

CA(2,3,6,7)f DB)(4,6,12,14f CB)(2,3,10,11f DB(0,2,8,10)f

CD00

00

01

01

11

11

10

10

AB1 0 0 0

0 0 0 0

0 0 0 0

1 0 0 0

CD00

00

01

01

11

11

10

10

AB0 0 0 0

0 1 0 0

0 1 0 0

0 0 0 0

CD00

00

01

01

11

11

10

10

AB0 0 0 0

0 0 0 0

0 1 1 0

0 0 0 0

CD00

00

01

01

11

11

10

10

AB0 0 0 0

1 0 0 1

0 0 0 0

0 0 0 0

CD00

00

01

01

11

11

10

10

AB0 0 1 1

0 0 1 1

0 0 0 0

0 0 0 0

CD00

00

01

01

11

11

10

10

AB0 0 0 0

1 0 0 1

1 0 0 1

0 0 0 0

CD00

00

01

01

11

11

10

10

AB0 0 1 1

0 0 0 0

0 0 0 0

0 0 1 1

CD00

00

01

01

11

11

10

10

AB1 0 0 1

0 0 0 0

0 0 0 0

1 0 0 1

Page 42: Karnaugh maps

Four-Variable K-Maps

CD00

00

01

01

11

11

10

10

AB0 0 0 0

1 1 1 1

0 0 0 0

0 0 0 0

CD00

00

01

01

11

11

10

10

AB0 0 1 0

0 0 1 0

0 0 1 0

0 0 1 0

CD00

00

01

01

11

11

10

10

AB1 0 1 0

0 1 0 1

1 0 1 0

0 1 0 1

CD00

00

01

01

11

11

10

10

AB0 1 0 1

1 0 1 0

0 1 0 1

1 0 1 0

CD00

00

01

01

11

11

10

10

AB0 1 1 0

0 1 1 0

0 1 1 0

0 1 1 0

CD00

00

01

01

11

11

10

10

AB1 0 0 1

1 0 0 1

1 0 0 1

1 0 0 1

CD00

00

01

01

11

11

10

10

AB0 0 0 0

1 1 1 1

1 1 1 1

0 0 0 0

CD00

00

01

01

11

11

10

10

AB1 1 1 1

0 0 0 0

0 0 0 0

1 1 1 1

f (4,5,6,7) A B f (3,7,11,15) C D f (0,3,5,6,9,10,12,15) f (1,2,4,7,8,11,13,14)

f A B C D f A B C D

f (1,3,5,7,9,11,13,15) f (0,2,4,6,8,10,12,14) f (4,5,6,7,12,13,14,15) f (0,1,2,3,8,9,10,11)f D f D f B f B

Page 43: Karnaugh maps

• 4 Variable Maps

– f(A,B,C,D) = m(0,1,2,3,6,8,9,11,13,14)

– f = A C' D + B C D' + B' C ' + B' D + A'B'

C D A B

00 01 11 10

00 1 1 1 1

01 0 0 0 1

11 0 1 0 1

10 1 1 1 0

Page 44: Karnaugh maps

• Another 4 Variable Map

– f(A,B,C,D) = m(0,1,2,5,6,7,8,9,10,13,15)

– f = B D + A' B C + B' D' + B' C' or

– f = B D + A' B C + B' D' + C' D (there are 2 more)

C D A B

00 01 11 10

00 1 1 0 1

01 0 1 1 1

11 0 1 1 0

10 1 1 0 1

These are not essential!

Page 45: Karnaugh maps

For the Simplest Result

• Make as few rectangles as possible, to minimize the number of products in the final expression.

• Make each rectangle as large as possible, to minimize the number of literals in each term.

• Rectangles can be overlapped, if that makes them larger.

Page 46: Karnaugh maps

K-map Simplification @ SoP Expressions

• Let’s consider simplifying f(x,y,z) = xy + y’z + xz

• You should convert the expression into a sum of minterms form,

– The easiest way to do this is to make a truth table for the function, and then read off the minterms

– You can either write out the literals or use the minterm shorthand

• Here is the truth table and sum of minterms for our example:

x y z f (x,y,z)

0 0 0 00 0 1 10 1 0 00 1 1 0

1 0 0 01 0 1 11 1 0 11 1 1 1

f(x,y,z) = x’y’z + xy’z + xyz’ + xyz

= m1 + m5 + m6 + m7

Page 47: Karnaugh maps

Unsimplifying Expressions

• You can also convert the expression to a sum of minterms with Boolean algebra

– Apply the distributive law in reverse to add in missing variables.

– Very few people actually do this, but it’s occasionally useful.

• In both cases, we’re actually “unsimplifying” our example expression

– The resulting expression is larger than the original one!

– But having all the individual minterms makes it easy to combine them together with the K-map

xy + y’z + xz = (xy 1) + (y’z 1) + (xz 1)= (xy (z’ + z)) + (y’z (x’ + x)) + (xz (y’ + y))= (xyz’ + xyz) + (x’y’z + xy’z) + (xy’z + xyz)= xyz’ + xyz + x’y’z + xy’z= m1 + m5 + m6 + m7

Page 48: Karnaugh maps

Minimum product of sums (POS)

• The minimum product of sums (POS) of a function, f, is a POS representation of f that contains the fewest number of sum terms and the fewest number of literals of any POS representation of f.

• The zeros are considered exactly the same as ones in the case of sum of product (SOP)

Page 49: Karnaugh maps

Example

f(a,b,c,d) = M(0,1,2,4,5,6,8,9,10)

=m(3,7,11,12,13,14,15)

= [(a+b+c+d)(a+b+c+d`)(a+b`+c`+d`)

(a`+b+c`+d`)(a`+b`+c+ d)(a`+b`+c+ d`) (a`+b`+c`+d)(a`+b`+c`+d`)]

Page 50: Karnaugh maps

PoS Optimization

• Maxterms are grouped to find minimal PoS expression

x +y+z x+y+z’ x+y’+z’

x+y’+z

x’ +y+z

x’+y+z’

x’+y’+z’

x’+y’+z

00 01 11 10

0

1x

yz

Page 51: Karnaugh maps

PoS Optimization

• F(W,X,Y,Z)= ∏ M(0,1,2,4,5)

x +y+z

x+y+z’

x+y’+z’

x+y’+z

x’ +y+z

x’+y+z’

x’+y’+z’

x’+y’+z

00 01 11 10

0

1x

yz

0 0 1 0

0 0 1 1

00 01 11 10

0

1x

yz

F(W,X,Y,Z)= Y . (X + Z)

Page 52: Karnaugh maps

Terminology ( cont. )• Sometimes writing an expression in a POS form is easier as seen in the following example:

0 1 1 0

1 1 1 1

00 01 11 10

0

1

Karnaugh Map

1 3 2

5 7 64

0

ABC

52

Page 53: Karnaugh maps

• POS Minimization

– K-maps can be used for POS minimization, too

– f(A,B,C) = m(2,3,6)

• Minimum POS is f = (B)(A' + C') cost = 2 + 4 = 6

• Minimum SOP is f = A'B + BC' cost = 3 + 6 = 9

B C A

00 01 11 10

0 0 0 1 1

1 0 0 0 1

Page 54: Karnaugh maps

I don’t care!

• You don’t always need all 2n input combinations in an n-variable function

– If you can guarantee that certain input combinations never occur– If some outputs aren’t used in the rest of the circuit

• We mark don’t-care outputs in truth tables and K-maps with Xs.

• Within a K-map, each X can be considered as either 0 or 1. You should pickthe interpretation that allows for the most simplification.

x y z f (x,y,z)

0 0 0 00 0 1 10 1 0 X0 1 1 0

1 0 0 01 0 1 11 1 0 X1 1 1 1

Page 55: Karnaugh maps

– Many times there are incompletely specified conditions

• Valuations that can never occur, or for which we “don’t care what the device does”

– Modeling such a device requires us to specify don’t care conditions in those instances

• Use X as a value to indicate we don't care what happens

– Don't care situations are often called incompletely specified functions

Don’t Care Conditions

Page 56: Karnaugh maps

• Example Using Don't Cares

– f(A,B,C,D) = m(1,5,8,9,10) + d(3,7,11,15)

– f = A B' + A' D

C D A B

00 01 11 10

00 0 1 X 0

01 0 1 X 0

11 0 0 X 0

10 1 1 X 1

Page 57: Karnaugh maps

1. Choose an element from the “on” set

2. Find all maximal groups (prime implicants) of “on” elements and X elements adjacent to that element Note 1: prime implicants are always a power of 2 in size Note 2: do not feel compelled to include X’s – use them only

when they provide a larger implicant

3. Repeat steps 1-2 for all elements in the “on” set

4. Select all essential prime implicants

5. For all elements of the “on” set not covered by the essential prime implicants, select the smallest number of prime implicants that cover them

Karnaugh Map Method Restated

Page 58: Karnaugh maps

K-map Summary

• K-maps are an alternative to algebra for simplifying expressions

– The result is a MSP/MPS, which leads to a minimal two-level circuit– It’s easy to handle don’t-care conditions– K-maps are really only good for manual simplification of small

expressions...

• Things to keep in mind:

– Remember the correct order of minterms/maxterms on the K-map– When grouping, you can wrap around all sides of the K-map, and

your groups can overlap– Make as few rectangles as possible, but make each of them as

large as possible. This leads to fewer, but simpler, product terms– There may be more than one valid solution

Page 59: Karnaugh maps

Timing Hazards in Combinational Logic Circuits

• Hazards are undesirable changes in the output of a combinational logic circuit caused by unequal gate propagation delays.

• Static hazard (glitch) -- the output momentarily changes from the correct or static state

– Static 1 hazard -- the output changes from 1 to 0 and back to 1

– Static 0 hazard -- the output changes from 0 to 1 and back to 0

• Dynamic hazard (bounce) -- the output changes multiple times during a change of state

– Dynamic 0 to 1 hazard -- the output changes from 0 to 1 to 0 to 1

– Dynamic 1 to 0 hazard -- the output changes from 1 to 0 to 1 to 0

Page 60: Karnaugh maps

Illustration of a static hazard.

x 1

x 2

x 3

x 1

y 1

y 2

G 1

G 2

G 3I1z (x 1 , x 2 , x 3)

(a ) (b )

x 1

x 2

x 3

y 1

y 2

G 1

G 2

G 3z (x 1 , x 2 , x 3)

x 1

Page 61: Karnaugh maps

Illustration of a static hazard (con’t)

x 1

x 2

x 3

y 1

y 2

z

T im e

(c)

t1 t2 t3 t4 t5 t6

D t D t D t

Page 62: Karnaugh maps

Illustration of a static hazard (con’t).

x 1

x 2

x 3

y 1

y 2

z

T im e

(d )

t1 t2 t3 t4 t5 t6 t7 t8 t9

D t2 D t3

D t1 D t3

D t2 D t3

Page 63: Karnaugh maps

Identifying hazards on a K-map.

(b )

1

11 1

x 1

x 2

x 3

z

(a )

1

11 1

x 1

x 2

x 3

z

Page 64: Karnaugh maps

Hazard-free network.

x 1

x 2

x 3

G 1

G 4

G 3z (x 1 , x 2 , x 3)

x 3

G 2x 1

x 2

Page 65: Karnaugh maps

Example of a static-0 hazard.

G 1

G 3

G 4z (A , B , C , D )

G 2

0

B

D

0

0 0 0 0

0 0

0

C

A

(a )

(b )

A

C

A

D

BA

C

Page 66: Karnaugh maps

Example of a static-0 hazard (con’t).

0

B

D

0

0 0 0 0

0 0

0

C

A

G 1

G 4z (A , B , C , D )

G 2

G 3

(c )

(d )

A

C

A

D

BA

C

CB

DG 5

Page 67: Karnaugh maps

Dynamic hazards.

(a ) (b )

Page 68: Karnaugh maps

Quine-McCluskey Minimization Method

• Advantages over K-maps

– Can be computerized

– Can handle functions of more than six variables

• Overview of the method

– Given the minterms of a function

– Find all prime implicants (steps 1 and 2)

• Partition minterms into groups according to the number of 1’s

• Exhaustively search for prime implicants

– Find a minimum prime implicant cover (steps 3 and 4)

• Construct a prime implicant chart

• Select the minimum number of prime implicants

Page 69: Karnaugh maps

Use the Q-M method to find the MSOP of the function

f(A,B,C,D) = m(2,4,6,8,9,10,12,13,15)

C D

A B

1

0 0 0 1 1 1 1 00 4 1 2 8

1 5 1 3 9

3 7 1 5 11

2 6 1 4 1 0

0 0

0 1

1 1

1 0

B

D

1 1

1

1 1 1

A

C

1 1

Figure K-map for example 3.30.

Page 70: Karnaugh maps

List Prime Implicants in Groups

Page 71: Karnaugh maps

Step 2 -- Generate Prime Implicants

Page 72: Karnaugh maps

Step 3 -- Prime Implicant Chart

642 8 1 0 1 2 1 3 1 5

P I 2

P I 3

P I 4

P I 5

P I 6

* * P I 7

* * P I 1

9

Page 73: Karnaugh maps

Step 4 -- Reduced Prime Implicant Chart

642 1 0

P I 2

*P I 3

*P I 4

P I 5

P I 6

Page 74: Karnaugh maps

The Resulting Minimal Realization of f

f(A,B,C,D) = PI1 + PI3 + PI4 + PI7

= 1-0- + -010 + 01-0 + 11-1

= AC + B CD + A BD + ABD

Page 75: Karnaugh maps

How the Q-M Results Look on a K-map

C D

A B

0 0 0 1 1 1 1 00 4 1 2 8

1 5 1 3 9

3 7 1 5 11

2 6 1 4 1 0

0 0

0 1

1 1

1 0

B

1

A

C

1 1

1

D

1

1

1

1 1

Figure 3.33 Grouping of terms.

Page 76: Karnaugh maps

Covering Procedure

Step 1 -- Identify any minterms covered by only one PI. Select these PIs for the cover.

Step 2 -- Remove rows covered by the PIs identified in step 1. Remove minterms covered by the removed rows.

Step 3 -- If a cyclic chart results from step 2, go to step 5. Otherwise, apply the reduction procedure of steps 1 and 2.

Step 4 -- If a cyclic chart results from step 3, go to step 5. Otherwise return to step 1.

Step 5 -- Apply the cyclic chart procedure. Repeat step 5 until a void chart or noncyclic chart chart is produced. In the latter case, return to step 1.

Page 77: Karnaugh maps

Coverage Examplef(A,B,C,D) = m(0,1,5,6,7,8,9,10,11,13,14,15)

510 6 8 9 1 0 1 1

* * P I1

P I2

P I3

P I4

P I5

P I6

* * P I7

7

1 3 1 4 1 5

Page 78: Karnaugh maps

Reduced PI Charts

111 05 1 3

P I2

P I3

P I4

P I5

P I6

1 05

* P I2

* P I4

Page 79: Karnaugh maps

Cyclic PI Charts

1. No essential PIs.2. No row or column coverage.

321 4

* P I1

P I2

P I3

P I4

P I5

P I6

5 6

542 6

P I2

P I3

P I4

P I5

P I6

542 6

* P I3

P I4

* P I5

Page 80: Karnaugh maps

Using the Q-M Procedure with Incompletely Specified Functions

1. Use minterms and don’t cares when generating prime implicants

2. Use only minterms when finding a minimal cover

Example 3.25 -- Find a minimal sum of products of the following functionusing the Quine-McCluskey procedure.

Page 81: Karnaugh maps

Minimizing Table

Page 82: Karnaugh maps

PI Chart

732 1 0 1 5 2 7

P I1

P I2

P I3

1 2

* * P I4

* * P I5

* * P I6

* * P I7

Page 83: Karnaugh maps

Results of Minimization

f(A,B,C,D,E) = PI1 + PI4 + PI5 + PI6 + PI7 OR

= PI2 + PI4 + PI5 + PI6 + PI7

Page 84: Karnaugh maps
Page 85: Karnaugh maps

Half Adder 85

Half Adder (1/2)

Half-Adder is a circuit which adds two single bits (called X,Y) together, to produce a result of two bits (called C, S).

A black-box representation of this circuit is:

Truth table representation is:

X Y C S0 0 0 00 1 0 11 0 0 11 1 1 0

Half adder

X

Y(X+Y)

S

C

Page 86: Karnaugh maps

Half Adder 86

Half Adder (2/2)

In sum-of-minterms forms:C = X.YS = X'.Y + X.Y'

Algebraic simplification could simplify S to:S = X'.Y + X.Y' = XY

Giving:

X Y C S0 0 0 00 1 0 11 0 0 11 1 1 0

XY

S

C

Page 87: Karnaugh maps
Page 88: Karnaugh maps
Page 89: Karnaugh maps
Page 90: Karnaugh maps