45
CSE140: Components and Design Techniques CSE140: Components and Design Techniques for Digital Systems Simplification of logic functions Tajana Simunic Rosing Sources: TSR, Katz, Boriello & Vahid 1

CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Embed Size (px)

Citation preview

Page 1: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

CSE140: Components and Design Techniques CSE140: Components and Design Techniques for Digital Systems

Simplification of logic functions

Tajana Simunic Rosing

Sources: TSR, Katz, Boriello & Vahid

1

Page 2: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Where we are now…• What we covered thus far:

– Number representationsp• Binary, Octal, Hex, 1s & 2s complement• Addition, subtraction, multiplication, division in binary

– Boolean algebraBoolean algebra– Switches, MOS transistors, Delay

Wh t i t• What is next:– Review of CMOS transistors and gates– Logic simplificationg p

Sources: TSR, Katz, Boriello & Vahid

2

Page 3: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Making CMOS gatesg g

Sources: TSR, Katz, Boriello & Vahid

3

Page 4: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

CMOS Examplep

Sources: TSR, Katz, Boriello & Vahid

4

Page 5: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Another examplep

Sources: TSR, Katz, Boriello & Vahid

5

Page 6: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

One more examplep

Sources: TSR, Katz, Boriello & Vahid

6

Page 7: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

CSE140: Components and Design Techniques for Digital Systems

Combinational functionsRepresentations and Simplification

Tajana Simunic Rosing

Sources: TSR, Katz, Boriello & Vahid

7

Sources: Katz, Boriello & Vahid

Page 8: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Logic Design Process: Three 1s Detectorg g• Problem:

– Detect 3 consecutive 1s Step 1: Capture the function

Truth table or equation?in 8-bit input: abcdefgh

• 00011101 • 01111000

Truth table too big: 2^8=256 rowsEquation:

y = abc + bcd + cde + def + efg + fgh

Truth table or equation?

• 10101011

a

a

y = abc + bcd + cde + def + efg + fgh

Step 2: Simplify if desired

bcd

abc

d

abc

d

Step 3: Implement with gates

def

cde

f

ye

f

Sources: TSR, Katz, Boriello & Vahid

8fgh

efgg

h

Page 9: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Canonical Form -- Sum of Minterms• Truth tables are too big for numerous inputs• Use standard form of equation insteadUse standard form of equation instead

– Known as canonical form– Regular algebra: group terms of polynomial by power

2 b (3 2 4 2 2 3 1 5 2 4 4)• ax2 + bx + c (3x2 + 4x + 2x2 + 3 + 1 --> 5x2 + 4x + 4)– Boolean algebra: create a sum of minterms

• Minterm: product term with every literal (e.g. a or a’) appearing tlexactly once

Q: Determine if F(a,b)=ab+a’ is same function as F(a,b)=a’b’+a’b+ab, by converting the first equation to canonical formconverting the first equation to canonical form

Sources: TSR, Katz, Boriello & Vahid

9

Page 10: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Sum-of-products canonical formsp• Also known as disjunctive normal form• Minterm expansion:Minterm expansion:

A B C F F’

F =

F = 001 011 101 110 111

+ A’BC + AB’C + ABC’ + ABCA’B’C

A B C F F’0 0 0 0 10 0 1 1 00 1 0 0 10 1 1 1 01 0 0 0 11 0 1 1 01 1 0 1 01 1 1 1 0 F’ = A’B’C’ + A’BC’ + AB’C’

Sources: TSR, Katz, Boriello & Vahid

10

Page 11: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Sum-of-products canonical form (cont’d)p ( )

• Product minterm– ANDed product of literals – input combination for which output is 1– each variable appears exactly once, true or inverted (but not both)

A B C minterms0 0 0 A’B’C’ m00 0 1 A’B’C m1

F in canonical form:F(A, B, C) = Σm(1,3,5,6,7)

= m1 + m3 + m5 + m6 + m70 1 0 A’BC’ m20 1 1 A’BC m31 0 0 AB’C’ m41 0 1 AB’C m5

= m1 + m3 + m5 + m6 + m7= A’B’C + A’BC + AB’C + ABC’ + ABC

canonical form ≠ minimal form( C) ’ ’C ’ C ’C C C’1 1 0 ABC’ m6

1 1 1 ABC m7

F(A, B, C) = A’B’C + A’BC + AB’C + ABC + ABC’ = (A’B’ + A’B + AB’ + AB)C + ABC’= ((A’ + A)(B’ + B))C + ABC’= C + ABC’

Sources: TSR, Katz, Boriello & Vahid

11

short-hand notation forminterms of 3 variables

= ABC’ + C= AB + C

Page 12: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Product-of-sums canonical form• Also known as conjunctive normal form• Also known as maxterm expansion

F = 000 010 100

Also known as maxterm expansion• Implements “zeros” of a function

A B C F F’0 0 0 0 1

F 000 010 100F = (A + B + C) (A + B’ + C) (A’ + B + C)

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

Sources: TSR, Katz, Boriello & Vahid

12

F’ = (A + B + C’) (A + B’ + C’) (A’ + B + C’) (A’ + B’ + C) (A’ + B’ + C’)

Page 13: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Product-of-sums canonical form (cont’d)( )

• Sum term (or maxterm)( )– ORed sum of literals – input combination for which output is false– each variable appears exactly once, true or inverted (but not both)

A B C maxterms0 0 0 A+B+C M00 0 1 A+B+C’ M10 1 0 A+B’+C M2

F in canonical form:F(A, B, C) = ΠM(0,2,4)

= M0 • M2 • M40 1 0 A+B’+C M20 1 1 A+B’+C’ M31 0 0 A’+B+C M41 0 1 A’+B+C’ M5

= (A + B + C) (A + B’ + C) (A’ + B + C)

canonical form ≠ minimal formF(A, B, C) = (A + B + C) (A + B’ + C) (A’ + B + C)

1 1 0 A’+B’+C M61 1 1 A’+B’+C’ M7

short-hand notation for

( , , ) ( ) ( ) ( )= (A + B + C) (A + B’ + C)

(A + B + C) (A’ + B + C)= (A + C) (B + C)

Sources: TSR, Katz, Boriello & Vahid

13

short hand notation formaxterms of 3 variables

Page 14: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

S-o-P, P-o-S, and de Morgan’s theoremg

• Sum-of-products• Sum-of-productsp– F’ = A’B’C’ + A’BC’ + AB’C’

• Apply de Morgan’s– (F’)’ = (A’B’C’ + A’BC’ + AB’C’)’

p– F’ =

• Apply de Morgan’s– (F’)’ =– (F ) = (A B C + A BC + AB C )– F = (A + B + C) (A + B’ + C) (A’ + B + C)– (F ) =– F =

• Product-of-sums– F’ = (A + B + C’) (A + B’ + C’) (A’ + B + C’) (A’ + B’ + C) (A’ + B’ + C’)

• Apply de Morgan’s

• Product-of-sums– F’ =

• Apply de Morgan’s• Apply de Morgan s– (F’)’ = ( (A + B + C’)(A + B’ + C’)(A’ + B + C’)(A’ + B’ + C)(A’ + B’ + C’) )’– F = A’B’C + A’BC + AB’C + ABC’ + ABC

• Apply de Morgan s– (F’)’ =– F =

Sources: TSR, Katz, Boriello & Vahid

14

Page 15: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Mapping between canonical formspp g• Minterm to maxterm conversion

– use maxterms whose indices do not appear in minterm expansion• Minterm to maxterm conversion

– use maxterms whose indices do not appear in minterm expansionpp p– e.g., F(A,B,C) = Σm(1,3,5,6,7)

• Maxterm to minterm conversioni t h i di d t i t i

pp p– e.g., F(A,B,C) = Σm(1,3,5,6,7) = ΠM(0,2,4)

• Maxterm to minterm conversioni t h i di d t i t i– use minterms whose indices do not appear in maxterm expansion

– e.g., F(A,B,C) = ΠM(0,2,4)

• Minterm expansion of F to minterm expansion of F’

– use minterms whose indices do not appear in maxterm expansion– e.g., F(A,B,C) = ΠM(0,2,4) = Σm(1,3,5,6,7)

• Minterm expansion of F to minterm expansion of F’p p– use minterms whose indices do not appear– e.g., F(A,B,C) = Σm(1,3,5,6,7) F’(A,B,C) =

M t i f F t t i f F’

p p– use minterms whose indices do not appear– e.g., F(A,B,C) = Σm(1,3,5,6,7) F’(A,B,C) = Σm(0,2,4)

M t i f F t t i f F’• Maxterm expansion of F to maxterm expansion of F’– use maxterms whose indices do not appear– e.g., F(A,B,C) = ΠM(0,2,4) F’(A,B,C) =

• Maxterm expansion of F to maxterm expansion of F’– use maxterms whose indices do not appear– e.g., F(A,B,C) = ΠM(0,2,4) F’(A,B,C) = ΠM(1,3,5,6,7)

Sources: TSR, Katz, Boriello & Vahid

15

Page 16: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Incompletely specified functionsp y p• Example: binary coded decimal increment by 1

– BCD digits encode the decimal digits 0 – 9

A B C D W X Y Z

g g• Don’t cares and canonical forms

– so far, only represented on-set– also represent don’t-care-set

need two of the three sets (on set off set dc set)0 0 0 0 0 0 0 10 0 0 1 0 0 1 00 0 1 0 0 0 1 10 0 1 1 0 1 0 00 1 0 0 0 1 0 1

off-set of W

on-set of W

– need two of the three sets (on-set, off-set, dc-set)

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

don’t care (DC) set of W

1 0 0 1 0 0 0 01 0 1 0 X X X X1 0 1 1 X X X X1 1 0 0 X X X X1 1 0 1 X X X X

these inputs patterns should never be encountered in practice – "don’t care" about associated

Sources: TSR, Katz, Boriello & Vahid

16

1 1 0 1 X X X X1 1 1 0 X X X X1 1 1 1 X X X X

output values, can be exploitedin minimization

Page 17: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Alternative two-level implementations ofF = AB + C

A

F = AB + C

canonical sum-of-productsF1

B

minimized sum-of-products

C

canonical product-of-sums

F2

minimized product-of-sums

F3

Sources: TSR, Katz, Boriello & Vahid

17

ed p oduct o su sF4

Page 18: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

CSE140: Components and Design Techniques CSE140: Components and Design Techniques for Digital Systems

Logic simplification

Tajana Simunic Rosing

Sources: TSR, Katz, Boriello & Vahid

18

Sources: Katz, Boriello & Vahid

Page 19: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Simplification of two-level combinational logic

• Finding a minimal sum of products or product of sums realizationexploit don’t care information in the process– exploit don t care information in the process

• Algebraic simplification– not a systematic procedure

h d k h th i i li ti h b f d?– how do you know when the minimum realization has been found?

• Computer-aided design tools– precise solutions require very long computation times, especially for

functions with many inputs (> 10)– heuristic methods employed – "educated guesses" to reduce amount of

computation and yield good if not best solutions

H d th d till l t• Hand methods still relevant– to understand automatic tools and their strengths and weaknesses– ability to check results (on small examples)

Sources: TSR, Katz, Boriello & Vahid

19

Page 20: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

The uniting theoremg• Key tool to simplification: A (B’ + B) = A• Essence of simplification of two-level logicEssence of simplification of two level logic

– find two element subsets of the ON-set where only one variable changes its value – this single varying variable can be eliminated and a single product term used to represent both elements

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

and a single product term used to represent both elements

A B F

0 0 1

0 1 0

B has the same value in both on-set rows– B remains

0 1 0

1 0 1

1 1 0 A has a different value in the two rows

Sources: TSR, Katz, Boriello & Vahid

20

– A is eliminated

Page 21: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Boolean cubes• Visual technique for applying the uniting theorem• n input variables = n-dimensional "cube"n input variables n dimensional cube

1-cubeX

0 12-cubeY

11

00

01

10X

00 10

111 11110111

3-cube Y Z 1014-cube

YZ

Sources: TSR, Katz, Boriello & Vahid

21

X000 WX

Z

00001000

Page 22: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Mapping truth tables onto Boolean cubespp g• Uniting theorem combines two “faces" of a cube

into a larger “face"

two faces of size 0 (nodes)

g• Example:

FA B F

0 0 1

0 1 0

two faces of size 0 (nodes) combine into a face of size 1(line)

B

1101

F

0 1 0

1 0 1

1 1 0A

00 10

ON-set = solid nodes

A varies within face, B does notthis face represents the literal B'

Sources: TSR, Katz, Boriello & Vahid

22

OFF-set = empty nodesDC-set = ×'d nodes

Page 23: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Three variable example

(A'+A)BCin

p• Binary full-adder carry-out logic

A B Cin Cout0 0 0 0

(A +A)BCin

AB(Cin'+Cin)111

0 0 1 00 1 0 00 1 1 11 0 0 0

B C 1011 0 0 01 0 1 11 1 0 11 1 1 1

A(B+B')Cin

the on-set is completely covered by th bi ti (OR) f th b b

A000

the combination (OR) of the subcubes of lower dimensionality - note that “111”is covered three times

Sources: TSR, Katz, Boriello & Vahid

23

Cout = BCin+AB+ACin

Page 24: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Higher dimensional cubesg• Sub-cubes of higher dimension than 2

F(A,B,C) = Σm(4,5,6,7)

on et fo m q e be of dimen ion 2

111

010

011110

on-set forms a square - a cube of dimension 2

A

B C

000

101

100

001

010

This subcube represents theliteral A

A000

• In a 3-cube (three variables):– a 0-cube, i.e., a single node, yields a term in 3 literals– a 1-cube, i.e., a line of two nodes, yields a term in 2 literals– a 2-cube, i.e., a plane of four nodes, yields a term in 1 literal

3 b i b f i ht d i ld t t t "1"

Sources: TSR, Katz, Boriello & Vahid

24

– a 3-cube, i.e., a cube of eight nodes, yields a constant term "1"• In general,

– an m-subcube within an n-cube (m < n) yields a term with n – m literals

Page 25: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Karnaugh mapsg p• Flat map of Boolean cube

– wrap–around at edgesp g– hard to draw and visualize for more than 4 dimensions– virtually impossible for more than 6 dimensions

Alternati e to tr th tables to help is ali e adjacencies• Alternative to truth-tables to help visualize adjacencies– guide to applying the uniting theorem– on-set elements with only one variable changing value are

A B F

adjacent unlike the situation in a linear truth-table

A0 0 1

0 1 0

1 0 10 2

0 1A

B0

1

1

0 0

1

Sources: TSR, Katz, Boriello & Vahid

251 1 0

1 30 0

Page 26: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Karnaugh maps (cont’d)g p ( )• Numbering scheme based on Gray–code

– e.g., 00, 01, 11, 10g , , , ,– only a single bit changes in code for adjacent map cells

0 2

00 01AB

C0

6 4

11 10A

A

1 31

7 5C

B

0 4

1 5

12 8

13 9 D

3 7 15 11

0 2

1 3

6 4

7 5C

A 3 7

2 6

15 11

14 10C

B 13 = 1101= ABC’D

Sources: TSR, Katz, Boriello & Vahid

26

1 3 7 5B

Page 27: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Adjacencies in Karnaugh mapsj g p• Wrap from first to last column• Wrap top row to bottom rowWrap top row to bottom row

A111011

110000 010

001 011

110 100

111 101C

B

B C

000

101

100

001

010110

BA000 100

Sources: TSR, Katz, Boriello & Vahid

27

Page 28: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Karnaugh map examplesg p p• F = 1 1

0 0B

A

• Cout =0 0 1 0

A

• f(A B C) = Σm(0 4 5 7)

0 1 1 1Cin

B

• f(A,B,C) = Σm(0,4,5,7)

AB A

1 0

0 0

0 1

1 1C

A

0 2

00 01AB

C0

16 4

11 10

C

A

Sources: TSR, Katz, Boriello & Vahid

28

0 0 1 1C

B1 3

17 5

C

B

Page 29: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

More Karnaugh map examplesg p p

0 0 1 1

A0 0

0 0

1 1

1 1C

B

F(A,B,C) = Σm(0,4,5,7)1 0

0 0

0 1

1 1C

A

0 0 1 1C

B

A

F'(A,B,C) = ΣF' simply replace 1's with 0's and vice versa0 1

1 1

1 0

0 0C

B

Sources: TSR, Katz, Boriello & Vahid

29

B

Page 30: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Karnaugh map: 4-variable exampleg p p

• F(A,B,C,D) = Σm(0,2,3,5,6,7,8,10,11,14,15)

F =

A 11110111

1 0

0 1

0 1

0 0D

AB

CD

00001000

0 1 0 0

1 1

1 1

1 1

1 1C

find the smallest number of the largest possible subcubes to cover the ON-set

B

Sources: TSR, Katz, Boriello & Vahid

30

(fewer terms with fewer inputs per term)

Page 31: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Karnaugh maps: don’t caresg p• f(A,B,C,D) = Σ m(1,3,5,7,9) + d(6,12,13)

without don't cares with don’t careswithout don t cares with don t caresf = f =

0 0

1 1

X 0

X 1

A

0 0 X 0

A

1 1 X 1D

1 1

0 X

0 0

0 0C

1 1 X 1D

1 1

0 X

0 0

0 0C

0 X 0 0

B0 X 0 0

B

don't cares can be treated as 1s or 0s

Sources: TSR, Katz, Boriello & Vahid

31

don t cares can be treated as 1s or 0sdepending on which is more advantageous

Page 32: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Examplep• F = Σ m(0, 2, 7, 8, 14, 15) + d(3, 6, 9, 12, 13)

1 0 X 1

A 1 0 X 1

A

1 0

0 0

X 1

X X

X 1 1 0

D

0 0 X X

X 1 1 0

0

D

C

1 X 1 0

B

C 1 X 1 0

B

1 0 X 1

A

0 0 X X

X 1 1 0

D

C

Sources: TSR, Katz, Boriello & Vahid

321 X 1 0

B

C

Page 33: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Design example: two-bit comparatorg p p

A B C D LT EQ GT0 0 0 0 0 1 0

LTEQ

A B < C DA B = C D

ABC

N1

0 0 0 0 0 1 00 1 1 0 01 0 1 0 01 1 1 0 0

0 1 0 0 0 0 10 1 0 1 0

GT A B > C DCDN2

0 1 0 1 01 0 1 0 01 1 1 0 0

1 0 0 0 0 0 10 1 0 0 11 0 0 1 0

block diagram

1 0 0 1 01 1 1 0 0

1 1 0 0 0 0 10 1 0 0 11 0 0 0 1

0 0

andtruth table

we'll need a 4-variable Karnaugh map f h f th 3 t t f ti

1 1 0 1 0truth table

Sources: TSR, Katz, Boriello & Vahid

33

for each of the 3 output functions

Page 34: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Design example: two-bit comparator (cont’d)g p p ( )

A A A

0 0

1 0

0 0

0 0D

1 0

0 1

0 0

0 0D

0 1

0 0

1 1

1 1D

1 1

1 1

0 1

0 0

B

C0 0

0 0

1 0

0 1

B

C0 0

0 0

0 0

1 0

B

C

K-map for EQK-map for LT K-map for GT

B B B

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

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

LT =

EQ =

GT =

= (A xnor C) • (B xnor D)A' B' C' D' + A' B C' D + A B C D + A B' C D’

Sources: TSR, Katz, Boriello & Vahid

34

B C D A C A B DGT

LT and GT are similar (flip A/C and B/D)

Page 35: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Design example: 2x2-bit multiplier

A2 A1 B2 B1 P8 P4 P2 P1

g p p

0 0 0 0 0 0 0 00 1 0 0 0 01 0 0 0 0 01 1 0 0 0 0

0 1 0 0 0 0 0 0P1A1 0 1 0 0 0 0 0 00 1 0 0 0 11 0 0 0 1 01 1 0 0 1 1

1 0 0 0 0 0 0 00 1 0 0 1 0

P2P4P8

A2B1B2

block diagramand

0 1 0 0 1 01 0 0 1 0 01 1 0 1 1 0

1 1 0 0 0 0 0 00 1 0 0 1 11 0 0 1 1 0and

truth table

4-variable K-mapfor each of the 4

1 0 0 1 1 01 1 1 0 0 1

Sources: TSR, Katz, Boriello & Vahid

35

for each of the 4output functions

Page 36: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Design example: 2x2-bit multiplier (cont’d)

K-map for P8 K-map for P4

g p p ( )

0 0 0 0

A2

0 0 0 0

A2

0 0 0 0B1

0 0 0 1

0 0 0 0B1

0 0 1 0

0 0 1 1

A1

B20 0 0 0

A1

B2

K-map for P2 K-map for P1 0 0

0 1

0 0

1 0B1

A2

0 0

0 0

0 0

1 1B1

A2

B10 1

0 0

1 0

0 0B2

B10 1

0 1

0 1

1 0B2

Sources: TSR, Katz, Boriello & Vahid

36

A1A1

Page 37: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Design example: BCD + 1

I8 I4 I2 I1 O8 O4 O2 O1

g p

I8 I4 I2 I1 O8 O4 O2 O10 0 0 0 0 0 0 10 0 0 1 0 0 1 00 0 1 0 0 0 1 10 0 1 1 0 1 0 00 1 0 0 0 1 0 1O1I1 0 1 0 0 0 1 0 10 1 0 1 0 1 1 00 1 1 0 0 1 1 10 1 1 1 1 0 0 01 0 0 0 1 0 0 11 0 0 1 0 0 0 0

O1O2O4O8

I1I2I4I8 1 0 0 1 0 0 0 0

1 0 1 0 X X X X1 0 1 1 X X X X1 1 0 0 X X X X1 1 0 1 X X X X1 1 1 0 X X X Xblock diagram

O8I8

1 1 1 0 X X X X1 1 1 1 X X X X

block diagramand

truth table4-variable K-map for each of

the 4 output functions

Sources: TSR, Katz, Boriello & Vahid

37

the 4 output functions

Page 38: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Design example: BCD + 1 (cont’d)

O8 O4

g p ( )

0 0 X 1

I8

0 1 X 0

I8O4

0 0

0 0

X 1

X 0I1

0 1 X X

0 1

0 1

X 0

X 0I1

1 0 X X0 1

0 0

X X

X X

I4

I21 0

0 1

X X

X X

I4

I2

O2 O10 0

1 1

X 0

X 0

I8

1 1

0 0

X 1

X 0

I8

1 1 X 0I1

0 0

1 1

X X

X XI2

0 0 X 0I1

0 0

1 1

X X

X XI2

Sources: TSR, Katz, Boriello & Vahid

38

1 1 X X

I41 1 X X

I4

Page 39: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Algorithms for simplification & logic realizationg p g

• Simplification– two-level simplification– exploiting don’t cares

• Logic realizationg– two-level logic and canonical forms realized with NANDs and NORs– multi-level logic, converting between ANDs and ORs

Sources: TSR, Katz, Boriello & Vahid

39

Page 40: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Definition of terms for two-level simplificationp

• Implicant– single element of ON-set or DC-set or any group of these elements that

can be combined to form a subcube• Prime implicant

– implicant that can't be combined with another to form a larger subcube• Essential prime implicant

– prime implicant is essential if it alone covers an element of ON-set– will participate in ALL possible covers of the ON-set– DC-set used to form prime implicants but not to make implicant essential

• Objective:– grow implicant into prime implicants

(minimize literals per term)– cover the ON-set with as few prime implicants as possible

(minimize number of product terms)

Sources: TSR, Katz, Boriello & Vahid

40

( p )

Page 41: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Examples to illustrate termsp

6 prime implicants:0 X 1 0

A6 prime implicants:

A'B'D, BC', AC, A'C'D, AB, B'CD

essential

0 X

1 1

1 0

1 0D

1 0 1 1

minimum cover: AC + BC' + A'B'D

1 0

0 0

1 1

1 1

B

C

5 prime implicants:BD, ABC', ACD, A'BC, A'C'D

0 0 1 0

A

BD, ABC , ACD, A BC, A C D1 1 1 0

D0 1

0 1

1 1

0 0C

essential

Sources: TSR, Katz, Boriello & Vahid

41

0 1 0 0

Bminimum cover: 4 essential implicants

Page 42: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Algorithm for two-level simplificationg p

• Algorithm: minimum sum-of-products expression from a gKarnaugh map– Step 1: choose an element of the ON-set– Step 2: find "maximal" groupings of 1s and Xs adjacent to that element

• consider top/bottom row, left/right column, and corner adjacencies• this forms prime implicants (number of elements always a power of 2)

– Repeat Steps 1 and 2 to find all prime implicants– Repeat Steps 1 and 2 to find all prime implicants

– Step 3: revisit the 1s in the K-map• if covered by single prime implicant, it is essential, and participates in final cover• 1s covered by essential prime implicant do not need to be revisited

– Step 4: if there remain 1s not covered by essential prime implicants• select the smallest number of prime implicants that cover the remaining 1s

Sources: TSR, Katz, Boriello & Vahid

42

Page 43: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Algorithm for two-level simplification (example)

X 1 0 1

AX 1 0 1

A

X 1 0 1

A

X 1

0 1

0 1

1 1D

0 X X 0

0 1 1 1D

0 X X 0C

0 1 1 1D

0 X X 0C0 X

0 1

X 0

0 1

B

C

2 primes around A'BC'D'

0 1 0 1

B

C

2 primes around ABC'D

0 1 0 1

B

C

X 1

0 1

0 1

1 1

A

X 1

0 1

0 1

1 1

A

X 1

0 1

0 1

1 1

A

X 1

0 1

0 1

1 1

A

D0 X

0 1

X 0

0 1C

D0 X

0 1

X 0

0 1C

D0 X

0 1

X 0

0 1C

D0 X

0 1

X 0

0 1C

Sources: TSR, Katz, Boriello & Vahid

43

B3 primes around AB'C'D' minimum cover (3 primes)

BB2 essential primes

B

Page 44: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Examplep• List all prime implicants for the following K-map:

X 0 X 0

A

X 0 X 0

A

0 1 X 1D

0 X

X 1

X 0

1 1C

0 1 X 1D

0 X

X 1

X 0

1 1C

X 1 1 1

BX 1 1 1

B

• Which are essential prime implicants?

• What is the minimum cover?

Sources: TSR, Katz, Boriello & Vahid

44

• What is the minimum cover?

Page 45: CSE140: Components and Design Techniques for Digital ...cseweb.ucsd.edu/classes/sp08/cse140/lectures/wk2.pdf · for Digital Systems Simplification of logic functions ... create a

Summaryy• What we covered thus far:

– Number representations– Number representations– Switches– MOS transistors

Logic gates– Logic gates– Boolean algebra– Logic representations

SOP and POS– SOP and POS– K-maps– Algorithm for simplification

Sources: TSR, Katz, Boriello & Vahid

45