The University of Texas at Arlington Algebraic...

32
1 The University of Texas at Arlington Algebraic Methods CSE 2340/2140 – Introduction to Digital Logic Dr. Gergely Záruba Bridge from Discrete Structures To describe we use the description tools of “A i ti Th “Axiomatic Theory: Unambiguous definitions Axioms (Postulates) – the starting truths Theorems – the provably correct statements We began acquiring tools of description in Di t St t Discrete Structures Here we acquire more such tools, and put some of the theory in practical perspective Vocabulary is crucial (makes the material simple and makes sure we all talk the same language) 2

Transcript of The University of Texas at Arlington Algebraic...

Page 1: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

1

The University of Texas at Arlington

Algebraic Methods

CSE 2340/2140 – Introduction to Digital LogicDr. Gergely Záruba

Bridge from Discrete Structures

• To describe we use the description tools of “A i ti Th ”“Axiomatic Theory”:• Unambiguous definitions

• Axioms (Postulates) – the starting truths

• Theorems – the provably correct statements

• We began acquiring tools of description in Di t St tDiscrete Structures

• Here we acquire more such tools, and put some of the theory in practical perspective

• Vocabulary is crucial (makes the material simple and makes sure we all talk the same language)

2

Page 2: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

2

Homework #1

• Homework #1:Due 02/08/2011 3:40pm CST hardcopy with your• Due 02/08/2011 3:40pm CST, hardcopy with your name, your id number, and page numbers on every page, stapled. Make it readable and neat; its cleanliness reflects on you.

• Problems 2.2 and 2.6 from textbook (pg. 166, 167)

3

Homework #LW-1

• Homework #LW-1:Due 02/08/2010 3:30pm CST• Due 02/08/2010 3:30pm CST.

• Complete the 4th chapter tutorial in the LogicWorks 5 textbook

• Send final file to [email protected] (only softcopy), make sure your name and student id are included in the email.

4

Page 3: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

3

BOOLEAN ALGEBRA

5

A Model to Represent Logic

• We need a model that can be used to t l i l th ht drepresent logical thought and reason.

• George Bool (1849) has come up with an abstract algebraic structure that has been used since. This includes:• A set of postulatesA set of postulates

• A set of theorems (or rules)

6

Page 4: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

4

Boolean Algebra Postulate-1

• Defintion:• Boolean algebra is a closed algebraic system,

containing a set of K (two or more) elements and two operators * and +

• It is closed as any element a in K and b in K, the “sum or OR” (a+b) and the “product or AND” ( b) b th ill b l t KAND” ( a*b) both will belong to K

• Precedence is given to the * operator

7

Boolean Algebra Postulate-2

• Existence of 1 and 0 elements• There exist unique elements 1 and 0 such

that :• a + 0 = a

• a * 1 = a

• We call 0 the identity element for the OR ti d 1 th id tit l t f thoperation and 1 the identity element for the

AND operation

8

Page 5: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

5

Boolean Algebra Postulate -3

• Commutativity of the operators:• For a,bK:

• a + b = b + a

• a * b = b * a

9

Boolean Algebra Postulate -4

• Associativity of the operators:• For a,b,cK:

• a + (b +c) = (a + b) + c

• a * (b * c) = (a * b) * c

10

Page 6: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

6

Boolean Algebra Postulate -5

• Distributivity of the + over * and * over +:• For a,b,cK:

• a + (b * c) = (a + b) * (a + c)

• a * (b + c) = (a * b) + (a * c)

11

Boolean Algebra Postulate -6

• Existence of the complement:• For aK, there exists an āK such that:

• a + ā = 1

• a * ā = 0

12

Page 7: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

7

Venn Diagrams for Visualization

• E.g., a+b

Ka b

• Could be used to visualize more than 2 variables

• Could be used to visualize the postulates13

The Principle of Duality

• If an expression is valid then the dual of th t i i l lidthat expression is also valid

• The dual can be found by swapping all operators against their counterparts (i.e., + with * and vice versa) and by swapping the identity elements with each other (i.e., 1 byidentity elements with each other (i.e., 1 by 0 and vice versa)• E.g.,: the dual of (a+b)(a+c) is (ab+ac)

• The following theories are numbered arbitrarily so theory-1 is not going to be called theory-1 by other textbooks…

14

Page 8: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

8

Boolean Algebra Theorem -1

• Idempotency:• a + a = a

• a * a = a

(notice that they are duals so it is enough to prove one of them)p )

15

Boolean Algebra Theorem -2

• Null elements:• a + 1 = 1

• a * 0 = 0

(notice that they are duals so it is enough to prove one of them)p )

16

Page 9: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

9

Boolean Algebra Theorem -3

• Involution:• = aa

17

Boolean Algebra Theorem -4

• Absorption:• a + ab = a

• a * (a+b) = a

(notice that they are duals so it is enough to prove one of them)p )

18

Page 10: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

10

Boolean Algebra Theorem -5

• Absorption-2:• a + āb = a+b

• a * (ā+b) = ab

(notice that they are duals so it is enough to prove one of them)p )

19

Boolean Algebra Theorem -6

• Absorption-3:• ab + āb = b

• (a+b) * (ā+b) = b

(notice that they are duals so it is enough to prove one of them)p )

20

Page 11: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

11

Boolean Algebra Theorem -7

• Absorption-4:• ab + ābc = ab + bc

• (a + b) * (ā + b + c) = (a + b) (b + c)

(notice that they are duals so it is enough to prove one of them)p )

21

Boolean Algebra Theorem -8

• DeMorgan Theorems:•

(notice that they are duals so it is enough to

a + b = a * b

a * b = a + b

( y gprove one of them)

They can be generalized for an arbitrary (but fininte) number of variables

22

Page 12: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

12

Boolean Algebra Theorem -9

• Consensus:• ab + āc +bc = ab + āc

• (a + b) * (ā + c) * (b + c) = (a + b) (ā + c)

(notice that they are duals so it is enough to prove one of them)p )

23

Boolean Algebra Theorem -10

• Shanon’s Expansion:• f(x1,x2,…,xn)=x1f(1,x2,…,xn)+x1f(0,x2,…,xn)

• f(x1,x2,…,xn)=[x1+f(0,x2,…,xn)]+[x1+f(1,x2,…,xn)]

(notice that they are duals)

24

Page 13: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

13

Boolean Algebra – Cheat Sheet

25Textbook Table 2.2 (pg. 91)

SWITCHING ALGEBRA/FUNCTIONSSWITCHING ALGEBRA/FUNCTIONS

26

Page 14: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

14

From Boolean Algebra to Switching Algebra

• For switching algebra, we specify K to contain exactly two elements K={0 1}exactly two elements K={0,1}

• We can refer to these values as {false,true}, or {low,high} as well.

• (In general capital letters represent variables and small letters represent values that they take, i e X vs x )i.e., X1 vs. x1)

27

Number of Switching Functions

• A function f(X1, X2, .., Xn) has n variables. Since each of these variables can take one of exactlyeach of these variables can take one of exactly two values, there are 2n different ways variables can be assigned to functions.

• Since each(!) one of those assignments can result in two possible outcomes, there are 22n

different switching functionsdifferent switching functions

• For n=0, there are two functions: f0=0 and f1=1

• For n=1, there are four functions f(A): f0(A)=0, f1(A)=A, f2(A)=A, and f0(A)=1

28

Page 15: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

15

Switching Functions for n=2

• There are thus 16 two-variable switching functions f (A B) to f (A B)functions, f0(A,B) to f15(A,B)

A B f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15

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

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

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

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

• Any two variable function can be reduced to one of these

• Note: f8 is AND, f14 is OR, f6 is XOR, f7 is NAND, and f1 is NOR

29

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

Truth Tables

• Previous slide contains 16 truth tables in one. This is still doable for n=2. For n=3, there are a total of 256 differentdoable for n 2. For n 3, there are a total of 256 different switching functions, 65536 for n=4, ~4.29B for n=5, and ~1.16*1077 for n=8 (the number of atoms in the observable universe is about 1080)

• A truth table has four sections:ABC f(A,B,C)=AB+AC

30

000 0001 0010 0011 0100 0101 1110 1111 1

Page 16: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

16

Algebraic Forms

• The same switching function can be given in many ways There are some forms that are moremany ways. There are some forms that are more desirable

• SOP form (Sum of Products), the OR-ing of several AND-ed literals (uncomplemented or complemented variables)• E g f(A B C D)=ABC+DC+ACD (true heavy)• E.g., f(A,B,C,D)=ABC+DC+ACD (true heavy)

• POS form (Product of Sums)• E.g., f(A,B,C,D,E) =(A+E)(C+D+E)(B+D) (false heavy)

31

Algebraic Forms: Canonical SOP

• If a product (AND) contains all variables of the function in either complemented or uncomplemented form then this product is called a

a.k.a. disjunctive normal form

minterm

• A canonical SOP is a form where all products are minterms• E.g., f(A,B,C) = ABC + ABC + ABC + ABC

• If we looked at the literals as a n-bit binary code (n is the number of variables in the function) and assigned 0 to a literal if it is complemented and 1 otherwise, then each of the minterms could be uniquely numbered.• E.g., ABC would be 001 and thus minterm-1 or m1

• E.g., ABC would be 101 and thus minterm-5 or m5

• Thus the above f(A,B,C) = m1+m2+m5+m7 = m(1,2,5,7) (Note, that this is a notation only!)

• The order of the variables in this notation becomes important; the minterms for f(A,B,C) and f(B,A,C) are not the same 32

Page 17: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

17

Algebraic Forms: Canonical POS

• If a product (OR) contains all variables of the function in either complemented or uncomplemented form then this product is called a

a.k.a. conjunctive normal form

maxterm

• A canonical POS is a form where all products are maxterms• E.g., f(A,B,C) = (A+B+C) (A+B+C) (A+B+C) (A+B+C)

• If we looked at the literals as a n-bit binary code (n is the number of variables in the function) and assigned 1 to a literal if it is complemented and 0 otherwise(!!!), then each of the minterms could be uniquely numbered.• E.g., (A+B+C) would be 110 and thus maxterm-6 or M6

• E.g., (A+B+C) would be 010 and thus maxterm-52or M2

• Thus the above f(A,B,C) = M0 * M2* M5* M6 = M(0,2,5,6) (Note, that this is a notation only!)

• Notice, that order of variables is important again33

Duality of Canonical POS and SOP

• Minterms and maxterms are complements f h thof each other

• i.e., Mi=mi=Mi and mi=Mi=mi

• e.g., if f(A,B,C)= m(1,2,5,7) then

f(A,B,C) = M(1,2,5,7)

• And since f(A,B,C)= m(0,3,4,6) it becomes apparent that in order to convert from canonical SOP to POS (or vice versa) the complementing min/maxterms need to be used. 34

Page 18: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

18

So, How Do We Obtain Canonical SOP Forms?

• Recall Shanon’s expansion theorem (T10)• f(x1,x2,…,xn)=x1f(1,x2,…,xn)+x1f(0,x2,…,xn)

• This can be used one after the other for all variables to obtain canonical SOP

• Alternatively Theory-6 could be used• ab+ab=a use this for each product notab ab a use this for each product not

containing a variable• How about canonical POS? Same tricks could be used (b

versions of theories) or just use the duality rule by finding canonical SOP first.

35

Incompletely Specified Functions

• In real life, many times, functions do need to be true for some minterms, do need to be false for some others, butsome minterms, do need to be false for some others, but there may be some minterms for which the designer does not care (don’t care) if the function is false or not.

• For example if we know that some input combinations will never happen (e.g., BCD input) or if for some input combination it really does not matter what the output is.

• In canonical SOP we can represent don’t care minterms• In canonical SOP we can represent don t care minterms as di instead of mi. In canonical POS we can use Di.• E.g., a function working on BCD input could be:

f(A,B,C,D) = m(0,2,4,6,8)+d(10,11,12,13,14,15)

• Don’t cares can actually be helpful when minimizing functions (to make them as simple as possible). 36

Page 19: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

19

Simplifying Switching Functions

• Normal forms (POS,SOP, and cannonicals) are not necessarily the simplest forms of a function.

• E.g., f(A,B,C,D)=ABC+D= m(1,3,5,7,9,11,13,14,15)• Former requires one 3-input AND and one 2-input OR gates, latter

requires nine 4-input AND and one 9-input OR gates.

• If we want our function to be realized with the least amount of logic gates, then we need to reduce the number of operators and the number of inputs to those operators.

• Having said that in order to simplify (or minimize) switching• Having said that, in order to simplify (or minimize) switching functions we usually (but not always) first put them in canonical SOP

• We can then use switching algebra (or Boolean algebra) to try to reduce them. This is cumbersome and requires a lot of experience. It is also not easily automated.

• Would be nice to have some simple methods…37

KARNAUGH MAPS

38

Page 20: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

20

The Need for Karnaugh Maps

• Is a semi-systematic way to reduce switching functions

• Can be used to up to five (becomes somewhat tricky)• Can be used to up to five (becomes somewhat tricky) maybe six (becomes really tricky) variable switching functions

• Recall Theory-6: ab+ab=a • This is the best way to reduce functions

• Thus, if we could organize minterms, so that the ones differing in just a single literal (complemented vsdiffering in just a single literal (complemented vs. uncomplemnted) would be placed next to each other then these two could be simplified

• E.g., f(A,B,C)=ABC+ABC=BC = m7+m3

• How could we graphically put adjacent minterms next to each other?

39

Two/Three Variable K-Maps

• Organizing minterms into such a map is h t t i ht f d f llsomewhat straight forward for small n-s

m0 m2

m1 m3

BA

0 1

0

1

40

m0 m2 m6 m4

m1 m3 m7 m5

CAB

00 01 11 10

0

1

Note, that m4 and m0 are adjacentAnd that m5 and m1 are adjacent as well

Page 21: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

21

Four Variable K-Map

• Graph theory indicates we can still do this f f i blfor four variables

m0 m4 m12 m8

m1 m5 m13 m9

CDAB

00 01 11 10

00

01

Adjacencies wrap around borders!

Where are the white arrows?

41

m3 m7 m15 m11

m2 m6 m14 m10

11

10Order has to be learned,not really straight forward

Five Variable K-Map

• Graph theory indicates we can’t really do this so it becomes tricky we need two tables f(A B C D E)becomes tricky – we need two tables f(A,B,C,D,E)

m0 m4 m12 m8

m1 m5 m13 m9

DEBC

00 01 11 10

00

01

m16 m20 m28 m24

m17 m21 m29 m25

DEBC

00 01 11 10

00

01

42

m3 m7 m15 m11

m2 m6 m14 m10

11

10

m19 m23 m31 m27

m18 m22 m30 m26

11

10

A=0 A=1

What are those adjacencies again?

Page 22: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

22

Mahoney Maps

• Can we rearrange the variables so there is th d t th d ?more method to the madness?

m0 m1 m5 m4

m2 m3 m7 m6

ACBD

00 01 11 10

00

01Adjacencies wrap around borders!

43

m10 m11 m15 m14

m8 m9 m13 m12

11

10

Order is somewhat simpler

So How Do We Plot Switching Functions?

• E.g., f(A,B,C,D)= m(0,2,4,6,8,12)

m0 1 m4 1 m12 1 m8 1

m1 0 m5 0 m13 0 m9 0

CDAB

00 01 11 10

00

01

44

m3 0 m7 0 m15 0 m11 0

m2 1 m6 1 m14 0 m10 0

11

10

Page 23: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

23

Minterm and Maxterm K-Maps

• E.g., f(A,B,C,D)= m(0,2,4,6,8,12)

m0 1 m4 1 m12 1 m8 1

m1 m5 m13 m9

CDAB

00 01 11 10

00

01

11

m0 m4 m12 m8

m1 0 m5 0 m13 0 m9 0

0 0 0 0

CDAB

00 01 11 10

00

01

11

MINTERM MAXTERM

45

m3 m7 m15 m11

m2 1 m6 1 m14 m10

11

10

m3 0 m7 0 m15 0 m11 0

m2 m6 m14 0 m10 0

11

10

• E.g., f(A,B,C,D)= M(1,3,5,7,9,10,1113,14,15)

Why Did We Do This Again?

• SIMPLIFICATION!

• So, how do we simplify?

• We look for representatives of T6 by circling 1-s next to each other. Pairs work, 4-neighbors work (if they are either in line or in box) 8-neighbors work 16-neighborsor in box), 8-neighbors work, 16-neighbors work, etc.

46

Page 24: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

24

K-Map Based Simplification

• We need to find groups (implicants) that cover the entire mapthe entire map.

m0 1 m4 1 m12 1 m8 1

m1 m5 m13 m9

CDAB

00 01 11 10

00

01

11

F(A,B,C,D)=CD+ACD

Some terms:•Implicant•Prime implicant•Essential prime implicant

47

m3 m7 m15 m11

m2 1 m6 1 m14 m10

11

10

•Cover

K-Map Based Simplification

• We need to find groups (implicants) that cover the entire mapthe entire map.

m0 1 m4 1 m12 1 m8 1

m1 m5 m13 m9

CDAB

00 01 11 10

00

01

11

F(A,B,C,D)=AD+CAD

Some terms:•Implicant•Prime implicant•Essential prime implicant

48

m3 m7 m15 m11

m2 1 m6 1 m14 m10

11

10

•Cover

Page 25: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

25

K-Map Based Simplification

• We need to find groups (implicants) that cover the entire mapthe entire map.

m0 1 m4 1 m12 1 m8 1

m1 m5 m13 m9

CDAB

00 01 11 10

00

01

11

F(A,B,C,D)=AD+CD

Some terms:•Implicant•Prime implicant•Essential prime implicant

49

m3 m7 m15 m11

m2 1 m6 1 m14 m10

11

10

•Cover

Algorithm-1 for Finding the Best Cover

1. Count the adjacencies for each minterm

2 S l t d i t ith l t2. Select an uncovered minterm with lowest adjacency number (if several are the same, pick randomly)

3. Check which prime implicant covers most other uncovered minterms and select that.

4 G t 24. Go to 2

• Is this optimal? We are making random choices, how can we be sure?

50

Page 26: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

26

Algorithm-2 for Finding the Best Cover

1. Circle all prime implicants

2 S l t ll ti l i i li t2. Select all essential prime implicants

3. Select the minimum cover from the remaining prime implicants to finish the cover

• Is this optimal? Step three is still random…

• How could we make it optimal? – An exhaustive search on step-3 would make this algorithm optimal. This is expensive.

51

How about POS Forms?

• Terminology is different: instead of i li t h i li timplicant we have implicate

• We can do the same operations over zeros.

• When writing the POS form – keep in mind that variables need to be complementedthat variables need to be complemented

• It is just easier to to do the complemented function using SOP form and apply DeMorgan

52

Page 27: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

27

Incomplete Functions

• If the function is incomplete then we can d id t i l d i d ’tdecide to include or ignore don’t cares.

• We include them only if they make a prime implicant larger.

• For example:• f(A B C D)= m(2 4 5 6 8 10)+d(7 9 12 13 14)• f(A,B,C,D)= m(2,4,5,6,8,10)+d(7,9,12,13,14)

= M(0,1,3,11,16)+D(7,9,12,13,14)

• Note that the two minimizations may not result in equivalent functions!

53

QUINE-MCCLUSKY TABULAR METHOD

54

Page 28: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

28

Quine-McCluskey Method

• Systematic method (can be easily computerized)computerized)

• Minterms are written up in a table (n-variable minterms). Based on this (n-1)-variable implicants are identified. Based on this (n-2) variable implicants are identified – and so on.

• Then we identify essential prime implicants, and prime implicants. The cover is based on these.

55

Q-M Method – Step-1

• Step 1. Write all minterms in a two column table; organize minterms in groups based on how many 1-sorganize minterms in groups based on how many 1 s they have (not neccesarily the minterm order)

• E.g, f(A,B,C,D)= m(0,1,2,4,5,7,10,12,14)

Minterm # ABCD

0 0000 Group-0

1 0001

2 0010 Group-1

56

2 0010 Group 1

4 0100

5 0101

10 1010 Group-2

12 1100

7 0111 Group-3

14 1110

Page 29: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

29

Q-M Method – Step-2

• Do an exhaustive search between adjacent groups to see if minterms can be combined; repeat this for the new columns as wellminterms can be combined; repeat this for the new columns as well.

List-1 List-2 List-3

Minterm ABCD Minterms ABCD Minterms ABCD

0 0000 √ 0,1 000- √ 0,4,1,5 0-0-

1 0001 √ 0,2 00-0

2 0010 √ 0,4 0-00 √

4 0100 √ 1,5 0-01 √

-’s have to be in the same place and they can

57

5 0101 √ 2,10 -010

10 1010 √ 4,5 010- √

12 1100 √ 4,12 -100

7 0111 √ 5,7 01-1

14 1110 √ 10,14 1-10

12,14 11-0

and they can differ in only one

digit

Q-M Method – Step-2

• Do an exhaustive search between adjacent groups to see if minterms can be combined; repeat this for the new columns as wellminterms can be combined; repeat this for the new columns as well.

List-1 List-2 List-3

Minterm ABCD Minterms ABCD Minterms ABCD

0 0000 √ 0,1 000- PI2 0,4,1,5 0-0- PI11 0001 √ 0,2 00-0 PI32 0010 √ 0,4 0-00 √

4 0100 √ 1,5 0-01 √

List-1 List-2 List-3

Minterm ABCD Minterms ABCD Minterms ABCD

0 0000 √ 0,1 000- √ 0,4,1,5 0-0- PI11 0001 √ 0,2 00-0 PI22 0010 √ 0,4 0-00 √

4 0100 √ 1,5 0-01 √

58

5 0101 √ 2,10 -010 PI410 1010 √ 5,7 01-1 PI512 1100 √ 10,14 1-10 PI67 0111 √ 12,14 11-0 PI714 1110 √

5 0101 √ 2,10 -010 PI310 1010 √ 4,5 010- √

12 1100 √ 4,12 -100 PI47 0111 √ 5,7 01-1 PI514 1110 √ 10,14 1-10 PI6

12,14 11-0 PI7

Page 30: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

30

Q-M Method Step-3

• Now need to find a minimum cover. For that we need to create another “cross reference table”.create another cross reference table .

0 1 2 4 5 7 10 12 14

PI1 X X X X

PI2 X X

PI3 X X

Separating Pis with different

59

3

PI4 X X

PI5 X X

PI6 X X

PI7 X X

number of implicants

Q-M Method Step-4

• Identify essential prime implicants (minterm is only covered by them). They need to be chosen.covered by them). They need to be chosen.

√ √ √ √ √

0 1 2 4 5 7 10 12 14

**PI1 X X X

PI2 X X

PI3 X X

60

3

PI4 X X

**PI5 X

PI6 X X

PI7 X X

Page 31: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

31

Q-M Method Step-4.2

• Select PIs to finish cover; (remove essentials and their minterms for more visibility).( y)

2 10 12 14

PI2 X

PI3 X X

PI4 X

√ √ √ √ √

0 1 2 4 5 7 10 12 14

**PI1 X X X

PI2 X X

PI3 X X

PI4 X X

**PI5 X

• But even then, how to choose?

61

PI6 X X

PI7 X X

5

PI6 X X

PI7 X X

Q-M Method Step-4.2

√ √ √ √

2 10 12 14

√ √ √ √ √

0 1 2 4 5 7 10 12 14

**PI X X X

PI2 X

*PI3 X X

PI4 X

PI6 X X

*PI7 X XList-1 List-2 List-3

Minterm ABCD Minterms ABCD Minterms ABCD

**PI1 X X X

PI2 X X

PI3 X X

PI4 X X

**PI5 X

PI6 X X

PI7 X X

Thus, PI1,PI3,PI5,PI7f(A,B,C,D)= AC+BCD+ABD+ABD

62

0 0000 √ 0,1 000- √ 0,4,1,5 0-0- PI11 0001 √ 0,2 00-0 PI22 0010 √ 0,4 0-00 √

4 0100 √ 1,5 0-01 √

5 0101 √ 2,10 -010 PI3

10 1010 √ 4,5 010- √

12 1100 √ 4,12 -100 PI47 0111 √ 5,7 01-1 PI5

14 1110 √ 10,14 1-10 PI612,14 11-0 PI7

Cyclic chart

Page 32: The University of Texas at Arlington Algebraic Methodscrystal.uta.edu/~zaruba/CSE2340/lecture_notes/Lecture-2-Algebraic... · Boolean Algebra Postulate-1 • Defintion: • Boolean

32

How About Q-M and Incomplete Functions?

• Same first and second steps, handling d’s if th ’as if they were m’s

• In step three do not create columns for d’s

63

What if We have Multiple Outputs?

• If we have multiple outputs (more than one function), we could benefit from shared implicants.could benefit from shared implicants.

• We can extend the Q-M tables to include more functions. We just need one more column for the lists that indicates in which function they are used.

• For step 2: terms can only be combined if they have a common flag (and the combination can carry only those)

For step 3: each function should be represented by• For step 3: each function should be represented by columns of those minterms that they have PIs for.

64