ct455: computer organization k-map. lecture 5: karnaugh maps function simplification function...

78
CT455: CT455: Computer Organization Computer Organization K-Map K-Map

Upload: reynold-watkins

Post on 28-Dec-2015

237 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

CT455: CT455: Computer OrganizationComputer Organization

K-MapK-Map

Page 2: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Lecture 5: Karnaugh MapsLecture 5: Karnaugh Maps

Function SimplificationFunction Simplification

Algebraic SimplificationAlgebraic Simplification

Half AdderHalf Adder

Introduction to K-mapsIntroduction to K-maps

Venn DiagramsVenn Diagrams

2-variable K-maps2-variable K-maps

3-variable K-maps3-variable K-maps

4-variable K-maps4-variable K-maps

5-variable and larger K-maps5-variable and larger K-maps

Page 3: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Lecture 5: Karnaugh MapsLecture 5: Karnaugh Maps

Simplification using K-mapsSimplification using K-maps

Converting to Converting to MintermsMinterms Form Form

Simplest SOP ExpressionsSimplest SOP Expressions

Getting POS ExpressionsGetting POS Expressions

Don’t-care ConditionsDon’t-care Conditions

ReviewReview

ExamplesExamples

Page 4: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Function SimplificationFunction Simplification

Why simplify?Why simplify? Simpler expression uses less logic gates. Simpler expression uses less logic gates. Thus: cheaper, less power, faster (sometimes).Thus: cheaper, less power, faster (sometimes).

Simplification techniques:Simplification techniques: Algebraic SimplificationAlgebraic Simplification. .

simplify symbolically using theorems/postulates.simplify symbolically using theorems/postulates. requires skill but extremely open-ended.requires skill but extremely open-ended.

Karnaugh MapsKarnaugh Maps. . diagrammatic technique using ‘Venn-like diagram’.diagrammatic technique using ‘Venn-like diagram’. easy for humans (pattern-matching skills).easy for humans (pattern-matching skills). simplified standard forms.simplified standard forms. limited to not more than 6 variables.limited to not more than 6 variables.

Page 5: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Algebraic SimplificationAlgebraic Simplification

Algebraic simplificationAlgebraic simplification aims to minimise aims to minimise

(i) number of literals, and(i) number of literals, and

(ii) number of terms(ii) number of terms

But sometimes conflicting.But sometimes conflicting.

Let’s aim at reducing the number of literals.Let’s aim at reducing the number of literals.

Page 6: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Algebraic SimplificationAlgebraic Simplification

Example: Example: (x+y).(x+y').(x+y).(x+y').(x'+z)(x'+z) (6 literals)(6 literals)

= (x.x+= (x.x+x.y'+x.yx.y'+x.y++y.y'y.y').(x'+z)).(x'+z) (assoc.)(assoc.)= (x+x.= (x+x.(y'+y)(y'+y)+0).(x'+z)+0).(x'+z) (idemp.,assoc., compl.)(idemp.,assoc., compl.)= (x+= (x+x.(1)x.(1)+0).(x'+z)+0).(x'+z) (complement)(complement)= (= (x+x+0x+x+0).(x'+z)).(x'+z) (identity 1)(identity 1)= = (x).(x'+z)(x).(x'+z) (idemp, identity 0)(idemp, identity 0)= (= (x.x'x.x'+x.z)+x.z) (assoc.)(assoc.)= (= (00+x.z)+x.z) (complement)(complement)= x.z = x.z (identity 0)(identity 0)

Number of literals reduced from 6 to 2.Number of literals reduced from 6 to 2.

Page 7: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

77CS1103-5CS1103-5

Minimum SOP and POS RepresentationsMinimum SOP and POS Representations

The The minimum sum of products (MSOP)minimum sum of products (MSOP) of a function, of a function, ff, is a , is a SOP representation of SOP representation of ff that contains the fewest number of that contains the fewest number of product terms and fewest number of literals of any SOP product terms and fewest number of literals of any SOP representation of representation of ff..

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

= = ab + aab + acd + acd cd + acd = ab + cd= ab + cd

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

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

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

Page 8: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Algebraic SimplificationAlgebraic Simplification

Find minimal SOP and POS expressions of Find minimal SOP and POS expressions of ff(x,y,z) = x'.y.(z + y'.x) + y'.z (x,y,z) = x'.y.(z + y'.x) + y'.z x'.y.(z+y'.x)x'.y.(z+y'.x) + y'.z + y'.z

= x'.y.z + = x'.y.z + x'.y.y'.xx'.y.y'.x + y'.z + y'.z (distributivity)(distributivity)= = x'.y.z + 0x'.y.z + 0 + y'.z + y'.z (complement, null element 0)(complement, null element 0)= x'.y.z + y'.z= x'.y.z + y'.z (identity 0)(identity 0)= x'.z + y’.z= x'.z + y’.z (absorption)(absorption)= (x' + y').z= (x' + y').z (distributivity)(distributivity)

Minimal SOP of Minimal SOP of ff = = x'.z + y'.zx'.z + y'.z (2 2-input AND gates and (2 2-input AND gates and 1 2-input OR gate)1 2-input OR gate)

Minimal POS of Minimal POS of ff = = (x' + y').z(x' + y').z (1 2-input OR gate and (1 2-input OR gate and 1 2-input AND gate)1 2-input AND gate)

Page 9: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Algebraic SimplificationAlgebraic Simplification

Find minimal SOP expression of Find minimal SOP expression of ff(a,b,c,d) = a.b.c + a.b.d + a'.b.c' + c.d + b.d'(a,b,c,d) = a.b.c + a.b.d + a'.b.c' + c.d + b.d'a.b.c + a.b.c + a.b.da.b.d + a'.b.c' + c.d + + a'.b.c' + c.d + b.d'b.d'

= a.b.c + = a.b.c + a.b + a'.b.c'a.b + a'.b.c' + c.d + b.d' (absorption) + c.d + b.d' (absorption)= = a.b.c + a.ba.b.c + a.b + b.c' + c.d + b.d' + b.c' + c.d + b.d' (absorption) (absorption)= a.b + b.c' + = a.b + b.c' + c.d + b.d'c.d + b.d' (absorption) (absorption)= a.b + c.d + b.= a.b + c.d + b.(c' + d')(c' + d') (distributivity) (distributivity)= a.b + = a.b + c.d + b.(c.d)'c.d + b.(c.d)' (DeMorgan) (DeMorgan)= = a.ba.b + c.d + + c.d + bb (absorption) (absorption)= b + c.d= b + c.d (absorption) (absorption)

Number of literals reduced form 13 to 3.Number of literals reduced form 13 to 3.

Page 10: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Algebraic SimplificationAlgebraic Simplification

Difficulty – needs good algebraic manipulation skills.Difficulty – needs good algebraic manipulation skills.

Advantage – very open-ended (to your desired form!)Advantage – very open-ended (to your desired form!)

Page 11: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Half AdderHalf Adder

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

A black-box representation of this circuit is: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 12: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Half AdderHalf Adder

In sum-of-minterms forms:In sum-of-minterms forms:

C = X.YC = X.Y

S = X'.Y + X.Y'S = X'.Y + X.Y'

Algebraic simplification could simplify S to:Algebraic simplification could simplify S to:

S = X'.Y + X.Y'S = X'.Y + X.Y'

= X= XYY

Giving:Giving:

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

XY

S

C

Page 13: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Introduction to K-mapsIntroduction to K-maps

Systematic method to obtain Systematic method to obtain simplified simplified sum-of-sum-of-productsproducts (SOPs) Boolean expressions. (SOPs) Boolean expressions.

Objective: Objective: FewestFewest possible terms/literals. possible terms/literals.

Diagrammatic technique based on a special form of Diagrammatic technique based on a special form of Venn diagram.Venn diagram.

Advantage: Easy with visual aid.Advantage: Easy with visual aid.

Disadvantage: Limited to 5 or 6 variables.Disadvantage: Limited to 5 or 6 variables.

Page 14: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

1414CS1103-5CS1103-5

Figure 3.1 Venn diagram and equivalent K-mapFigure 3.1 Venn diagram and equivalent K-mapfor two variablesfor two variables

(d )

A B f(A B )

m

0

m

2

m

1

m

3

A

B

0 2

1 3

A

B

B

A

0 2

1 3

(a ) (b ) (c )

(e ) ( f)

B

A

0 2

1 3

(g )

0 1

0

1

0 0

0 1

1 0

1 1

BA B

A

B

A

A B A B A Bm

2

m

1

m

3

A Bm

0

0 1

0

1

Page 15: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

1515CS1103-5CS1103-5

FigureFigure 3.2 Venn diagram and equivalent K-map 3.2 Venn diagram and equivalent K-mapfor three variablesfor three variables

m 0

B

m 2 m 6

m 1 m 3 m 7 m 5

0 2 6 4

1 3 7 5

B

A

A B

C

A B

(a )

(d )

A B C

A B C A B CA B C

A B C m 0m 1

m 2

m 3

m 4

m 5

m 6m 7

m 4

C

A

C

C

A B

0 2 6 4

1 3 7 5

0 0 0 1 1 1 1 0

0

1

C

A B C

A B C

A B C

C

A B

(b ) (c )

(e ) ( f)

Page 16: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

1616CS1103-5CS1103-5

Figure 3.3 (a) -- (d) K-maps for four and five Figure 3.3 (a) -- (d) K-maps for four and five variablesvariables

C D

A B

00 01 11 100 4 1 2 8

1 5 1 3 9

3 7 1 5 1 1

2 6 1 4 1 0

00

01

11

10

0 4 1 2 8

1 5 1 3 9

3 7 1 5 1 1

2 7 1 4 1 0

B

D

D E

A B C

000 001 011 0100 4 1 2 8

1 5 1 3 9

3 7 1 5 1 1

2 6 1 4 1 0

00

01

11

10

100 101 111 1101 6 2 0 2 8 2 4

1 7 2 1 2 9 2 5

1 9 2 3 2 7

1 8 2 2 3 0 2 6

0 4 1 2 8

1 5 1 3 9

3 7 1 5 1 1

2 6 1 4 1 0

C

D

B

A

C

1 6 2 0 2 8 2 4

1 7 2 1 2 9 2 5

1 9 2 3 3 1 2 7

1 8 2 2 3 0 2 6

B

C

A

E

(a) (b)

(c) (d)

Page 17: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Venn DiagramsVenn Diagrams

Venn diagram to represent the space of minterms.Venn diagram to represent the space of minterms. Example of 2 variables (4 minterms):Example of 2 variables (4 minterms):

ab' a'b

a'b'

aba

b

Page 18: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Venn DiagramsVenn Diagrams

Each set of minterms represents a Boolean function. Each set of minterms represents a Boolean function. Examples: Examples:

{ a.b, a.b' } { a.b, a.b' } a.b + a.b' = a.(b+b') = a a.b + a.b' = a.(b+b') = a

{ a‘.b, a.b } { a‘.b, a.b } a‘.b + a.b = (a'+a).b = b a‘.b + a.b = (a'+a).b = b

{ a.b }{ a.b } a a..bb

{ a{ a..b, ab, a..b', a‘b', a‘..b } b } a a..b + ab + a..b' + a‘b' + a‘..b = a + bb = a + b

{ }{ } 0 0

{ a‘{ a‘..b',ab',a..b,ab,a..b',a‘b',a‘..b } b } 1 1ab' a'b

a'b'

aba b

Page 19: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

2-variable K-maps2-variable K-maps

Karnaugh-mapKarnaugh-map (K-map) is an abstract form of Venn (K-map) is an abstract form of Venn diagram, organised as a matrix of squares, wherediagram, organised as a matrix of squares, where each square represents a each square represents a mintermminterm adjacent squares always adjacent squares always differ by just one literaldiffer by just one literal (so (so

that the unifying theorem may apply: that the unifying theorem may apply: a + a' = 1a + a' = 1))

For 2-variable case (e.g.: variables a,b), the map can For 2-variable case (e.g.: variables a,b), the map can be drawn as:be drawn as:

Page 20: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

2-variable K-maps2-variable K-maps

Alternative layouts of a 2-variable (a, b) K-mapAlternative layouts of a 2-variable (a, b) K-map

a'b'

ab'

a'b abb

a

m0 m2

m1 m3b

a

OR

Alternative 2:

a'b'

a'b

ab' aba

b

m0 m1

m2 m3a

b

Alternative 1:

OR

ab a'b

ab' a'b'

b

a

m3 m1

m2 m0

b

aOR

Alternative 3:

and others…

Page 21: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

2-variable K-maps2-variable K-maps

Equivalent labeling:Equivalent labeling:

a

b

equivalent to:

ab

0 1

0 1

b

a

equivalent to:

ba

1 0

0 1

Page 22: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

2-variable K-maps2-variable K-maps

The K-map for a function is specified by puttingThe K-map for a function is specified by putting a ‘1’ in the square corresponding to a minterma ‘1’ in the square corresponding to a minterm a ‘0’ otherwisea ‘0’ otherwise

For example: Carry and Sum of a half adder.For example: Carry and Sum of a half adder.

0 0

0 1a

b

0 1

1 0a

b

C = ab S = ab' + a'b

Page 23: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

3-variable K-maps3-variable K-maps

There are 8 minterms for 3 variables (a, b, c). There are 8 minterms for 3 variables (a, b, c). Therefore, there are 8 cells in a 3-variable K-map.Therefore, there are 8 cells in a 3-variable K-map.

ab'c' ab'ca

b

abc abc'

a'b'c'

a'b'c a'bc a'bc'0 1

00 01 11 10

c

abc

ORm4 m5a

b

m7 m6

m0 m1 m3 m20 1

00 01 11 10

c

abc

Note Gray code sequenceAbove arrangement ensures that minterms of adjacent cells differ by only ONE literal. (Other arrangements which satisfy this criterion may also be used.)

Page 24: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

3-variable K-maps3-variable K-maps

There is There is wrap-aroundwrap-around in the K-map: in the K-map: a'.b'.c' (a'.b'.c' (m0m0) is adjacent to a'.b.c' () is adjacent to a'.b.c' (m2m2)) a.b'.c' (a.b'.c' (m4m4) is adjacent to a.b.c' () is adjacent to a.b.c' (m6m6))

m4 m5 m7 m6

m0 m1 m3 m20 1

00 01 11 10abc

Each cell in a 3-variable K-map has 3 adjacent neighbours. In general, each cell in an n-variable K-map has n adjacent neighbours. For example, m0 has 3 adjacent neighbours: m1, m2 and m4.

Page 25: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

2525CS1103-5CS1103-5

Figure 3.15 -- Example 3.13Figure 3.15 -- Example 3.13

f(A,B,C,D)f(A,B,C,D) = = mm(1,2,3,6) = (1,2,3,6) = AAC + BCC + 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 26: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Quick Review Questions (1)Quick Review Questions (1)

Textbook page 104.Textbook page 104. 5-1.5-1. The K-map of a 3-variable function The K-map of a 3-variable function FF is shown below. is shown below.

What is the sum-of-minterms expression of What is the sum-of-minterms expression of FF? ?

5-2.5-2. Draw the K-map for this function A:Draw the K-map for this function A:AA(x, y, z) = x.y + y.z’ + x’.y’.z(x, y, z) = x.y + y.z’ + x’.y’.z

0 1a

b

0 0

1 0 0 10 1

00 01 11 10

c

abc

Page 27: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

4-variable K-maps4-variable K-maps

There are 16 cells in a 4-variable (w, x, y, z) K-map.There are 16 cells in a 4-variable (w, x, y, z) K-map.

m4 m5

w

y

m7 m6

m0 m1 m3 m200

01

11

10

00 01 11 10

z

wxyz

m12

m13

m15

m14

m8 m9 m11

m10

x

Page 28: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

4-variable K-maps4-variable K-maps

There are 2 wrap-arounds: a horizontal wrap-around There are 2 wrap-arounds: a horizontal wrap-around and a vertical wrap-around.and a vertical wrap-around.

Every cell thus has 4 neighbours. For example, the Every cell thus has 4 neighbours. For example, the cell corresponding to minterm cell corresponding to minterm m0m0 has neighbours has neighbours m1m1, , m2m2, , m4m4 and and m8m8..

m4 m5

w

y

m7 m6

m0 m1 m3 m2

z

wxyz

m12

m13

m15

m14

m8 m9 m11

m10

x

Page 29: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

2929CS1103-5CS1103-5

Figure 3.16 -- Example 3.14Figure 3.16 -- Example 3.14

f(A,B,C,D)f(A,B,C,D) = B = BDD + B + BCC + BCD + BCD

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 1 1

2 6 1 4 1 0

0 0

0 1

1 1

1 0

B

D

1 1

1

A

C

1

1

1

1

Page 30: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

5-variable K-maps5-variable K-maps

Maps of more than 4 variables are more difficult to use Maps of more than 4 variables are more difficult to use because the geometry (hyper-cube configurations) for because the geometry (hyper-cube configurations) for combining adjacent squares becomes more involved.combining adjacent squares becomes more involved.

For 5 variables, e.g. vwxyz, need 2For 5 variables, e.g. vwxyz, need 25 5 = 32 squares.= 32 squares.

Page 31: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

5-variable K-maps5-variable K-maps

Organised as two 4-variable K-maps:Organised as two 4-variable K-maps:

Corresponding squares of each map are adjacent.Can visualise this as being one 4-variable map on TOP of the other 4-variable map.

m20

m21

w

y

m23

m22

m16

m17

m19

m18

00

01

11

10

00 01 11 10

z

wxyz

m28

m29

m31

m30

m24

m25

m27

m26

x

m4 m5

w

y

m7 m6

m0 m1 m3 m200

01

11

10

00 01 11 10

z

wxyz

m12

m13

m15

m14

m8 m9 m11

m10

x

v ' v

Page 32: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Larger K-mapsLarger K-maps

6-variable K-map is pushing the limit of human 6-variable K-map is pushing the limit of human “pattern-recognition” capability.“pattern-recognition” capability.

K-maps larger than 6 variables are practically K-maps larger than 6 variables are practically unheard of!unheard of!

Normally, a 6-variable K-map is organised as four 4-Normally, a 6-variable K-map is organised as four 4-variable K-maps, which are mirrored along two variable K-maps, which are mirrored along two axes.axes.

Page 33: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Larger K-mapsLarger K-maps

Try stretch your recognition capability by finding simplest Try stretch your recognition capability by finding simplest sum-of-products expression for sum-of-products expression for m(6,8,14,18,23,25,27,29,41,45,57,61). m(6,8,14,18,23,25,27,29,41,45,57,61).

w

a‘.b'

m000

01

11

10

00 01 11 10cdef

m1 m3 m2

m4 m5 m7 m6

m12

m13

m15

m14

m8 m9 m11

m10

m40

10

11

01

0000 01 11 10cd

ef

m41

m43

m42

m44

m45

m47

m46

m36

m37

m39

m38

m32

m33

m35

m34

m18

00

01

11

10

10 11 01 00 cd

ef

m19

m17

m16

m22

m23

m21

m20

m30

m31

m29

m28

m26

m27

m25

m24

m58

10

11

01

0010 11 01 00 cd

ef

m59

m57

m56

m62

m63

m61

m60

m54

m55

m53

m52

m50

m51

m49

m48

a‘.b

a.b' a.b

a

b

Page 34: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Simplification Using K-mapsSimplification Using K-maps

Based on the Based on the Unifying TheoremUnifying Theorem::

A + A' = 1A + A' = 1

In a K-map, each cell containing a ‘1’ corresponds to a In a K-map, each cell containing a ‘1’ corresponds to a minterm of a given function minterm of a given function FF. .

Each group of adjacent cells containing ‘1’ (group must Each group of adjacent cells containing ‘1’ (group must have size have size in powersin powers of twosof twos: 1, 2, 4, 8, …) then : 1, 2, 4, 8, …) then corresponds to a corresponds to a simpler product termsimpler product term of of FF. .

Grouping 2 adjacent squares eliminates 1 variable, grouping 4 Grouping 2 adjacent squares eliminates 1 variable, grouping 4 squares eliminates 2 variables, grouping 8 squares eliminates squares eliminates 2 variables, grouping 8 squares eliminates 3 variables, and so on. In general, grouping 23 variables, and so on. In general, grouping 2nn squares squares eliminates eliminates nn variables. variables.

Page 35: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Simplification Using K-mapsSimplification Using K-maps

Group as many squares as possible.Group as many squares as possible. The larger the group is, the fewer the number of literals in The larger the group is, the fewer the number of literals in

the resulting product term.the resulting product term.

Select as few groups as possible to cover all the Select as few groups as possible to cover all the squares (minterms) of the function.squares (minterms) of the function.

The fewer the groups, the fewer the number of product The fewer the groups, the fewer the number of product terms in the minimized function.terms in the minimized function.

Page 36: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Simplification Using K-mapsSimplification Using K-maps

Example:Example:

FF (w,x,y,z) = w’.x.y'.z' + w'.x.y'.z + w.x'.y.z' (w,x,y,z) = w’.x.y'.z' + w'.x.y'.z + w.x'.y.z' + w.x'.y.z + w.x.y.z' + w.x.y.z+ w.x'.y.z + w.x.y.z' + w.x.y.z

= = mm(4, 5, 10, 11, 14, 15)(4, 5, 10, 11, 14, 15)

z

1 1

w

y

00

01

11

10

00 01 11 10wxyz

1 1

1 1

x (cells with ‘0’ are not shown for clarity)

Page 37: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Simplification Using K-mapsSimplification Using K-maps

Each group of adjacent minterms (group size in Each group of adjacent minterms (group size in powers of twos) corresponds to a possible powers of twos) corresponds to a possible product product termterm of the given function. of the given function.

1 1

w

00

01

11

10

00 01 11 10

z

wxyz

1 1

1 1

x

A

B

y

Page 38: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Simplification Using K-mapsSimplification Using K-maps

There are 2 groups of minterms: A and B, where:There are 2 groups of minterms: A and B, where: AA = w'.x.y'.z' + w‘.x.y'.z= w'.x.y'.z' + w‘.x.y'.z

= w'.x.y'.(z' + z)= w'.x.y'.(z' + z)

= = w'.x.y'w'.x.y'

BB = w.x'.y.z' + w.x'.y.z + w.x.y.z' + w.x.y.z= w.x'.y.z' + w.x'.y.z + w.x.y.z' + w.x.y.z

= w.x'.y.(z' + z) + w.x.y.(z' + z)= w.x'.y.(z' + z) + w.x.y.(z' + z)

= w.x'.y + w.x.y= w.x'.y + w.x.y

= w.(x'+x).y= w.(x'+x).y

= = w.yw.y1 1

w

00

01

11

10

00 01 11 10

z

wx

yz

1 1

1 1

x

A

B

y

Page 39: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Simplification Using K-mapsSimplification Using K-maps

Each product term of a group, Each product term of a group, w'.x.y' w'.x.y' and and w.yw.y, , represents the represents the sum of mintermssum of minterms in that group. in that group.

Boolean function is therefore the sum of Boolean function is therefore the sum of product terms (SOP) which represent all groups product terms (SOP) which represent all groups of the minterms of the function.of the minterms of the function.

FF(w,x,y,z) = A + B = w'.x.y' + w.y(w,x,y,z) = A + B = w'.x.y' + w.y

Page 40: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Simplification Using K-mapsSimplification Using K-maps

Larger groups correspond to product terms of fewer Larger groups correspond to product terms of fewer literals. In the case of a 4-variable K-map:literals. In the case of a 4-variable K-map:

1 cell1 cell = 4 literals, e.g.: w.x.y.z, w'.x.y'.z= 4 literals, e.g.: w.x.y.z, w'.x.y'.z

2 cells2 cells = 3 literals, e.g.: w.x.y, w.y'.z'= 3 literals, e.g.: w.x.y, w.y'.z'

4 cells4 cells = 2 literals, e.g.: w.x, x'.y= 2 literals, e.g.: w.x, x'.y

8 cells8 cells = 1 literal, e.g.: w, y', z= 1 literal, e.g.: w, y', z

16 cells16 cells = no literal, e.g.: 1= no literal, e.g.: 1

Page 41: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Simplification Using K-mapsSimplification Using K-maps

Other possible valid groupings of a 4-variable K-map Other possible valid groupings of a 4-variable K-map include:include:

1

11

1

1

1

1

1

1

11

1 1

111

1

11

1

Page 42: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Simplification Using K-mapsSimplification Using K-maps

Groups of minterms must be Groups of minterms must be (1) rectangular, and (1) rectangular, and (2) have size in powers of 2’s. (2) have size in powers of 2’s.

Otherwise they are Otherwise they are invalidinvalid groups. Some examples of groups. Some examples of invalid groupsinvalid groups::

1

11

1 1

111

1

1

1

1

1

1

1

1

Page 43: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Converting to Minterms FormConverting to Minterms Form

The K-map of a function is easily drawn when the The K-map of a function is easily drawn when the function is given in canonical sum-of-products, or function is given in canonical sum-of-products, or sum-of-minterms form.sum-of-minterms form.

What if the function is not in sum-of-minterms?What if the function is not in sum-of-minterms? Convert it to sum-of-products (SOP) form.Convert it to sum-of-products (SOP) form.

Expand the SOP expression into sum-of-minterms Expand the SOP expression into sum-of-minterms expression, or fill in the K-map directly based on the expression, or fill in the K-map directly based on the SOP expression.SOP expression.

Page 44: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Converting to Minterms FormConverting to Minterms Form Example: Example:

f(A,B,C,D) = A(C+D)'(B'+D') + C(B+C'+A'D)f(A,B,C,D) = A(C+D)'(B'+D') + C(B+C'+A'D)

= A(C'D')(B'+D') + BC + CC' + A'CD= A(C'D')(B'+D') + BC + CC' + A'CD

= AB'C'D' + AC'D' + BC + A'CD= AB'C'D' + AC'D' + BC + A'CD

11

C

A

00

01

11

10

00 01 11 10

B

CDAB

D1 1 1

1 1

AB'C'D' + AB'C'D' + AC'D'AC'D' + BC + A'CD + BC + A'CD

= AB'C'D' + AC'D'(B+B') + = AB'C'D' + AC'D'(B+B') + BCBC + A'CD + A'CD

= AB'C'D' + ABC'D' + AB'C'D' + BC(A+A') + A'CD= AB'C'D' + ABC'D' + AB'C'D' + BC(A+A') + A'CD

= AB'C'D' + ABC'D' + ABC + A'BC + A'CD= AB'C'D' + ABC'D' + ABC + A'BC + A'CD

= AB'C'D' + ABC'D' + ABC(D+D') + A'BC(D+D') + = AB'C'D' + ABC'D' + ABC(D+D') + A'BC(D+D') + A'CD(B+B')A'CD(B+B')

= AB'C'D' + ABC'D' + ABCD + ABCD' + A'BCD + = AB'C'D' + ABC'D' + ABCD + ABCD' + A'BCD + A'BCD' + A'B'CDA'BCD' + A'B'CD

Page 45: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Simplest SOP ExpressionsSimplest SOP Expressions

To find the simplest possible To find the simplest possible sum of productssum of products (SOP) (SOP) expression from a K-map, you need to obtain:expression from a K-map, you need to obtain:

minimum number of literals per product term; andminimum number of literals per product term; and minimum number of product termsminimum number of product terms

This is achieved in K-map usingThis is achieved in K-map using bigger groupingsbigger groupings of minterms ( of minterms (prime implicantsprime implicants) where ) where

possible; andpossible; and no redundant groupings no redundant groupings (look for(look for essential prime implicantsessential prime implicants))

ImplicantImplicant:: a product term that could be used a product term that could be used to cover minterms of the function.to cover minterms of the function.

Page 46: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Simplest SOP ExpressionsSimplest SOP Expressions

A A prime implicantprime implicant is a product term obtained by is a product term obtained by combining the maximum possible number of minterms combining the maximum possible number of minterms from from adjacentadjacent squares in the map. squares in the map.

Use bigger groupings (prime implicants) where Use bigger groupings (prime implicants) where possible.possible.

11 1

111

11 1

111

Page 47: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Simplest SOP ExpressionsSimplest SOP Expressions

No redundant groups:No redundant groups:

An An essential prime implicantessential prime implicant is a prime implicant that is a prime implicant that includes at least one minterm that is not covered by includes at least one minterm that is not covered by any other prime implicant.any other prime implicant.

1

1

1

11

1

1

1

1

1

1

11

1

1

1

Essential prime implicants

Page 48: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Quick Review Questions (2)Quick Review Questions (2)

Textbook page 104.Textbook page 104.

5-3.5-3. Identify the prime implicants and the essential Identify the prime implicants and the essential prime implicants of the two K-maps below.prime implicants of the two K-maps below.

0 1a

b

0 0

1 1 0 10 1

00 01 11 10

c

abc

11

C

A

00

01

11

10

00 01 11 10

B

CDAB

D1 1 1

1 1

1

1 1

1

Page 49: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Simplest SOP ExpressionsSimplest SOP Expressions

Algorithm 1 (non optimal):Algorithm 1 (non optimal):

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

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

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

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

Page 50: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Simplest SOP ExpressionsSimplest SOP Expressions

Algorithm 2 (non optimal):Algorithm 2 (non optimal):

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

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

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

Page 51: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Simplest SOP ExpressionsSimplest SOP Expressions

Example:Example:

f(A,B,C,D) = f(A,B,C,D) = mm(2,3,4,5,7,8,10,13,15)(2,3,4,5,7,8,10,13,15)

All prime implicants

1

1

C

A

00

01

11

10

00 01 11 10

B

CDAB

1

1

1

1

D

1

1

1

Page 52: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Simplest SOP ExpressionsSimplest SOP Expressions

B

1

1

C

A

00

01

11

10

00 01 11 10CDAB

1

1

1

1

D

1

1

1

1

1

C

A

00

01

11

10

00 01 11 10

B

CDAB

1

1

1

1

D

1

1

1

Essential prime implicants

1

1

C

A

00

01

11

10

00 01 11 10

B

CDAB

1

1

1

1

D

1

1

1

Minimum cover

Page 53: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Simplest SOP ExpressionsSimplest SOP Expressions

1

1

C

A

00

01

11

10

00 01 11 10

B

CDAB

1

1

1

1

D

1

1

1

BD

AB'D'A'BC'

A'B'C

f(A,B,C,D) = B.D + A'.B'.C + A.B'.D' + A'.B.C'

Page 54: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Quick Review Questions (3)Quick Review Questions (3)

Textbook page 104.Textbook page 104.

5-4.5-4. Find the simplified expression for G(A,B,C,D).Find the simplified expression for G(A,B,C,D).

1

C

A

00

01

11

10

00 01 11 10

B

CDAB

D1 1 1

1

1

1 1

5-5 to 5-7.5-5 to 5-7.

Page 55: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Getting POS ExpressionsGetting POS Expressions

Simplified POS expressionSimplified POS expression can be obtained by grouping can be obtained by grouping the maxterms (i.e. 0s) of given function.the maxterms (i.e. 0s) of given function.

Example:Example:

Given F=Given F=m(0,1,2,3,5,7,8,9,10,11), we first draw m(0,1,2,3,5,7,8,9,10,11), we first draw the K-map, then group the maxterms together:the K-map, then group the maxterms together:

1

1

C

A

00

01

11

10

00 01 11 10

B

CDAB

1

0

1

1

D

1

1

1 1

10

00

0 0

Page 56: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Getting POS ExpressionsGetting POS Expressions

This gives the SOP of F' to be:This gives the SOP of F' to be:F' = B.D' + A.BF' = B.D' + A.B

To get POS of F, we have:To get POS of F, we have:F = (B.D' + A.B)'F = (B.D' + A.B)'

= (B.D')'.(A.B)' DeMorgan= (B.D')'.(A.B)' DeMorgan

= = (B'+D).(A'+B')(B'+D).(A'+B') DeMorgan DeMorgan

0

0

C

A

00

01

11

10

00 01 11 10

B

CDAB

0

1

0

0

D

0

0

0 0

01

11

1 1

1

1

C

A

00

01

11

10

00 01 11 10

B

CDAB

1

0

1

1

D

1

1

1 1

10

00

0 0K-map of F

K-map of F'

Page 57: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Don’t-care ConditionsDon’t-care Conditions

In certain problems, some In certain problems, some outputs are not specified.outputs are not specified.

These outputs can be either ‘1’ or These outputs can be either ‘1’ or ‘0’.‘0’.

They are called They are called don’t-care don’t-care conditionsconditions, denoted by X (or , denoted by X (or sometimes, d). sometimes, d).

Example: An odd parity generator Example: An odd parity generator for BCD code which has 6 for BCD code which has 6 unused combinations.unused combinations.

No. A B C D P0 0 0 0 0 11 0 0 0 1 02 0 0 1 0 03 0 0 1 1 14 0 1 0 0 05 0 1 0 1 16 0 1 1 0 17 0 1 1 1 08 1 0 0 0 09 1 0 0 1 1

10 1 0 1 0 X11 1 0 1 1 X12 1 1 0 0 X13 1 1 0 1 X14 1 1 1 0 X15 1 1 1 1 X

Page 58: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Don’t-care ConditionsDon’t-care Conditions

Don’t-care conditions can be used to help simplify Don’t-care conditions can be used to help simplify Boolean expression further in K-maps.Boolean expression further in K-maps.

They could be chosen to be either ‘1’ or ‘0’, depending They could be chosen to be either ‘1’ or ‘0’, depending on which gives the simpler expression. on which gives the simpler expression.

Page 59: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

Don’t-care ConditionsDon’t-care Conditions

For comparison:For comparison: WITHOUT Don’t-cares:WITHOUT Don’t-cares:

P = A'.B'.C'.D’ + A'.B'.C.D + P = A'.B'.C'.D’ + A'.B'.C.D + A'.B.C'.DA'.B.C'.D

+ A'.B.C.D' + A.B'.C'.D+ A'.B.C.D' + A.B'.C'.D

WITH Don’t-cares:WITH Don’t-cares:P = A'.B'.C'.D' + B'.C.D + B.C'.D P = A'.B'.C'.D' + B'.C.D + B.C'.D + B.C.D' + A.D+ B.C.D' + A.D

1

A

C

00

01

11

10

00 01 11 10

D

ABCD

1

B

1

1

1

1

A

C

00

01

11

10

00 01 11 10

D

ABCD

1

B

1

1

1

X X

XXXX

Page 60: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

ExamplesExamples

Example #1:Example #1:

f(A,B,C,D) = f(A,B,C,D) = mm(2,3,4,5,7,8,10,13,15)(2,3,4,5,7,8,10,13,15)

Fill in the 1’s.

1

1

C

A

00

01

11

10

00 01 11 10

B

CDAB

1

1

1

1

D

1

1

1

Page 61: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

ExamplesExamples

Example #1:Example #1:

f(A,B,C,D) = f(A,B,C,D) = mm(2,3,4,5,7,8,10,13,15)(2,3,4,5,7,8,10,13,15)

These are all the prime implicants; but do we need them all?1

1

C

A

00

01

11

10

00 01 11 10

B

CDAB

1

1

1

1

D

1

1

1

Page 62: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

ExamplesExamples

Example #1:Example #1:

f(A,B,C,D) = f(A,B,C,D) = mm(2,3,4,5,7,8,10,13,15)(2,3,4,5,7,8,10,13,15)

Essential prime implicants:

B.D

A'.B.C'

A.B'.D'

1

1

C

A

00

01

11

10

00 01 11 10

B

CDAB

1

1

1

1

D

1

1

1

Page 63: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

ExamplesExamples

Example #1:Example #1:

f(A,B,C,D) = f(A,B,C,D) = mm(2,3,4,5,7,8,10,13,15)(2,3,4,5,7,8,10,13,15)

Minimum cover.

EPIs: B.D, A'.B.C', A.B'.D'

+

A'.B'.C

1

1

C

A

00

01

11

10

00 01 11 10

B

CDAB

1

1

1

1

D

1

1

1

f(A,B,C,D) = B.D + A'.B.C' + A.B'.D' + A'.B'.C

Page 64: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

ExamplesExamples

1

1

C

A

00

01

11

10

00 01 11 10

B

CDAB

1

1

1

1

D

1

1

1

1

1

C

A

00

01

11

10

00 01 11 10

B

CDAB

1

1

1

1

D

1

1

1

B

1

1

C

A

00

01

11

10

00 01 11 10CDAB

1

1

1

1

D

1

1

1

Essential prime implicants

Minimum cover

SUMMARY

f(A,B,C,D) = B.D + A'.B'.C + A.B'.D' + A'.B.C'

Page 65: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

ExamplesExamples

Example #2:Example #2:

f(A,B,C,D) = A.B.C + B'.C.D' + A.D + B'.C'.D'f(A,B,C,D) = A.B.C + B'.C.D' + A.D + B'.C'.D'

Fill in the 1’s.1

1C

A

00

01

11

10

00 01 11 10

B

CDAB

1

1

1D

1

1

11

Page 66: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

ExamplesExamples

Example #2:Example #2:

f(A,B,C,D) = A.B.C + B'.C.D' + A.D + B'.C'.D'f(A,B,C,D) = A.B.C + B'.C.D' + A.D + B'.C'.D'

Find all PIs:

A.D

A.C

B'.D'

1

1C

A

00

01

11

10

00 01 11 10

B

CDAB

1

1

1D

1

1

11

Are all ‘1’s covered by the PIs? Yes, so the answer is: f(A,B,C,D) = A.D + A.C + B'.D'

Page 67: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

ExamplesExamples

Example #3 (with don’t cares):Example #3 (with don’t cares):

f(A,B,C,D) = f(A,B,C,D) = mm(2,8,10,15) + (2,8,10,15) + dd(0,1,3,7)(0,1,3,7)

Fill in the 1’s and X’s.1X

C

A

00

01

11

10

00 01 11 10

B

CDAB

X 1

XD

11

X

Page 68: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

ExamplesExamples

Example #3 (with don’t cares):Example #3 (with don’t cares):f(A,B,C,D) = f(A,B,C,D) = mm(2,8,10,15) + (2,8,10,15) + dd(0,1,3,7)(0,1,3,7)

1X

C

A

00

01

11

10

00 01 11 10

B

CDAB

X 1

XD

11

X

f(A,B,C,D) = B'.D' + B.C.D

Do we need to have an additional term A'.B' to cover the 2 remaining x’s?

No, because all the 1’s (minterms) have been covered.

Page 69: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

ExamplesExamples

To find simplest POS expression for example #2:To find simplest POS expression for example #2:

f(A,B,C,D) = A.B.C + B'.C.D' + A.D + B'.C'.D'f(A,B,C,D) = A.B.C + B'.C.D' + A.D + B'.C'.D' Draw the K-map of the complement of f, f '.Draw the K-map of the complement of f, f '.

1

1C

A

00

01

11

10

00 01 11 10

B

CDAB

1

1

D

11

1

From K-map,

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

Using DeMorgan’s theorem,

f = (A'.B + A'.D + B.C'.D')'

= (A+B').(A+D').(B'+C+D)

Page 70: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

ExamplesExamples

To find simplest POS expression for example #3:To find simplest POS expression for example #3:

f(A,B,C,D) = f(A,B,C,D) = mm(2,8,10,15) + (2,8,10,15) + dd(0,1,3,7)(0,1,3,7)

Draw the K-map of the complement of f, f '.Draw the K-map of the complement of f, f '.

f '(A,B,C,D) = f '(A,B,C,D) = mm(4,5,6,9,11,12,13,14) + (4,5,6,9,11,12,13,14) + dd(0,1,3,7)(0,1,3,7)

From K-map,

f ' = B.C' + B.D' + B'.D

Using DeMorgan’s theorem,

f = (B.C' + B.D' + B'.D)'

= (B'+C).(B'+D).(B+D')

1

1C

A

00

01

11

10

00 01 11 10

B

CDAB

1

1

D

11

1

X

X

X

X

1

Page 71: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

7171CS1103-5CS1103-5

Design Example: Two Bit ComparatorDesign Example: Two Bit ComparatorBlock Diagram and Truth Table

F 1

1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1

F 2

0 1 1 1 0 0 1 1 0 0 0 1 0 0 0 0

F 3

0 0 0 0 1 0 0 0 1 1 0 0 1 1 1 0

D

0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

C

0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1

B

0 1 0 1

A

0 0 1 1

F 1 A B = C D F 2 A B < C D F 3 A B > C D

A B

C D

N 1

N 2

A 4-Variable K-mapfor each of the 3output functions

Page 72: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

7272CS1103-5CS1103-5

Two bit Comparator ExampleTwo bit Comparator Example

F1 = A' B' C' D' + A' B C' D + A B C D + A B' C D'

F2 = A' B' D + A' C + B’CD

F3 = B C' D' + A C' + A B D'

AB 00 01 11 10

1 0 0 0

0 1 0 0

0 0 1 0

0 0 0 1

00

01

11

10

CD

F 1

AB 00 01 11 10

0 0 0 0

1 0 0 0

1 1 0 1

1 1 0 0

00

01

11

10

CD

F 2

AB 00 01 11 10

0 1 1 1

0 0 1 1

0 0 0 0

0 0 1 0

00

01

11

10

CD

F 3

Page 73: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

7373CS1103-5CS1103-5

Design Example: Two Bit AdderDesign Example: Two Bit AdderBlock Diagram and Truth Table

A 4-variable K-mapfor each of the 3 output functions

+ N 3

X 0 0 0 0 0 0 0 1 0 0 1 1 0 1 1 1

Y 0 0 1 1 0 1 1 0 1 1 0 0 1 0 0 1

Z 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 0

D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

C 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1

B 0 1 0 1

A 0 0 1 1

A B

C D

N 1

N 2

X Y Z

Page 74: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

7474CS1103-5CS1103-5

Two Bit AdderTwo Bit Adder (continued) (continued)

X = A C + B C D + A B D

Z = B D' + B' D = B xor D

Y = A' B' C + A B' C' + A' B C' D + A' B C D' + A B C' D' + A B C D

= B' (A xor C) + A' B (C xor D) + A B (C xnor D)

= B' (A xor C) + B (A xor B xor C)

gate countreduced if

XOR available

AB 00 01 11 10 0 0 0 0

0 0 1 0

0 1 1 1

0 0 1 1

00

01

11

10

CD

X

AB 00 01 11 10 0 0 1 1

0 1 0 1

1 0 1 0

1 1 0 0

00

01

11

10

CD

Y

AB 00 01 11 10 0 1 1 0

1 0 0 1

1 0 0 1

0 1 1 0

00

01

11

10

CD

Z

1's on diagonal suggest XOR!Y K-Map not minimal as drawn

Page 75: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

7575CS1103-5CS1103-5

\ D \ A \ C

Y 1

A

C

D

\ B

B

Y 2

Two Bit AdderTwo Bit Adder (continued) (continued)

Two alternativeimplementations of Ywith and without XOR

Note: XOR typicallyrequires 4 NAND gates

to implement!X

Y X NOR Y

Page 76: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

7676CS1103-5CS1103-5

Example 3.23 -- Design a circuit to distinguish Example 3.23 -- Design a circuit to distinguish BCD digits BCD digits 5 from those 5 from those 5. 5.

ABCD

A B C D

L o g icc ircu it f

M in te rm f(A , B , C , D )

0 0 0 00 0 0 10 0 1 00 0 1 10 1 0 00 1 0 10 1 1 00 1 1 11 0 0 01 0 0 11 0 1 01 0 1 11 1 0 01 1 0 11 1 1 01 1 1 1

0123456789

1 01 11 21 31 41 5

0000011111dddddd

(a )

(b )

Figure 3.25 -- block diagram and truth table.

Page 77: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

7777CS1103-5CS1103-5

Example 3.23 (concluded)Example 3.23 (concluded)

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

0

A

C

(b )

0 d

d

D

d

0

dd

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

A

C

(a )

1d

d

D

d

d

1 1

1 d

1 d

0

0 d

Figure 3.26 Use of don’t cares for SOP and POS forms.

MSOP MPOS

f(A,B,C,D) = A + BD + BC; f(A,B,C,D) = (A + B)(A + C + D)

Page 78: CT455: Computer Organization K-Map. Lecture 5: Karnaugh Maps  Function Simplification Function Simplification Function Simplification  Algebraic Simplification

End of fileEnd of file