003 Boolean Algebra

19
8/23/2009 1 Boolean Algebra Program Studi Teknik Informatika Universitas Ma Chung Malang Logika Digital-3. Boolean Algebra- Ma Chung Univ. 1 DIGITAL SYSTEM may be divided roughly into 3 parts Circuit Design Logic Design System Design Logika Digital-3. Boolean Algebra- Ma Chung Univ. We are HERE…. 2 Boolean algebra is the basic mathematics needed for logic design of digital systems. Many of the rules of Boolean algebra are the same as for ordinary algebra, but watch out for some surprise! Logika Digital-3. Boolean Algebra- Ma Chung Univ. 3

Transcript of 003 Boolean Algebra

8/23/2009

1

Boolean Algebra

Program Studi Teknik Informatika

Universitas Ma Chung Malang

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

1

DIGITAL SYSTEM may be divided roughly into 3 parts

Circuit Design

Logic Design

System Design

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

We are HERE….

2

Boolean algebra is the basic mathematics needed for logic design of digital systems.

Many of the rules of Boolean algebra are the same as for ordinary algebra, but watch out for some surprise!

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

3

8/23/2009

2

Study Guide

- Two commonly used notation for the inverse or complement of A are A’ or

A’ is much easier than for typists, printers, and computers.

We will use A’ for the complement of A.

Remember: Do NOT mix notations in the same equation.

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

4

A

A

Study Guide

• Most engineers use + for OR and . (or no symbol) for AND.

• An alternative notation, often used by mathematicians, is for OR

and for AND.

We will use + for OR and no symbol for AND

Example: A+BC

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

5

Study Guide

• Many different symbols are used for AND, OR, and INVERTER logic blocks. We will use

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

6

Gerbang OR dua masukan Gerbang OR empat masukan

Gerbang AND tiga masukanGerbang AND dua masukan

Gerbang NOT atau pembalik

xy

xy

ABC

ABCD

z = xy

z = x + y

F = ABC

F = A + B + C + D

xx'

xatau

8/23/2009

3

There are alternatives gates symbols (appendix B.1 Charles H. Roth)

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

7

BASIC OPERATION

x x’

0 1

1 0

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

8

INVERTER

BASIC OPERATION

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

9

AND LOGIC

Sumber

tegangan

A B L

x y x y

0 0 0

0 1 0

1 0 0

1 1 1

8/23/2009

4

Basic Operation

OR logic

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

10

Sumber

tegangan

A

B L

x y x + y

0 0 0

0 1 1

1 0 1

1 1 1

Summary of Basic Operation

x y x y x y x + y x y

0 0 0 0 0 0 0 1

0 1 0 0 1 1 1 0

1 0 0 1 0 1

1 1 1 1 1 1

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

11

Boolean Expression and Truth Table

Example of expressions are

AB’ + C (B’ is formed first, then AB’ and finally AB’ + C)

*A(C + D)+’ + BE

Parentheses are added as needed to specify the order in which the operations are performed.

When parentheses is omitted, complementation is performed first followed by AND and then OR.

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

12

8/23/2009

5

Give the networks for expressions

1. AB’ + C

2. *A(C + D)+’ + BE

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

13

An expression is evaluated by substituting a value of 0 or 1 for each variable.

If A = B = C = 1 and D = E = 0, the value of expression *A(C + D)+’ + BE is

*A(C + D)+’ + BE= * 1(1+0) +’ + 1.0

= *1. 1+’ + 0

= 1’ + 0

= 0 + 0

=0

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

14

• Truth table also called a table of combinations specifies the values of a Boolean expression for every possible combination of values of the variables in the expression.

Example: Truth table for F = A’ + B

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

15

A B A’ F = A’ + B

0 0 1 1

0 1 1 1

1 0 0 0

1 1 0 1

8/23/2009

6

• Remember : a truth table for an n-variable expression will have 2n rows.

Exercise: Proof that AB’ + C = (A+C) (B’+C) using truth table.

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

16

Basic Theorems

1. Operations with 0 and 1:X + 0 = X X . 1 = XX + 1 = 1 X . 0 = 0

2. Idempotent lawX + X = X X . X = X

3. Involution law(X’)’ = X

4. Law of complementarity:X + X’ = 1 X . X’ = 0

Please make some switch network analogy!

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

17

Example:

(AB’ + D)E + 1 = 1 because X + 1 = 1

(AB’ + D) (AB’ + D)’ = 0 because X . X’ = 0

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

18

8/23/2009

7

In this section you will study Commutative, associative, and distributive law

1. Commutative laws for AND and ORXY = YX X + Y = Y + X

2. Associative laws for AND and OR:(XY) Z = X (YZ) = XYZ(X + Y) + Z = X + (Y + Z) = X + Y + Z

3. Distributive lawX(Y + Z) = XY + XZX + YZ = (X + Y) (X + Z)

Logika Digital-3. Boolean

Algebra- Ma Chung Univ. 19

Commutative, Associative, and Distributive Law

• Many of the laws of ordinary algebra, such as the commutative and associative laws, also apply to Boolean algebra.

1. Commutative laws for AND and OR

XY = YX X + Y = Y + X

This means that the order in which the variables are written will not affect the result of applying the AND and OR operations.

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

20

2. The associative laws for AND and OR:

(XY) Z = X (YZ) = XYZ

(X + Y) + Z = X + (Y + Z) = X + Y + Z

When forming the AND (or OR) of three variables, the result is independent of which pair of variables we associate together first, so parentheses can be omitted as indicated in those equations.

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

21

8/23/2009

8

(AB) C = ABC

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

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

22

3. Distributive law

a. The 1st distributive law: (also apply to

ordinary algebra)

X(Y + Z) = XY + XZ

b. The 2nd distributive law: (ONLY for Boolean algebra, NOT for ordinary algebra)

X + YZ = (X + Y) (X + Z) (proof it !)

This second law is very useful in manipulating Boolean expression.

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

23

Simplification Theorems

The following theorems are useful in simplifying Boolean expression:

XY + XY’ = X (X + Y)(X + Y’) = X

X + XY = X X(X + Y) = X

(X + Y’)Y = XY XY’ + Y = X + Y

Proof every expression above!

Remember:

Simplifying an expressions leads to simplifying the corresponding logic network.

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

24

8/23/2009

9

Example:

F = A(A’ + B)

= AB

Exercise:

1. Simplify Z = A’BC + A’ (hint: let X=A’ and Y=BC)

2. Simplify Z = [A + B’C + D + EF] [A + B’C + (D + EF)’ ]

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

25

In this section you will study

DeMorgan’s Law

(x + y)’ = x’ y’

(xy)’ = x’ + y’

(x1 + x2 + x3 + …+xn)’= x’1 x’2 x’3 …x’n

(x1 x2 x3 …xn)’= x’1 + x’2 + x’3 + … + x’n

Logika Digital-3. Boolean Algebra-

Ma Chung Univ.

26

Inversion

• DeMorgan’s laws:

(x + y)’ = x’ y’

(xy)’ = x’ + y’

Verify these laws using a truth table!!!

• DeMorgan’s laws are easily generalized to n variables:

(x1 + x2 + x3 + …+xn)’= x’1 x’2 x’3 …x’n(x1 x2 x3 …xn)’= x’1 + x’2 + x’3 + … + x’n

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

27

8/23/2009

10

Summary of DeMorgan’s law:

- The complement of the product is the sum of the complements.

- The complement of the sum is the product of the complements.

Exercise:

1. Find the complement of (A’ + B)C’

2. Find *(AB’ + C)D’ + E+’

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

28

• The one-step rule for applying DeMorgan’slaws can be written symbolically as

[f(X1, X2, X3, ….,Xn, 0, 1, +, .)+’

=f(X’1, X’2, X’3, ….,X’n, 1, 0, ., +)

This notation means that to form the complement of an expression containing X1, X2, X3, ….,Xn, constant 0 and 1, and operations + and . , replace X1 with X’1, 0 with 1, and so on…

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

29

[(a’b + c’)(d’ + ef’) + gh + w+’

= *(a + b’)c + d(e’ + f)+ (g’ + h’) w’

Verify that the above answer is correct by carrying out the complementation one step at a time

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

30

8/23/2009

11

In this section you will study DUALITY

[f(X1, X2, X3, ….,Xn, 0, 1, +, .)]D

=f(X1, X2, X3, ….,Xn, 1, 0, ., +)

31

Logik

a D

igita

l-3. B

oole

an

Alg

ebra

-

Ma C

hu

ng U

niv

.Duality (D)

• The dual is formed by replacing AND with OR, OR with AND, 0 with 1, and 1 with 0. Variables and complements are left unchanged.

This rule for forming the dual can be summarized as follows:

[f(X1, X2, X3, ….,Xn, 0, 1, +, .)]D

=f(X1, X2, X3, ….,Xn, 1, 0, ., +)

Example:

F = ab’ + c + 0.d’(1+e) FD= (a + b’)c(1 + d’+0.e)

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

32

Alternate method:Duality comes from complementary

• An alternate method for forming the dual of an expression is to first form the complement of expression and then replace each variables by its complement. In the above example

F’= (a’ + b)c’(1 + d+0.e’)

from which

FD= (a + b’)c(1 + d’+0.e)

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

33

8/23/2009

12

Do you still remember distributive laws????

The 1st distributive law: X(Y + Z) = XY + XZ

duality

The 2nd distributive law: X + YZ = (X + Y).(X + Z)

Summary: if a theorem is true, so is its dual

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

34

In this section you will study

Multiplying Out and Factoring

Logika Digital-3. Boolean

Algebra- Ma Chung Univ. 35

Multiplying out and factoring

What is Sum-of-Product (SOP)?

when all products are the products of single variables only. This form is the end result when an expression is fully multiplied out.

What is Product-of-Sum (POS)?

when all sums are the sums of single variables.

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

36

8/23/2009

13

Example of SOP

AB’ + CD’E + AC’E’

ABC’ + DEFG + H

A + B’ + C + D’E

But

(A + B)CD + EF is not in sum-of-products form

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

37

Example of POS

(A + B’)(C + D’ + E)(A + C’ + E’)

(A + B)(C + D + E)F

A B’C(D’ + E)

But

(A + B)(C + D) + EF is not in product-of-sums form

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

38

Remember:

When multiplying out an expression, the second distributive law should be applied first when possible.

Example: Multiply out (A+BC)(A+D+E)

let X=A, Y=BC, Z=D+E

Then

(X+Y)(X+Z)=X + YZ= A+BC(D+E)

= A + BCD + BCE

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

39

8/23/2009

14

The same result could be obtained the hard way by multiplying out the original expression completely and then eliminating redundant terms:

(A+BC)(A+D+E)= A+AD+AE+ABC+BCD+BCE

= A(1+D+E+BC)+BCD+BCE

= A+BCD+BCE

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

40

Exercise:

1. Factor A + B’CD

2. Factor AB’ + C’D

3. Factor C’D + C’E’ + G’H

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

41

The following theorem is very useful for factoring and multiplying out

(X + Y) (X’ + Z) = XZ + X’Y

Proof it!

Since the equation is valid for both X = 0 and X = 1, it is always VALID.

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

42

8/23/2009

15

Summary:

There are 3 important equation for multiplying out and factoring:

X(Y + Z) = XY + XZ (1)

(X + Y)(X + Z) = X + YZ (2)

(X + Y)(X’ + Z) = XZ + X’Y (3)

In general, when we multiply out an expression, we should use (3) along with (1) and (2). To avoid generating unnecessary terms when multiplying out, (2) and (3) should generally be applied before (1).

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

43

• Example of multiplying out

(A + B + C’)(A + B + D)(A + B + E)(A + D’ + E)(A’ + C)

= (A + B + C’D)(A + B + E)*AC + A’(D’ + E)+

= (A + B + C’DE)(AC + A’D’ + A’E)

= AC + ABC + A’BD’ + A’BE + A’C’DE

= AC + A’BD’ + A’BE + A’C’DE

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

44

• Example of factoring

AC + A’BD’ + A’BE + A’C’DE

= AC + A’(BD’ + BE + C’DE)

XZ X’ Y

= (A + BD’ + BE + C’DE)(A’ + C)

= (A + C’DE + B(D’ + E)) (A’ + C)

X Y Z

= (A + C’DE + B)(A + C’DE + D’ + E) (A’ + C)

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

45

8/23/2009

16

= (A + C’DE + B)(A + D’ + E) (A’ + C)

= (A + B + C’DE)(A + D’ + E) (A’ + C)

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

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

46

In this section, you will study

a. EX-OR (Exclusive-OR)=XOR

b. EX-NOR (Exclusive NOT OR)=

XNOR=COIN

The symbol for XOR is

The symbol for XNOR

Logika Digital-3. Boolean Algebra-

Ma Chung Univ. 47

• The exclusive OR and exclusive NOR

The truth table for X Y is

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

48

X Y X XOR Y X XNOR Y

0 0 0 1

0 1 1 0

1 0 1 0

1 1 0 1

8/23/2009

17

The following theorems apply to XOR

X 0 = X

X 1 = X’

X X = 0

X X’ = 1

X Y = Y X (commutative law)

(X Y) Z = X (Y Z) = X Y Z (associative law)

X(Y Z) = XY XZ (distributive law)

(X Y)’ = X Y’ = X’ Y = XY + X’Y’ (XNOR)

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

49

X Y X XOR Y

0 0 0

0 1 1

1 0 1

1 1 0

Exercise:

Proof that XY XZ = X(Y Z)

Use (XY’ + X’Y)’ = XY + X’Y’ to solve A’ B C

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

50

In this session, you will study about

The Consensus Theorem

XY + X’Z + YZ = XY + X’Z

Logika Digital-3. Boolean Algebra-

Ma Chung Univ. 51

8/23/2009

18

The Consensus Theorem

This theorem is very useful in simplifying Boolean expressions.

XY + X’Z + YZ, the term YZ is redundant and can be eliminated to form the equivalent expression XY + X’Z

The term which was eliminated is referred to as the ‘consensus term’.

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

52

Example:

1. The consensus of ab and a’c is bc.

2. The consensus of abd and b’de’ is

(ad)(de’)=ade’

3. The consensus of ab’d and a’bd’ is

(ad)(a’d’)=0

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

53

The dual form of the consensus theorem is

(x + y)(x’ + z)(y + z) = (x + y)(x’ + z)

Example:

(a + b + c’)(a + b+ d’)(b + c + d’)=(a+b+c’)(b+c+d’)

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

54

8/23/2009

19

Logika Digital-3. Boolean Algebra-Ma Chung Univ.

55