boolean algebra and standart forms of expression

58
1 Boolean Algebra and Standart Forms of Expression

Upload: jolene-moon

Post on 30-Dec-2015

26 views

Category:

Documents


1 download

DESCRIPTION

Boolean Algebra and Standart Forms of Expression. Overview. Switching algebra Axioms Theorems Algebraic m inimization Standard forms Sum-of-minterms Product-of-maxterms Other Logic Gates. Combinational Circuits. A combinational circuit has one or more digital inputs - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Boolean Algebra and  Standart Forms of Expression

1

Boolean Algebra and Standart Forms of Expression

Page 2: Boolean Algebra and  Standart Forms of Expression

2

Overview

• Switching algebra– Axioms

– Theorems

• Algebraic minimization

• Standard forms– Sum-of-minterms

– Product-of-maxterms

• Other Logic Gates

Page 3: Boolean Algebra and  Standart Forms of Expression

3

Combinational Circuits

• A combinational circuit has– one or more digital inputs

– one or more digital outputs

– a functional specification that details the value of each output for every possible combination of valid input values

– a timing specification consisting (at minimum) of an upper bound tPD on the required time for the device to compute the specified output values from an arbitrary set of stable, valid input values

Page 4: Boolean Algebra and  Standart Forms of Expression

4

Functional Specifications

• There are many ways of specifying the function of a combinational device, for example:

• Concise alternatives:– Boolean function

– Truth table

– Schematic

Page 5: Boolean Algebra and  Standart Forms of Expression

5

Combinational Circuits

• Combinational logic circuits has no memory!– Outputs are only function of current input combination

– Nothing is known about past events

– Repeating a sequence of inputs always gives the same output sequence

• Sequential logic circuits (covered later) does have memory– Repeating a sequence of inputs can result in an

entirely different output sequence

Page 6: Boolean Algebra and  Standart Forms of Expression

6

Combinational Logic Example

• Circuit controls the level of fluid in a tank– inputs are:

• HI - 1 if fluid level is too high, 0 otherwise

• LO - 1 if fluid level is too low, 0 otherwise

– outputs are:• Pump - 1 to pump fluid into tank, 0 for pump off

• Drain - 1 to open tank drain, 0 for drain closed

– input to output relationship is described by a truth table

Page 7: Boolean Algebra and  Standart Forms of Expression

7

Combinational Logic Example

SchematicRepresentation

HI

LO Drain

Pump

HI

0011

LO

0101

Pump

010x

Drain

001x

Tank level is OKLow level, pump more inHigh level, drain some outinputs cannot occur

Truth TableRepresentation

Page 8: Boolean Algebra and  Standart Forms of Expression

8

Terms and Definitions

• Logic Expression (Boolean/Switching function) - a mathematical formula consisting of logical operators and variables– f(x,y,z) = (x + y’).z + x’

• Logic Operator - a function that gives a well defined output according to switching algebra– Not (’), And (.), Or (+)

• Logic Variable - a symbol representing the two possible switching algebra values of 0 and 1– x, y, z

• Logic Literal - the values 0 and 1 or a logic variable or it’s complement– x, y’, z, x’

Page 9: Boolean Algebra and  Standart Forms of Expression

9

Logic Expressions - Precedence

• Like standard algebra, switching algebra operators have a precedence of evaluation– NOT operations have the highest precedence

– AND operations are next

– OR operations are lowest

• Parentheses explicitly define the order of operator evaluation– If in doubt, USE PARENTHESES!

Page 10: Boolean Algebra and  Standart Forms of Expression

10

Truth Tables

• A truth table shows all possible inputs and outputs of a function.– There is one-to-one correspondence between a Boolean

function and its turth table.

• Remember that each input variable represents either 1 or 0.– Because there are only a finite number of values (1 and 0),

truth tables themselves are finite.

– A function with n variables has 2n possible combinations of inputs.

• Inputs are listed in binary.

Page 11: Boolean Algebra and  Standart Forms of Expression

11

Truth Tables

x y z f (x,y,z)

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

f(0,0,0) = (0 + 1)0 + 1 = 1f(0,0,1) = (0 + 1)1 + 1 = 1f(0,1,0) = (0 + 0)0 + 1 = 1f(0,1,1) = (0 + 0)1 + 1 = 1f(1,0,0) = (1 + 1)0 + 0 = 0f(1,0,1) = (1 + 1)1 + 0 = 1f(1,1,0) = (1 + 0)0 + 0 = 0f(1,1,1) = (1 + 0)1 + 0 = 1

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

Page 12: Boolean Algebra and  Standart Forms of Expression

12

Switching Algebra

• Based on Boolean Algebra– Developed by George Boole in 1854

• Basic laws of Boolean Algebra will be implemented as logic gates.

• Networks of logic gates allow us to manipulate digital signals– Can perform numerical operations on digital signals such

as addition, multiplication

– Can perform translations from one binary code to another.

• A switching (Boolean) variable X can take on only one of two values:– X = 0, if X ≠ 1

– X = 1, if X ≠ 0

Page 13: Boolean Algebra and  Standart Forms of Expression

13

Switching Algebra Operations - NOT

• Unary complement/inversion operation

• Usually shown as overbar , other forms are ~X, X’

X01

X10

X X

X

Page 14: Boolean Algebra and  Standart Forms of Expression

14

Switching Algebra Operations - AND

• Also known as the conjunction operation; output is true only if all inputs are true

• Algebraic operators are ‘·’, ‘&’, ‘’

X0011

Y0101

X·Y0001

Page 15: Boolean Algebra and  Standart Forms of Expression

15

Switching Algebra Operations - OR

• Also known as the disjunction operation; output is true if any input is true

• Algebraic operators are ‘+’, ‘|’, ‘’

X0011

Y0101

X+Y0111

Page 16: Boolean Algebra and  Standart Forms of Expression

16

Switching Algebra Axioms

00110

111

000

1'0

01

XX

XX

10110

000

111

0'1

10

XX

XX

Page 17: Boolean Algebra and  Standart Forms of Expression

17

Single-Variable Theorems

Page 18: Boolean Algebra and  Standart Forms of Expression

18

00110

111

000

1'0

01

XX

XX

10110

000

111

0'1

10

XX

XX

(a) Keep axioms handy

(b) Elaborate cases:

if X = 0, haveX + 0 = 0 + 0 = 0 = X

if X = 1, haveX + 0 = 1 + 0 = 1 = X

Prove X + 0 = X

Page 19: Boolean Algebra and  Standart Forms of Expression

19

Duality Principle of Boolean Algebra• How to apply the duality principle?

– 1’s and 0’s are interchanged.

– AND or OR operators are interchanged.

– Variables are left unchanged.

• Dual theorem is still true!

Page 20: Boolean Algebra and  Standart Forms of Expression

20

Two- and Three-Variable Theorems

(T12) X + X’ . Y = X + Y (T12’) X . (X’ + Y) = X.Y

Page 21: Boolean Algebra and  Standart Forms of Expression

21

Prove (X.Y).Z=X.(Y.Z)

Same outputSame output

Page 22: Boolean Algebra and  Standart Forms of Expression

22

Prove (X.Y)+(X.Z)=X.(Y+Z)

Same outputSame output

Page 23: Boolean Algebra and  Standart Forms of Expression

23

DeMorgan’s Theorem

• (x + y)’ = x’y’ <=> (x . y)’ = x’ + y’

• General form of the DeMorgan’s theorem:

x y x + y (x + y)’ x y x’ y’ x’y’

0 0 0 1 0 0 1 1 10 1 1 0 0 1 1 0 01 0 1 0 1 0 0 1 01 1 1 0 1 1 0 0 0

nn XXXXXX ...... 2121

nn XXXXXX ....... 2121

)X ... ,X , ,G( )X ... ,X , ,(F n1n1

Page 24: Boolean Algebra and  Standart Forms of Expression

24

Complementing a Function Algebraically

• You can use DeMorgan’s law to find out the complement of a Boolean Function

f(x,y,z)= x(y’z’ + yz) f’(x,y,z) = ( x(y’z’ + yz) )’ [ complement both sides ]

= x’ + (y’z’ + yz)’ [ because (xy)’ = x’ + y’ ] = x’ + (y’z’)’ (yz)’ [ because (x + y)’ = x’ y’ ] = x’ + (y + z)(y’ + z’) [ because (xy)’ = x’ + y’, twice]

Page 25: Boolean Algebra and  Standart Forms of Expression

25

Logic Expression Minimization

• Goal is to find an equivalent of an original logic expression that:– has fewer variables per term

– has fewer terms

– needs less logic to implement

• There are three main manual methods– Algebraic minimization

– Karnaugh Map minimization

– Quine-McCluskey (tabular) minimization

Page 26: Boolean Algebra and  Standart Forms of Expression

26

Algebraic Minimization

• Process is to apply the switching algebra postulates, laws, and theorems to transform the original expression– Hard to recognize when a particular law can be applied

– Difficult to know if resulting expression is truly minimal

– Very easy to make a mistake• Incorrect complementation

• Dropped variables

Page 27: Boolean Algebra and  Standart Forms of Expression

27

• Adjacency is easy to use; very powerful– Look for two terms that are identical except for one

variable

– Application removes one term and one variable from the remaining term

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

Minimization via Adjacency

Page 28: Boolean Algebra and  Standart Forms of Expression

28

Simplification with Axioms

x’y’ + xyz + x’y [T8; x’y’ + x’y = x’(y’ + y) ]= x’(y’ + y) + xyz [T5; y’ + y = 1 ]= x’. 1 + xyz [T1’; x’. 1 = x’ ]= x’ + xyz [T8: x’ + xyz = (x’ + x) (x’ + yz)]= (x’ + x)(x’ + yz) [T5; x’ + x = 1 ]= 1 . (x’ + yz) [T1’: 1 . (x’ + yz) = x’ + yz]= x’ + yz [Axiom 2 ]

(T12) X + X’ . Y = X + Y (T12’) X . (X’ + Y) = X.Y

Page 29: Boolean Algebra and  Standart Forms of Expression

29

Proving Consensus Theorem

• XY + X’Z + YZ [T1’: YZ.1 = YZ]= XY + X’Z + YZ. 1 [T5: X + X’ = 1]= XY + X’Z + YZ(X + X’) [T8: YZ(X + X’) = XYZ + X’YZ]= XY + X’Z + XYZ + X’YZ= XY.1 + XYZ + X’Z.1 + X’YZ [T1’: XY.1 = XY, X’Z.1 = X’Z]= XY(1 + Z) + X’Z(1 + Y) [T8: XY.1+ XYZ = XY(1 + Z)]= XY + X’Z

(T12) X + X’ . Y = X + Y (T12’) X . (X’ + Y) = X.Y

Page 30: Boolean Algebra and  Standart Forms of Expression

30

Boolean Expressions and Circuits

• Any Boolean expression can be converted into a circuit by combining basic gates.

• The precedences are explicit in a circuit. – Make sure that the hardware does operations in the right

order!

(x + y’).z + x’

Page 31: Boolean Algebra and  Standart Forms of Expression

31

How Simplification Helps?

• Here are two differentbut equivalent circuits

• In general the one with fewer gates is “better”:– It costs less to build

– It requires less power

– But we had to do some work to find the second form

x’y’ + xyz + x’y = x’(y’ + y) + xyz= x’1 + xyz= x’ + xyz= (x’ + x)(x’ + yz)= 1 (x’ + yz)= x’ + yz

Page 32: Boolean Algebra and  Standart Forms of Expression

32

Another Example

F= X’YZ+ X’YZ’+XZ = X’Y(Z+Z’)+XZ = X’Y . 1 + XZ = X’Y+ XZ

Page 33: Boolean Algebra and  Standart Forms of Expression

33

Standard Expression Forms

• Two standard expression forms:– Sum-of-products

• Sum-of-minterms

• OR of AND terms

– Product-of-sums• Product-of-maxterms

• AND of OR terms

Page 34: Boolean Algebra and  Standart Forms of Expression

34

Minterms

• A minterm is a special product of literals

– Each input variable, either complemented or uncomplemented, appears exactly once

– Each minterm is 1 for exactly one combination of inputs, and 0 for the others

• A function with n variables has 2n minterms (since each variable can appear complemented or not)

– A three-variable function, such as f(x,y,z), has 23 = 8 minterms

Page 35: Boolean Algebra and  Standart Forms of Expression

35

Minterms

Page 36: Boolean Algebra and  Standart Forms of Expression

36

Sum of Minterms Form

• Every function can be written as a sum of minterms– A special kind of sum of products form

• The sum of minterms form for any function is unique

• Converting a truth table to sum of minterms form:– Logical sum of all the minterms that produce a 1 in the truth

table

Page 37: Boolean Algebra and  Standart Forms of Expression

37

Sum of Minterms Form

x y z f (x,y,z) f ’(x,y,z)

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

f = x’y’z’ + x’y’z + x’yz’ + x’yz + xyz’= m0 + m1 + m2 + m3 + m6

= m(0,1,2,3,6)

f’ = xy’z’ + xy’z + xyz

= m4 + m5 + m7

= m(4,5,7)f’ contains all the minterms not in f

• A function that includes all the 2^n minterms is equal to logic 1

G(X,Y)= m(0,1,2,3)= 1

Page 38: Boolean Algebra and  Standart Forms of Expression

38

Sum of Products Form

• The sum-of-minterms form is a standard algebraic expression that is obtained from a truth table

• When we simplify a function in SoM form by – reducing the number of product terms or

– reducing the number of literals in the terms

the simplified expression is said to be in Sum-of-Products form

Page 39: Boolean Algebra and  Standart Forms of Expression

39

Sum of Products Form

• Sum of products expression can be implemented using a two-level circuit– literals and their complements at the “0th” level

– AND gates at the first level

– a single OR gate at the second level

F= m(0,1,2,3,4,5,7) (SoM)

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

Page 40: Boolean Algebra and  Standart Forms of Expression

40

Maxterms

• A maxterm is a special sum of literals

– Each input variable, either complemented or uncomplemented, appears exactly once

– Each maxterm is 0 for exactly one combination of inputs, and 1 for the others

• A function with n variables has 2n maxterms

Page 41: Boolean Algebra and  Standart Forms of Expression

41

Maxterms

Page 42: Boolean Algebra and  Standart Forms of Expression

42

Product of Maxterms Form

• Every function can be written as a product of maxterms– A special kind of product of sums form

• The product of sums form for any function is unique

• Converting a truth table to product of maxterms form:– Logical product of all the maxterms that produce a 0 in the

truth table

Page 43: Boolean Algebra and  Standart Forms of Expression

43

Product of Maxterms Form

x y z f (x,y,z) f ’(x,y,z)

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

f = (x’ + y + z)(x’ + y + z’)(x’ + y’ + z’)= M4 M5 M7

= ∏M(4,5,7)

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

(x + y’ + z’)(x’ + y’ + z)= M0 M1 M2 M3 M6

= ∏ M(0,1,2,3,6)f’ contains all the maxterms not in f

• A function that includes all the 2^n maxterms is equal to logic 0

G(X,Y)= ∏ m(0,1,2,3)= 0

Page 44: Boolean Algebra and  Standart Forms of Expression

44

Product of Sums Form

• The product-of-maxterms form is a standard algebraic expression that is obtained from a truth table

• When we simplify a function in PoM form by – reducing the number of sum terms or

– reducing the number of literals in the terms,

the simplified expression is said to be in Product-of-Sums form

Page 45: Boolean Algebra and  Standart Forms of Expression

45

Products of Sums Form

• Product of sums expression can be implemented using a two-level circuit– literals and their complements at the “0th” level

– OR gates at the first level

– a single AND gate at the second level

F= ∏ M(0,2,3,4,5,6) (PoM)

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

Page 46: Boolean Algebra and  Standart Forms of Expression

46

Minterms and maxterms are related• Any minterm mi is the complement of the corresponding

maxterm Mi

• For example, m4’ = M4 because (xy’z’)’ = x’ + y + z

Maxterm Shorthandx + y + z M0

x + y + z’ M1

x + y’ + z M2

x + y’ + z’ M3

x’ + y + z M4

x’ + y + z’ M5

x’ + y’ + z M6

x’ + y’ + z’ M7

Minterm Shorthandx’y’z’ m0

x’y’z m1

x’yz’ m2

x’yz m3

xy’z’ m4

xy’z m5

xyz’ m6

xyz m7

Page 47: Boolean Algebra and  Standart Forms of Expression

47

Converting Between Standard Forms• We can convert a sum of minterms to a product of maxterms

• In general, just replace the minterms with maxterms, using maxterm numbers that don’t appear in the sum of minterms:

• The same thing works for converting from a product of maxterms to a sum of minterms

From before f = m(0,1,2,3,6)and f’ = m(4,5,7)

= m4 + m5 + m7

complementing (f’)’ = (m4 + m5 + m7)’so f = m4’ m5’ m7’ [ DeMorgan’s law ]

= M4 M5 M7 [ By the previous page ]

= ∏ M(4,5,7)

f = m(0,1,2,3,6)= ∏ M(4,5,7)

Page 48: Boolean Algebra and  Standart Forms of Expression

48

Other Gates

•NAND gate:

•NOR gate:

Page 49: Boolean Algebra and  Standart Forms of Expression

49

NAND and NOR

• Both NAND and NOR are universal gates

• Universal gate: A gate that alone can be used to implement all Boolean functions

• It is sufficient to show that NAND (NOR) can be used to implement AND, OR, and NOT operations

Page 50: Boolean Algebra and  Standart Forms of Expression

50

NANDs are universal!

– NOT

– AND

– OR

(xx)’ = x’ [ because xx = x ]

((xy)’ (xy)’)’ = xy [ from NOT above ]

((xx)’ (yy)’)’= (x’ y’)’ [ xx = x, and yy = y ]= x + y [ DeMorgan’s law ]

Page 51: Boolean Algebra and  Standart Forms of Expression

51

Other Gates

•XOR gate:

•XNOR gate:

Page 52: Boolean Algebra and  Standart Forms of Expression

52

More on XOR

• Exclusive-OR (XOR): X Y = XY’ + X’Y

X 0 = X X 1 = X’

X X = 0 X X’ = 1

X Y’ = (X Y)’ X’ Y = (X Y)’

X Y = Y X

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

Page 53: Boolean Algebra and  Standart Forms of Expression

53

More on XOR

• The general XOR function is true when an odd number of its arguments are true

• For example, we can use Boolean algebra to simplify a three-input XOR to the following expression and truth table.

x (y z)= x (y’z + yz’) [ Definition of XOR ]= x’(y’z + yz’) + x(y’z + yz’)’ [ Definition of XOR ]= x’y’z + x’yz’ + x(y’z + yz’)’ [ Distributive ]= x’y’z + x’yz’ + x((y’z)’ (yz’)’) [ DeMorgan’s ]= x’y’z + x’yz’ + x((y + z’)(y’ + z)) [ DeMorgan’s ]= x’y’z + x’yz’ + x(yz + y’z’) [ Distributive ]= x’y’z + x’yz’ + xyz + xy’z’ [ Distributive ]

x y z xyz

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

Page 54: Boolean Algebra and  Standart Forms of Expression

54

Avoid This Configuration

• The exact output voltage is about 1-2 V.

• After a few seconds, the chip will have internal damage

Page 55: Boolean Algebra and  Standart Forms of Expression

55

Three-State Outputs

• Logic outputs have two normal states, LOW and HIGH, corresponding to logic values 0 and 1.– The output is strongly connected to either Vcc or Gnd

• Some outputs have a third electrical state: – High-Impedance, Hi-Z, or floating state

• In Hi-Z state:– The output behaves as an open-circuit, i.e., it appears to

be disconnected from the circuit

– There is a leakage current of up to 10 μA.

• An output with three possible states is called a three-state output or tri-state output.

Page 56: Boolean Algebra and  Standart Forms of Expression

56

Three-State Outputs

• When EN = 1, NAND and NOR both act like inverters ==> A appears on output

• When EN = 0, NAND output is 1 regardless of A - NOR output is 0 regardless of A

==> both output transistors are off==> output is isolated from both ground and

power

Page 57: Boolean Algebra and  Standart Forms of Expression

57

Tri-State Bus

Controlcircuit

Page 58: Boolean Algebra and  Standart Forms of Expression

58

Summary

• So far:– A bunch of Boolean algebra trickery for simplifying

expressions and circuits

– The algebra guarantees us that the simplified circuit is equivalent to the original one

– Introducing some standard forms and terminology

• Next:– An alternative simplification method

– We’ll start using all this stuff to build and analyze bigger, more useful, circuits