digital logic design week 4 boolean algebra. laws and rules de morgan’s theorem analysis of logic...

38
Digital Logic Design Week 4 Boolean algebra

Upload: ashlee-walker

Post on 14-Jan-2016

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Digital Logic Design

Week 4

Boolean algebra

Page 2: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Boolean algebra

• Boolean algebra• Laws and rules• De Morgan’s theorem• Analysis of logic circuits• Standard forms• Project 1 preparation

Page 3: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Boolean algebra

George BooleBritish mathematician and philosopher.An Investigation of the Laws of Thought on Which are Founded the Mathematical Theories of Logic and Probabilities (1854)

Claude ShannonAmerican electrical engineer.First to apply Boole’s work to design of logic circuits (1937)

Boolean algebra is the mathematics of digital systems deals with values 0 and 1, and just three operations: addition,

multiplication, and complement

Page 4: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Boolean operations

Boolean addition differs from binary addition! There is no carry in Boolean addition

0 + 0 = 00 + 1 = 11 + 0 = 11 + 1 = 1

0 · 0 = 00 · 1 = 01 · 0 = 01 · 1 = 1

0’ = 11’ = 0

Booleanaddition

Booleanmultiplication Complement

Page 5: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Boolean operations

0 + 0 = 00 + 1 = 11 + 0 = 11 + 1 = 1

0 · 0 = 00 · 1 = 01 · 0 = 01 · 1 = 1

0’ = 11’ = 0

Booleanaddition

Booleanmultiplication Complement

ANDOR NOT

Page 6: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Sums and products

Sum terms are generated by OR gates

Examples of sum terms:A+B A+B’ A+B+C’

Variables are symbols representing Boolean values 0,1 A, B and C are variables

Literals are variables or complement of variables A, B’ and C’ are literals

Page 7: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Sums and products

• Boolean addition is the same as the OR function, so…– sum term is 1 if one or more of the literals are 1– sum term is 0 only if each literal is 0

Example: Determine the values of the variablesA,B,C,D that make the sum term A+B’+C+D’ = 0Literals A, B’, C and D’ must all equal zero if sum=0A = B’ = C = D’ = 0 A=0, B=1, C=0, D=1

Page 8: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Sums and products

Product terms are generated by AND gates

Examples of product terms:AB AB’ ABC’

Example: Determine the values of the variablesA,B,C,D that make the product term AB’CD’ = 1Literals A, B’, C and D’ must all equal 1 if product=1A = B’ = C = D’ = 1 A=1, B=0, C=1, D=0

A

BX

Remember: A·B often written simply as AB

Page 9: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Boolean algebra

• Boolean algebra• Laws and rules• De Morgan’s theorem• Analysis of logic circuits• Standard forms• Project 1 preparation

Page 10: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Commutative laws

For addition: A + B = B + AThe order in which variables are ORed makes no difference

For multiplication: A · B = B · AThe order in which variables are ANDed makes no difference

Page 11: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Associative laws

For addition: A + (B + C) = (A + B) + C

For multiplication: A(BC) = (AB)C

Page 12: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Distributive law

Expresses the process of factoring

A(B + C) = AB + AC

Page 13: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Rules of Boolean algebra Rules 1–9 from definitions of AND, OR and NOT Rules 10–12 derived from simpler rules and three laws

12. (A + B)(A + C) = A + BC

1. A + 0 = A2. A + 1 = 1

3. A · 0 = 0

4. A · 1 = A

5. A + A = A

7. A · A = A

6. A + A = 1

8. A · A = 0

9. A = A=

10. A + AB = A

11. A + AB = A + B

Page 14: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

A couple of the simpler rulesA + 0 = A– A variable ORed with 0 is always equal to the variable

A · 1 = A A variable ANDed with 1 is always equal to the variable

Page 15: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Proving rules 10–12• Rule 10: A + AB = A

A + AB = A·1 + AB Rule 4: A·1 = A= A(1 + B) Factoring (Distributive

Law)= A·1 Rule 2: 1+B = 1= A Rule 4: A·1 = A

Complete the following truth table, and hence prove A+AB=A

A B AB A+AB-------------------------------------0 00 11 01 1

Page 16: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Proving rules 10–12• Rule 11: A + A’B = A+B

A + A’B = (A + AB) + A’B Rule 10: A = A+AB= (AA + AB) + A’B Rule 7: A = AA= AA + AB + AA’ + A’B Rule 8: adding

AA’=0= (A+A’)(A+B) Factoring= 1·(A+B) Rule 6: A+A’=1= A+B Rule 4: drop the 1

Page 17: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Proving rules 10–12• Rule 12: (A+B)(A+C) = A + BC

Complete the following truth table & prove (A+B)(A+C) = A+BC

A B C A+B A+C (A+B)(A+C) BCA+BC

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

Page 18: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Duality Principle

• Any Boolean equality remains valid if we exchange:

1 ↔ 0AND ↔ OR

– This explains why rules 1–8 appear in pairs

Example: Apply the duality principle to Rule 1: A+0 = A

A + 0 = A → A · 1 = A (Rule 4)

Page 19: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Boolean algebra

• Boolean algebra• Laws and rules• De Morgan’s theorem• Analysis of logic circuits• Standard forms• Project 1 preparation

Page 20: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

De Morgan’s Theorem

A · B = A + B

A + BA

BAB

A

B

NAND Negative-OR

A + B = A · B

ABA

BA + B

A

B

NOR Negative-AND

Extends to more than two variables Example:

Each variable can also represent a combination of other variables Example:

DCBAABCD

BCACABBCACAB

Page 21: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Applying De Morgan’s Theorem

BCACABBCACAB

BCACAB

CBACBA

CABACBCA

BACBCA

Page 22: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Applying De Morgan’s Theorem

Use De Morgan’s theorem to simplify the expression

FEDCBA

Page 23: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Boolean algebra

• Boolean algebra• Laws and rules• De Morgan’s theorem• Analysis of logic circuits• Standard forms• Project 1 preparation

Page 24: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Boolean expression for a logic circuit

• Begin at the circuit inputs and work towards final output

• Write expression for each gate output

Page 25: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Constructing a truth table for a logic circuit

00

0

0

0

0

0

Truth tableA B C D A(B+CD)---------------------------------------------0 0 0 0 00 0 0 1 ......1 1 1 1 ...

I do NOT recommend using this method to

construct the truth table!It’s far too slow

Page 26: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Constructing a truth table for a logic circuit

A·(B+C·D)=1 Equals 1 only if A=1 and B+C·D=1 So expression equals 0 for top half of truth table,

where A=0 B+C·D=1

Equals 1 when B=1 or C·D=1 or both B=1 and C·D=0 → B C D=100,101,110 B=0 and C·D=1 → B C D=011 B=1 and C·D=1 → B C D=111

We can now fill in the truth table quickly

Use of “standard forms” will simplify

the creation of a truth table from logic expression

Page 27: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

A B C D A·(B+C·D)-------------------------------------------------------------0 0 0 0 00 0 0 1 00 0 1 0 00 0 1 1 00 1 0 0 00 1 0 1 00 1 1 0 00 1 1 1 01 0 0 0 01 0 0 1 01 0 1 0 01 0 1 1 11 1 0 0 11 1 0 1 11 1 1 0 11 1 1 1 1

A=0

B=0 and C·D=1

B=1 and C·D=0

B=1 and C·D=1

Page 28: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Boolean algebra

• Boolean algebra• Laws and rules• De Morgan’s theorem• Analysis of logic circuits• Standard forms• Project 1 preparation

Page 29: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Standard forms

All Boolean expressions can be converted into either of two standard forms:

Sum-of-products (SOP) form Product-of-sums (POS) form

Makes the following much easier and systematic: Evaluation Simplification Implementation

Truth table from Boolean expression

Fewer gates for same function

Logic gates to implement expression

SOP this week; POS in week 5

Page 30: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Sum-of-products (SOP)Sum-of-products (SOP) expressions are product terms summed by Boolean addition

Examples:

The following expressions are not in SOP form:

ABCAB DCBCDEABC

ACCBABA

ABCAB CDBA

Remember: “summed” by Boolean addition means OR-ed together

Page 31: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

AND/OR implementation of SOPSOP expressions simply require ORing outputs of AND gates

Domain of a Boolean expression is the set of variables in the expressionExample: domain of the expression for X in the

figure above is A, B, C, D

Page 32: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Conversion to SOP form

Convert the following expression to SOP form:

CBA

Any logic expression can be changed to SOP form simply by applying Boolean algebra

CBCACBACBA

Page 33: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Standard SOP formStandard SOP expressionAll variables in the domain appear in each product term in the expression

Example:

The following expression is not in standard SOP form:

Why not? Missing or in first term, and missing or in second term

DCABDCBACDBA

DCBADBACBA D DC C

Product terms involving all

variables in the domain are called

minterms

Page 34: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Conversion to standard SOP formProduct terms missing variables can always be expanded to standard form using Boolean algebra rules and

Example:ABCBAX

1XX X1X

First term is missing the variable C

ABCCCBA ABCCBACBA

Page 35: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Truth tables from standard SOP expressions Truth table: list of all

possible input combinations and corresponding output (0 or 1)

Place a 1 in output column for each input combination that makes the standard SOP expression a 1 0 in remaining

rows

A B C X product term

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

CBACBA

ABC

ABCCBACBAX

Page 36: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Boolean algebra

• Boolean algebra• Laws and rules• De Morgan’s theorem• Analysis of logic circuits• Standard forms• Project 1 preparation

Page 37: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Project 1 preparation• On Sunday (16 Nov) , the class will be given a

Boolean expression involving 4 variables (A,B,C,D) • Project 1

Marked by demonstration to me in week 5 theory section 5 parts, each of equal value:a) Expand given expression to sum-of-products (SOP) formb) Create truth table for expressionc) Expand SOP into standard SOP formd) Implement original expression in Logisim using gatese) Enter SOP expression into Logisim, and confirm that the

resulting truth table produced by Logisim matches your truth table in part b)

Page 38: Digital Logic Design Week 4 Boolean algebra. Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation

Project 1— sample question

a) Expand to SOP:b) Truth table: Z=1 only for ABCD=0101,0111,1101c) Standard SOP: d) Logisim circuit:

e) In Logisim: Project > Analyze Circuitenter expression at Expression tabview truth table at Table tab

BDABCZ DCBBDAZ

Week04_projectdemo.circ

DCBADCABDCBABCDAZ