241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

38
241-208 CH4 1 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul

Transcript of 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

Page 1: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 1

Chapter 4

Boolean Algebra andLogic Simplification

By Taweesak Reungpeerakul

Page 2: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 2

Contents

Boolean Operations & Expressions Rules of Boolean Algebra DeMorgan’s Theorems Simplification Using Boolean Algebra Standard Forms of Boolean Algebra Karnaugh Map Five-variable Karnaugh Map

Page 3: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 3

4.1 Boolean Operations & Expressions

Boolean Addition is equivalent to the OR operation.

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

Boolean multiplication is equivalent to the AND operation.

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

Page 4: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 4

4.2 Laws&Rules of Boolean Algebra

Laws (CAD) Commutative, Associative, and Distributive

A+B = B+A (C for addition) AB = BA (C for multiplication) A+ (B+C) = (A+B)+C (A for addition) A(BC) = (AB)C (A for multiplication) A(B+C) = AB+AC (distributive)

Page 5: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 5

4.2 Laws&Rules of Boolean Algebra (cont.)

1) A+0=A 10) A·A=A

2) A+1=1 11) A·A=0

3) A·0=0 12) A=A4) A·1=15) A+A=A6) A+A=17) A+AB=A8) A+AB=A+B9) (A+B)(A+C)=A+BC

Rules of Boolean Algebra

Page 6: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 6

4.3 DeMorgan’s Theorems

The complement of a product of variables is equal to the sum of the complements of the variables.XY = X + Y

The complement of a sum of variables is equal to the product of complements of the variables.X + Y = X ·Y

Page 7: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 7

Examples of DeMorgan’s Theorems

Ex#1: (AB+C)(BC)

= (AB+C) +(BC)

= (AB)C +(B+C)

= (A+B)C + B+C

Question: (A+B)C D

Ans: (A ·B)+C+D

Ex# 2: AB + CDE

= (AB) · (CDE)

= (A+B) · (CD+E)

= (A+B) · (CD+E)

Question: A+B+C+ DE

Ans: A B C+D+E

Page 8: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 8

4.4 Boolean Analysis of Logic Circuits

You should be able to: • Determine the Boolean expression for a

combination logic gates. • Evaluate the logic operation of a circuit from the Boolean expression • Construct a truth table

Page 9: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 9

4.4 Boolean Analysis of Logic Circuits(cont.)

Truth TableA B C D

(AB+C)D0 0 0 0 00 0 0 1 00 0 1 0 00 0 1 1 10 1 0 0 00 1 0 1 00 1 1 0 00 1 1 1 11 0 0 0 01 0 0 1 01 0 1 0 01 0 1 1 11 1 0 0 01 1 0 1 11 1 1 0 01 1 1 1 1

A

D

C

BAB

AB+C

(AB+C)D

Cause 1 when D and (AB+C) = 1If AB = 0, C = 1If AB = 1, C = 0 or 1AB = 1 when both A = B = 1

Page 10: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 10

4.5 Simplification using Boolean Algebra

EX#1: AB+A(B+C)+B(B+C)

= AB+AB+AC+BB+BC

= AB + AC + B + BC

= AB+AC+B(1+C)

Use distributive law A(B+C) = AB+AC

Use rule #5, A+A = A then A+A = A

Use distributive law A(B+C) = AB+AC

Use rule #2 (1+A) = 1

Page 11: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 11

4.5 Simplification using Boolean Algebra (cont.)

= AB+AC+B

= AB+B+AC

= B+BA+AC

= B(1+A)+AC

= B+AC Answer

Use commutative law A+B = B+A

Use distributive law A(B+C) = AB+AC

Use commutative law A+B = B+A, AB = BA

Use rule #2 (1+A) = 1

Page 12: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 12

4.5 Simplification using Boolean Algebra (cont.)

EX#2: A B C+A B C+A B C+A B C+A B C

= B C+A B C+A B C+A B C

= B C+ B C+A B C

= BC+B(C+AC)

= BC+B(C+A)

= BC+B C+AB Answer

Can u follow up this example by yourself ?

Use rule #11 A+AB = A+B

How about trying more questions, for example : Some questions in pp. 179 !!!!

Page 13: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 13

4.6 Standard Forms of Boolean Expressions

Sum-of-Products (SOP): 2 or more product terms are summed by Boolean

addition such as AB+ABC+AC

Watch out ! each bar if any must denote on only a single literal (variable) (in brief watch out the NAND), for example

AB+ABC+AC is not SOP

Ex# 1: convert (A+B)(C+D) into SOP form apply distributive law, hence = AC+AD+BC+BD

Page 14: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 14

4.6 Standard Forms of Boolean Expressions (cont.)

Ex# 2: (A + B) + C = (A+B)C DeMorgan’s

= (A+B)C Distributive

= AC+BCDomain is the set of literals (or variables) contained in the Boolean expression !!

Page 15: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 15

4.6 Standard Forms of Boolean Expressions (cont.)

Standard SOP Form: All variables in the domain appear in each

product term such as ABC+ABC+ABCConvert SOP to SSOP Step 1: Consider domain of SOP Step 2: Multiply each nonstandard term by (L+L) Step3 : Repeat step 2 until no nonstandard

term left.

Page 16: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 16

4.6 Standard Forms of Boolean Expressions (cont.)

Ex# 1: AB+ABC standard SOP= AB(C+C)+ABC = ABC+ABC+ABCEx# 2: B+ABC= B(A+A)+ABC = AB+AB+ABC= AB(C+C)+AB(C+C)+ABC = ABC+ABC+ABC+ABC+ABC

Page 17: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 17

Standard Forms (cont.)

Product-of-Sum (POS):

2 or more sum terms are multiplied

such as (A+B)(A+B+C)

Watch out the NOR term !!

Standard POS:all variables in the domain

appear ineach sum term such as(A+B+C)(A+B+C)

Ex# 1: (A+C)(A+B+C) standard POS= (A+C+BB)(A+B+C)

=(A+B+C) (A+B+C) (A+B+C)Question: (A+C)(A+B) std.

POSAns: (A+B+C) (A+B+C) (A+B+C)(A+B+C)

Page 18: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 18

Std. SOP to std. POS

Example: ABC+ABC+ABC+ABC+ABC101 011 100 001 000

3 variables23 = 8 possible combinationsRemained terms: 111, 110, 010Std. POS = (A+B+C)(A+B+C)(A+B+C)

Page 19: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 19

4.7 Boolean Expressions and Truth Tables

EX: ABC+ABC+ABC+ABC 000 010 101 110 out=1

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

What u should know: Be able to convert SOP and POS expressions to truth tables and vice versa !!

FACT SSOP is equal to 1 if at least one of the product term is 1.

Step I : construct truth table for all possible inputs.Step II: convert SOP to SSOPStep III: Place “1” in the output column that makes the SSOP expression a “1”Step IV: Place “0” for all the remaining apart from Step III

Convert SOP to truth table

Page 20: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 20

4.7 Boolean Expressions and Truth Tables (cont.)

EX: (A+B+C)(A+B+C)(A+B+C) 100 010 011 out=0

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

FACT SPOS is equal to 0 if at least one of the sum term is 0.

Step I : construct truth table for all possible inputs.Step II: convert POS to SPOSStep III: Place “0” in the output column that makes the SPOS expression a “0”Step IV: Place “1” for all the remaining apart from Step III

Convert POS to truth table

Page 21: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 21

4.7 Boolean Expressions and Truth Tables (cont.)

Convert truth table to SSOP

Convert truth table to SPOS

Step 1: Consider only output “1” Step 2: Convert each binary value to the corresponding product termStep 3: Repeat step 1&2 to get other product termsStep 4: Write all product terms in a summation expression

Step 1: Consider only output “0” Step 2: Convert each binary value to the corresponding sum term (1-> complement literal and 0-> for literal)Step 3: Repeat step 1&2 to get other sum termsStep 4: Write all product terms in a product expression

Check this out: Example 4-20, pp. 187

Page 22: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 22

4.8 The Karnaugh Map The Karnaugh map is an array of cells in which each cell

represents a binary value of the input variables. Can facilitate to produce the simplest SOP or POS

expression The number of cells is 2n, n is number of variables

ABC

ABC

ABC

ABC

ABC

ABC

ABC

ABC

Each cell differs from an adjacent cell by only one variable

3 variables so 8 cells

The numbers are entered in gray code, to force adjacent cells to be different by only one variable.

0 1

00

01

11

10

ABC

Gray code

Page 23: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 23

4.8 The Karnaugh Map (cont.)

ABC

ABC

ABC

ABC

ABC

ABC

ABC

ABC

AB

AB

AB

AB

C CC C

AB

AB

AB

AB

C C

AB

AB

AB

AB ABC

ABC

How to read !!

ABC

00

10

11

01

10

ABCABC

ABCABC

ABCABC

ABCABC

Full representation for 3 variables.(in fact it is n-Dimension truth table)

Question : What about the map for 4 variables ?

Page 24: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 24

4.9 Karnaugh Map SOP Minimization

Aim: You should be able to utilise K-Map to simplify Boolean expression to theirminimum form.

Convert SSOP to K-MapWhat we know is each product term in SSOP relates to “1” in corresponding truth table, but K-Map is, in deed, a form of n-dims truth table.

Hence the way to convert SSOP to K-map is similar to the way to convert SSOPto truth table !!

ABC

00

10

11

01

10

1 1

1

1ABC+ABC+ABC+ABC

Page 25: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 25

4.9 Karnaugh Map SOP Minimization (cont.)

Convert non-standard SOP to K-Map

Assume that the domain of Boolean is {A,B,C} and the expression we consideris A

convert A (non-SOP) to SSOP as follows:-

A = A(B+B)(C+C) = (AB+AB)(C+C) = ABC+ABC+ABC+ABC

ABC

00

10

11

01

10

1

11

1Observe that A is related to all cells related to thebinary “1” of A

Page 26: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 26

Grouping 1s

- Each group must contain 1,2,4,8,or 16 cells

- Each cell in a group must be adjacent to one or more cells in that same group, but all cells in the group do not have to be adjacent to each other.- Always include the largest possible number of 1s in a group- Each 1 on the map must be included in at least one group. The 1s already in a group can be included in another group as long as the overlapping groups include non-common 1s.

4.9 Karnaugh Map SOP Minimization (cont.)

How to minimize SOP expression ?

Page 27: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 27

4.9 Karnaugh Map SOP Minimization (cont.)

1

1 1

ABC

00

01

11

10

0 1

1

1 1

ABC

00

01

11

10

0 1

B changes across this boundary

C changes across this boundary

X = AC +AB

1. Group the 1’s into two overlapping groups as indicated.

2. Read each group by eliminating any variable that changes across a boundary.

3. The vertical group is read AC. 4. The horizontal group is read AB.

Page 28: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 28

4.9 Karnaugh Map SOP Minimization (cont.)

X

1. Group the 1’s into two separate groups as indicated.

2. Read each group by eliminating any variable that changes across a boundary.

3. The upper (yellow) group is read as

AD. 4. The lower (green) group is read as

AD.

ABCD

00

01

11

10

00 01 11 10

1 1

1 1

1

1

1

1

ABCD

00

01

11

10

00 01 11 10

1 1

1 1

1

1

1

1

X = AD +AD

B changes

C changes

B changes

C changes across outer boundary

Page 29: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 29

A B C

Some examples of grouping

BCA 0100 1011

1

0

BCA 0100 1011

1

0 1

1

1

1

1

1

1

1 1

1 AB

CD

00

10

11

01

00 01 11 10

1

1

1

1

1 1

1

1

1

1 1

BCABC

AC BC

AB

ABC D

4.9 Karnaugh Map SOP Minimization (cont.)

Page 30: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 30

BCA 0100 1011

1

0

1

4.9 Karnaugh Map SOP Minimization (cont.)

Ex1: Map and minimize the following std. SOP expression on a Karnaugh map: A B C+ABC+ABC+A B

C 000 001 110 100

BCA 0100 1011

1

0

1 1

11

1

11

Answer: A B+AC

AB

AC

Page 31: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 31

Ex2: Map and minimize the following SOP expression on a Karnaugh map: A B +ABC+A B C

110 111 010 011

BCA 0100 1011

1

0

BCA 0100 1011

1

0

1 1

11

1 1

11

Answer: B

B

4.9 Karnaugh Map SOP Minimization (cont.)

Page 32: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 32

A B C Out0 0 0 10 0 1 00 1 0 00 1 1 01 0 0 11 0 1 01 1 0 11 1 1 x

ABC

00

10

11

01

10

1

1

1

x

Out = AB+BC

Mapping Directly from a Truth Table

4.9 Karnaugh Map SOP Minimization (cont.)

Page 33: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 33

A+B+C

BCA 0100 1011

1

0

4.10 Karnaugh Map POS Minimization

Ex1: Map and minimize the following std. POS expression on a Karnaugh map:

(A+B+C)(A+B+C)(A+B+C)(A+B+C)000 001 111 110

BCA 0100 1011

1

0 0

0

00 0

0

00

Answer: (A+B)(A+C)(A+B+C)

A+B A+C

Page 34: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 34

Ex2: Map and minimize the following POS expression on a Karnaugh map:

(A+B)(A+B+C)(A+B+C)

000 001 010 011

BCA 0100 1011

1

0

BCA 0100 1011

1

00 000

Answer: A

0 000

A

4.10 Karnaugh Map POS Minimization (cont.)

Page 35: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 35

AB

CD

00

10

11

01

00 01 11 10

00

0

0

0 0

(B+C+D)(A+C+D)(A+B+C+D)(A+B+C+D)(A+B+C+D)

0000 1000 0010 0110 1011 1001 1010

0

(A+B)

(A+C+D)

Answer: (B+D)(A+B)(A+C+D)

(B+D)

4.10 Karnaugh Map POS Minimization (cont.)

Page 36: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 36

AB

CD

00

10

11

01

00 01 11 10

Converting Between POS and SOP Using Karnaugh Map

(B+C+D)(A+C+D)(A+B+C+D)(A+B+C+D)(A+B+C+D)

0000 1000 0010 0110 1011 1001 1010

AB

CD

00

10

11

01

00 01 11 10

0 0

0 0

0

0 0

(A+B)

(A+C+D)

Min POS: (B+D)(A+B)(A+C+D)

(B+D)

Min SOP: AB+BC+AD

0 0

0 0

0

0 0

1

1

1 11

11

1

1

AD

BC

AB

Page 37: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 37

7-segment decoding Logic

Digit D C B A a b c d e f g 0 0 0 0 0 1 1 1 1 1 1 0 1 0 0 0 1 0 1 1 0 0 0 0 2 0 0 1 0 1 1 0 1 1 0 1 3 0 0 1 1 1 1 1 1 0 0 1 4 0 1 0 0 0 1 1 0 0 1 1 5 0 1 0 1 1 0 1 1 0 1 1 6 0 1 1 0 1 0 1 1 1 1 1 7 0 1 1 1 1 1 1 0 0 0 0 8 1 0 0 0 1 1 1 1 1 1 1 9 1 0 0 1 1 1 1 1 0 1 1 10 1 0 1 0 x x x x x x x 11 1 0 1 1 x x x x x x x 12 1 1 0 0 x x x x x x x 13 1 1 0 1 x x x x x x x 14 1 1 1 0 x x x x x x x 15 1 1 1 1 x x x x x x x

7-segment decoding logic 7-segment display

Binary coded decimal input

A

D

C

Ba

a

de

c

gf

b gf

ed

c

b

Page 38: 241-208 CH41 Chapter 4 Boolean Algebra and Logic Simplification By Taweesak Reungpeerakul.

241-208 CH4 38

DC

BA

00

10

11

01

00 01 11 10

Karnaugh Map Minimization of the Segment Logic

SOP for segment a:DC BA+DCBA+DCBA+ DCBA+DCBA+DCBA+DC

BA+DCBA

1 1

1 1

1

x x

D

1 1

1

x x x x

BCA

CA

Minimum SOP expression: D+B+CA+CA