Chapter 2 - Boolean Algebra - comparison to regular algebra Any algebra is built upon :

36
1 Chapter 2 - Boolean Algebra - comparison to regular algebra Any algebra is built upon : 1) A set of elements 2) A set of operators 3) A set of postulates Boolean Algebra is built upon : 1) A set of elements: {0, 1} 2) A set of operators: {+, • } – Define these in class 3) A set of postulates: the Huntington Postulates are the most common Reading Assignment: Chapter 2 in Logic and Computer Design Fundamentals, 5 th Edition by Mano Chapter 2A EGR 270 – Fundamentals of Computer Engineering

description

Chapter 2A EGR 270 – Fundamentals of Computer Engineering. Reading Assignment: Chapter 2 in Logic and Computer Design Fundamentals, 4 th Edition by Mano . Chapter 2 - Boolean Algebra - comparison to regular algebra Any algebra is built upon : 1) A set of elements - PowerPoint PPT Presentation

Transcript of Chapter 2 - Boolean Algebra - comparison to regular algebra Any algebra is built upon :

Page 1: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

1

Chapter 2 - Boolean Algebra - comparison to regular algebra 

Any algebra is built upon:1) A set of elements2) A set of operators3) A set of postulates

Boolean Algebra is built upon:1) A set of elements: {0, 1}2) A set of operators: {+, • } – Define these in class3) A set of postulates: the Huntington Postulates are the most common

Reading Assignment: Chapter 2 in Logic and Computer Design Fundamentals, 5th Edition by Mano

Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Page 2: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

2) Two identity elements: - Illustrate by showing all possible values for x A) 0: 0 + x = x + 0 = x B) 1: 1 • x = x • 1 = x

3) Commutative Laws: - Illustrate by showing all possible values for x and y A) x + y = y + x B) xy = yx

2Chapter 2A EGR 270 – Fundamentals of Computer EngineeringHuntington Postulates – The following 6 postulates, along with the set of elements and set of operators shown above, uniquely and completely define Boolean algebra.1) Closure for the operations {+, • } - Discuss

Page 3: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

4) Distributive Laws: - Prove by truth table A) x • (y + z) = xy + xz B) x + yz = (x + y) • (x + z)

3Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Page 4: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

4

5) Existence of a Complement: - Illustrate by considering all possible values for x

Define by the following truth table:

Related postulates:

x' = x = "the complement of x" = "NOT x"

x x’

0 11 0 A) x + x’ = 1

B) x • x’ = 0

6) At least two non-equal elements: {0, 1} - Discuss

4Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Page 5: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

5

Common TheoremsBoolean algebra has already been completely defined. Additional theorems are also often used, not because they are required, but because they are useful. Some of the most common theorems are shown below. Note that each theorem could be formally proven using the postulates.1) Idempotency: (“same power”) A) x + x = x – Illustrate by trying all possible values for x B) x • x = x

Example: Show related examples using this theorem.

5Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Page 6: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

2) (no name) – Discuss A) x + 1 = 1 B) x • 0 = 0

3) Involution: – Discuss and illustrate using NOT gates x’’ = = x

4) Associative Laws: – Discuss and illustrate using logic gates A) x + (y + z) = (x + y) + z B) x(yz) = (xy)z

6Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Page 7: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

5) DeMorgan’s Theorems:

Example: Show related examples using DeMorgan’s theorem.

y x = xy = yx B)

y x = yx A)

7Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Note: These theorems are not obvious and can be tricky.Hint: Apply to one operation at a time (OR or AND).

Prove 5A by truth table

Page 8: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

6) Absorption: A) x + xy = x B) x (x+y) = x

Example: Show related examples.

7) (no name) A) x + x’y = x + y B) x (x’ + y) = xy

Example: Show related examples.

8Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Page 9: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

8) Concensus: A) xy + x’z + yz = xy + x’z B) (x + y)(x’ + z)( y + z) = (x + y)(x’ + z)

Example: Show related examples.

9Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Page 10: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

Order of operations – The following precedence is used to evaluate logic operations:.

Example: In which order are the operations performed for the following function?f = ab+cd Note: spacing is often used to make it clearer: f = ab + cd

Example: Evaluate the following expression (show each step):F = 10 + (1 1’1)’(1+0’) + (0+1’)10

Operation Precedence

Parentheses Higher

NOT

AND

OR Lower

10Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Note that the same order of operations is used in Excel, C++, and MATLAB

Page 11: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

Boolean Functions – Simplifying Boolean functions corresponds to minimizing the amount of circuitry (logic gates) to be used.

Minimizing Boolean functionsNo specific rules. In general we use Boolean algebra (postulates and theorems) to reduce the number of terms, literals, logic gates, or integrated circuits (Ics).

Literal – a primed (complemented) or unprimed variable. In counting literals, we count all occurrences of each literal.

Example: How many literals are in the expression f = ab + a’c + bc’d ? (Answer: 7)

11Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Truth table

Boolean function

Minimize with Boolean algebra

Implement with logic circuits

Page 12: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

Examples – Minimize the following Boolean functions: 1) F = AB + A(B + C) + B(B + C) 

2) F = AB’(C + BD) + A’B’

12Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Page 13: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

3) F(A,B,C,D) = A + A’BC + C’

4) F = [(x’y)’ + z’]’

13Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Page 14: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

5)

 6) f(x,y,z) = x’y(z + y’x) + y’z

CD) ABF)(E (CD AB F1

14Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Page 15: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

7) ca dcb dcb c)b(aba d)c,b,f(a,

15Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Page 16: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

Complement of a FunctionA function F’ has the exact opposite truth table as function F.

F x y z x y

Example: A) Find F’ for the function below using DeMorgan’s theorem.B) Find truth tables for F and for F’ for the function below. Are they opposites?

16Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Page 17: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

Canonical and Standard formsBoolean functions are commonly expressed using the following forms:• Canonical forms:

» Sum of minterms» Product of maxterms

• Standard forms:» Sum of products (SOP)» Product of sums (POS)

Note: These 4 forms will be used regularly throughout the course.• Many designs begin by expressing functions in Sum of minterms or Product

of maxterms forms.• When we minimize expressions the result is typically minimal SOP or

minimal POS form.

17Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Page 18: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

Example: f(A,B) has 4 possible minterms. List them.

Minterm – (also called a standard product) A minterm is a term containing all n variables (complemented or uncomplemented) ANDed together.

Each minterm represents one n-bit word where:• Primed variable 0• Unprimed variable 1

Minterm designation: for function f(x,y,z) the input combination 000 represents minterm x’y’z’ and is designated m0.

18Chapter 2A EGR 270 – Fundamentals of Computer Engineering

xyz = 000

x’y’z’

m0

Page 19: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

Example: Show all 8 possible minterms and the shorthand designations for f(x, y, z).

19Chapter 2A EGR 270 – Fundamentals of Computer Engineering

x y z Minterm(algebraic form)

Minterm(shorthand form)

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

Page 20: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

Example: Pick a truth table for some function f(x,y,z) and represent f as a sum of minterms.

Key Point: A Boolean function F may be represented by a sum (ORed together) of its minterms. They represent the input combinations needed to yield F = 1. So minterms represent the 1’s in the truth table for F.

F (minterms)

20Chapter 2A EGR 270 – Fundamentals of Computer Engineering

x y z F

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

Page 21: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

Maxterm – (also called a standard sum) A maxterm is a term containing all n variables (complemented or uncomplemented) ORed together.Example: f(A,B) has 4 possible maxterms. List them.

21Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Each maxterm represents one n-bit word where:• Primed variable 1• Unprimed variable 0(note that this is opposite of the notation used for minterms)

Maxterm designation: for function f(x,y,z) the input combination 000 represents maxterm (x + y + z) and is designated M0.

xyz = 000

x+y+z

M0

Page 22: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

22Chapter 2A EGR 270 – Fundamentals of Computer EngineeringExample: Show all 8 possible maxterms and the shorthand designations for f(x, y, z).

x y z Maxterm(algebraic form)

Maxterm(shorthand form)

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

Page 23: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

Key Point: A Boolean function F may be represented by a product (ANDed together) of its maxterms. They represent the input combinations needed to yield F = 0. So maxterms represent the 0’s in the truth table for F.

F (max terms)

23Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Example: Pick a truth table for some function f(x,y,z) and represent f as a product of maxterms.

x y z F

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

Page 24: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

Relationship between minterms and maxterms

i im M i iM m

24Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Example: Illustrate the relationships above with any minterm or maxterm.

Page 25: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

Conversion between formsSince minterms represent where F = 1 and maxterms represent where F = 0, all terms are either minterms or maxterms. So if F is expressed as a sum of minterms, then F is a product of the maxterms (the terms that were not minterms). So it is simple to convert between forms.

Example: Convert to the other canonical form 1. F(A, B) = (0, 1)

2. F(x, y, z) = (0, 1)

3. F(x, y, z) = (4, 5, 6)

4. F(a, b, c, d, e) = (0-4, 8, 13-18)

25Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Page 26: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

Conversion to sum of minterms or product of maxterms forms from other formsPossible approaches include Boolean algebra and truth tables.

Examples: Represent each function below as a sum of minterms:1. F(A, B) = A

2. F(x, y, z) = xy + z

26Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Page 27: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

Examples: Represent each function below as a product of maxterms:1. F(A, B) = A’B + AB’

2. F(x, y, z) = x’ + y’

27Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Page 28: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

Standard FormsCanonical forms are not minimized and are not useful for many circuit implementations.Standard forms are more useful. Functions are typically minimized into one of the two standard forms:1. Sum of Products (SOP) : F = sum of ANDed terms (but not necessarily

minterms)

2. Product of Sums (POS) : F = product of ORed terms (but not necessarily maxterms)

28Chapter 2A EGR 270 – Fundamentals of Computer Engineering

DCA BC BA D)C,B,F(A, :Example

Product term (variables ANDed)

Sum (Products ORed)

DACBBA D)C,B,F(A, :Example

Sum term (variables ORed)

Product (Sums ANDed)

Page 29: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

Example: Determine the type of expression in each case below.

29Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Function Sum ofMinterms

Product of Maxterms

SOP POS None of the forms

listed

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

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

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

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

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

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

Page 30: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

Example: Function F(A,B,C) has the following truth table. Express F in each of the following forms:1. Sum of minterms2. Product of maxterms3. Minimal SOP4. Minimal POS

A B C F0 0 0 10 0 1 10 1 0 00 1 1 01 0 0 01 0 1 01 1 0 11 1 1 1

30Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Page 31: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

Standard Forms: 2-Level ImplementationsStandard forms are referred to as “2-level implementations” because they can be implemented with two levels gates (and thus only two gate delays). Note that this does not include initial inverters.

Example: Implement a SOP expression using logic gates to illustrate that it is a 2-level implementation.

Example: Implement a POS expression using logic gates to illustrate that it is a 2-level implementation.

31Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Page 32: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

Non-standard forms:4 commonly used forms have been covered (sum of minterms, product of maxterms, SOP, and POS). These forms will be used throughout the course. There are, however, other non-standard forms.

Example: The following function is in non-standard form:F = A(B + C(D+E(G+HJ)))

a) Draw the logic diagram. How many gate delays are there?

b) Expand F into minimal SOP form and draw the logic diagram. How many gate delays are there?

32Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Page 33: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

Basic functions/gates and their truth tables:We previously defined two functions with two or more inputs: AND, OR.• How many possible 2-input logic functions could be defined (consider the

diagram shown below)? (Answer: 16)• How many correspond to actual gates (commercially available)? (Answer: 6)

Inputs: A

B F (Output) Logic Gate

6 commonly defined 2-input logic functions/gates: 1. AND 4. NOR2. OR 5. XOR (Exclusive-OR)3. NAND 6. XNOR (Exclusive-NOR or Equivalence)

The AND and OR gates have already been defined. The remaining 4 gates will be discussed on the following slides.

33Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Page 34: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

NAND: Show logic symbol, truth table, and logic expressions:

NOR: Show logic symbol, truth table, and logic expressions:

34Chapter 2A EGR 270 – Fundamentals of Computer Engineering

Page 35: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

XOR: Show logic symbol, truth table, and logic expressions:

XNOR: Show logic symbol, truth table, and logic expressions:

35Chapter 2A EGR 270 – Fundamentals of Computer Engineering

BA BA 2) (1, BA

AB BA 3) (0, BA BA BA BA

Page 36: Chapter 2  -  Boolean Algebra   - comparison to regular algebra Any algebra is built upon :

Other Logic Symbols: (We won’t use these in this course.)

36Chapter 2A EGR 270 – Fundamentals of Computer Engineering