CT455: Computer Organization Boolean Algebra. Lecture 3: Boolean Algebra Digital circuits Digital...

Preview:

Citation preview

CT455: CT455: Computer OrganizationComputer Organization

Boolean AlgebraBoolean Algebra

Lecture 3: Boolean AlgebraLecture 3: Boolean Algebra

Digital circuitsDigital circuits

Boolean AlgebraBoolean Algebra

Two-Valued Boolean AlgebraTwo-Valued Boolean Algebra

Boolean Algebra PostulatesBoolean Algebra Postulates

Precedence of OperatorsPrecedence of Operators

Truth Table & ProofsTruth Table & Proofs

DualityDuality

Lecture 3: Boolean AlgebraLecture 3: Boolean Algebra

Basic Theorems of Boolean AlgebraBasic Theorems of Boolean Algebra

Boolean FunctionsBoolean Functions

Complement of FunctionsComplement of Functions

Standard FormsStandard Forms

MintermMinterm & & MaxtermMaxterm

Canonical FormsCanonical Forms

Conversion of Canonical FormsConversion of Canonical Forms

Binary FunctionsBinary Functions

Digital CircuitsDigital Circuits Digital circuitDigital circuit can be represented by a black-box with can be represented by a black-box with

inputs on one side, and outputs on the other.inputs on one side, and outputs on the other.

The input/output signals are discrete/digital in nature, typically with two distinct voltages (a high voltage and a low voltage).

In contrast, analog circuits use continuous signals.

Digital circuit

inputs outputs: :

High

Low

Digital CircuitsDigital Circuits

Advantages of Digital Circuits over Analog CircuitsAdvantages of Digital Circuits over Analog Circuits:: more reliable (simpler circuits, less noise-prone)more reliable (simpler circuits, less noise-prone) specified accuracy (determinable)specified accuracy (determinable) but slower response time (sampling rate)but slower response time (sampling rate)

Important advantages for two-valued Digital Circuit:Important advantages for two-valued Digital Circuit: Mathematical Model – Boolean AlgebraMathematical Model – Boolean Algebra Can help Can help designdesign, , analyseanalyse, , simplifysimplify Digital Circuits. Digital Circuits.

Boolean AlgebraBoolean Algebra

Boolean AlgebraBoolean Algebra named after George Boole who used named after George Boole who used it to study human logical reasoning – calculus of it to study human logical reasoning – calculus of proposition.proposition.

Events : Events : truetrue or or falsefalse

Connectives : a Connectives : a OROR b; a b; a ANDAND b, b, NOTNOT a a

Example: Either “it has rained” Example: Either “it has rained” OROR “someone “someone splashed water”, “must be tall” splashed water”, “must be tall” ANDAND “good vision”. “good vision”.

What is an Algebra? (e.g. algebra of integers)set of elements (e.g. 0,1,2,..)set of operations (e.g. +, -, *,..)postulates/axioms (e.g. 0+x=x,..)

Boolean AlgebraBoolean Algebraa b a AND b F F F F T F T F F T T T

a b a OR b F F F F T T T F T T T T

a NOT a F T T F

Later, Shannon introduced switching algebra (two-valued Boolean algebra) to represent bi-stable switching circuit.

Two-valued Boolean AlgebraTwo-valued Boolean Algebra

Set of Elements: {0,1}Set of Elements: {0,1}

Set of Operations: { ., + , ¬ }Set of Operations: { ., + , ¬ }

x y x . y0 0 00 1 01 0 01 1 1

x y x + y0 0 00 1 11 0 11 1 1

x ¬x0 11 0

Signals: High = 5V = 1; Low = 0V = 0

x

yx.y

x

yx+y x x'

Sometimes denoted by ’, for example a’

Boolean Algebra PostulatesBoolean Algebra Postulates

Commutative lawsCommutative laws:: A + B = B + A A + B = B + A A . B = B . A A . B = B . A

A A Boolean algebraBoolean algebra consists of a set of elements B, with two binary operations {+} and {.} and a unary operation {'}, such that the following axioms hold:

Boolean Algebra PostulatesBoolean Algebra Postulates Associative lawsAssociative laws: :

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

Distributive lawsDistributive laws:: A . (B + C) = (A . B) + (A . C) A . (B + C) = (A . B) + (A . C) A + (B . C) = (A + B) . (A + C) A + (B . C) = (A + B) . (A + C)

Boolean Algebra PostulatesBoolean Algebra Postulates

ComplementComplement: For every x in : For every x in BB, there , there exists an element x' in exists an element x' in BB such that such that x + x' = 1x + x' = 1 x . x' = 0x . x' = 0

Precedence of OperatorsPrecedence of Operators To lessen the brackets used in writing Boolean To lessen the brackets used in writing Boolean

expressions, expressions, operator precedenceoperator precedence can be used. can be used.

Precedence (highest to lowest): ' . + Precedence (highest to lowest): ' . +

Examples:Examples:

a . b + c = (a . b) + ca . b + c = (a . b) + c

b' + c = (b') + cb' + c = (b') + c

a + b' . c = a + ((b') . c)a + b' . c = a + ((b') . c)

Precedence of OperatorsPrecedence of Operators

Use brackets to overwrite precedence.Use brackets to overwrite precedence.

Examples:Examples:

a . (b + c)a . (b + c)

(a + b)' . c(a + b)' . c

Rules for Boolean Algebra

1. A + 0 = A

2. A + 1 = 1

3. A . 0 = 0

4. A . 1 = A

5. A + A = A

6. A + A’ = 1

7. A . A = A

8. A . A’ = 0

9. (A’)’ = A

10. A + AB = A

11. A + A’B = A + B

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

10. A + AB = A

A + AB = A(1 + B) DISTRIBUTIVE LAW

= A . 1 RULE 2

= A RULE 4

AA BB ABAB A+ABA+AB

00

00

11

11

00

11

00

11

00

00

00

11

00

00

11

11

Theorem 10 (Absorption)

(a) a + ab = a (b) a(a + b) = a

Examples:

(X + Y) + (X + Y)Z = X + Y [T4(a)]

AB'(AB' + B'C) = AB' [T4(b)]

11. A + A’B = A + B

A + A’B = (A + AB) + A’B

= (AA + AB) + A’B

= AA + AB + AA’ + A’B

= (A + A’)(A + B)

= 1. (A + B)

= ( A + B)

AA BB A’BA’B A+A’A+A’BB

A+BA+B

00

00

11

11

00

11

00

11

00

11

00

00

00

11

11

11

00

11

11

11

Theorem 11

(a) a + a'b = a + b (b) a(a' + b) = ab

Examples:

B + AB'C'D = B + AC'D[T11(a)]

(X + Y)((X + Y)' + Z) = (X + Y)Z [T11(b)]

11. A + A’B = A + B

เปลี่��ยนเป�นรูปอื่��นๆได้�

A + A’B’ = A + B’

A’ + AB = A + B

A + A’BC = A + BC

(AB)’ + ABCD = (AB)’ + CD

12. (A + B)(B + C) = AA + AC + AB + BC

= A + AC + AB + BC

= A(1+C) + AB + BC

= A.1 + AB + BC

= A(1+B) +BC

= A.1 +BC

= A . BC

A B CA B C A+BA+B A+CA+C (A+B)(A+C)(A+B)(A+C) BC A+BCBC A+BC

0 0 00 0 0

0 0 10 0 1

0 1 00 1 0

0 1 10 1 1

1 0 01 0 0

1 0 11 0 1

1 1 01 1 0

1 1 11 1 1

00

00

11

11

11

11

11

11

00

11

00

11

11

11

11

11

00

00

00

11

11

11

11

11

0 00 0

0 00 0

0 00 0

1 11 1

0 10 1

0 10 1

0 10 1

1 11 1

Theorem (a) ab + ab' = a (b) (a + b)(a + b') = a

Examples:ABC + AB'C = AC [T6(a)]

(W' + X' + Y' + Z')(W' + X' + Y' + Z)(W' + X' + Y + Z')(W' + X' + Y + Z)

= (W' + X' + Y')(W' + X' + Y + Z')(W' + X' + Y + Z)

= (W' + X' + Y')(W' + X' + Y)

= (W' + X')

Theorem 7(a) ab + ab'c = ab + ac (b) (a + b)(a + b' + c) = (a +

b)(a + c)

Examples:wy' + wx'y + wxyz + wxz' = wy' + wx'y + wxy + wxz' [T7(a)]

= wy' + wy + wxz' [T7(a)]

= w + wxz' [T7(a)]

= w [T7(a)]

(x'y' + z)(w + x'y' + z') = (x'y' + z)(w + x'y') [T7(b)]

Basic Theorems of Boolean Basic Theorems of Boolean AlgebraAlgebra

6. 6. DeMorgan.DeMorgan.

(a) (x + y)' = x'.y'(a) (x + y)' = x'.y'

(b) (x.y)' = x' + y'(b) (x.y)' = x' + y'

7. 7. Consensus.Consensus.

(a) x.y + x'.z + y.z = x.y + x'.z(a) x.y + x'.z + y.z = x.y + x'.z

(b) (x+y).(x'+z).(y+z) = (x+y).(x'+z)(b) (x+y).(x'+z).(y+z) = (x+y).(x'+z)

Laws of Boolean AlgebraLaws of Boolean AlgebraDeMorgan's Law

(X + Y)' = X' Y'

(X Y)' = X' + Y'

NOR is equivalent to ANDwith inputs complemented

NAND is equivalent to ORwith inputs complemented

Example:Z = A' B' C + A' B C + A B' C + A B C’ AND - OR = {(A’B’C)’ (A’BC)’ (AB’C)’ (ABC’)’ } ‘ NAND - NAND

Z' = (A + B + C') (A + B' + C') (A' + B + C') (A' + B' + C)

DeMorgan's Law can be used to convert AND/OR expressionsto OR/AND expressions or NAND/NAND expression

DeMorgan's Law can be used to convert AND/OR expressionsto OR/AND expressions or NAND/NAND expression

X 0 0 1 1

Y 0 1 0 1

X 1 1 0 0

Y 1 0 1 0

X + Y 1 0 0 0

X•Y 1 0 0 0

X 0 0 1 1

Y 0 1 0 1

X 1 1 0 0

Y 1 0 1 0

X + Y 1 1 1 0

X•Y 1 1 1 0

Theorem 8 (DeMorgan's Theorem)Theorem 8 (DeMorgan's Theorem)

(a) ((a) (a + ba + b)' = )' = aa''bb'' (b) ((b) (abab)' = )' = aa' + ' + bb''

Generalized DeMorgan's TheoremGeneralized DeMorgan's Theorem

(a) ((a) (a + b + … za + b + … z)' = )' = aa''bb'' … z … z'' (b) ((b) (ab … zab … z)' = )' = aa'' + b + b'' + … + … zz''

ExamplesExamples:: ((a + bca + bc)')' = (= (a + a + ((bcbc))'))'

= = aa'('(bcbc)')' [T8(a)][T8(a)]

= = aa'('(bb'' + c + c')') [T8(b)][T8(b)]

= = aa''bb'' + a + a''cc'' [P5(b)][P5(b)] Note: (Note: (a + bca + bc)' ¹ )' ¹ aa''bb' + ' + cc''

More Examples for DeMorgan's TheoremMore Examples for DeMorgan's Theorem ((aa((bb + + zz((xx + + aa')))' ')))' = = aa' + (' + (bb + + zz((xx + + aa'))''))' [T8(b)][T8(b)]

= = aa' + ' + bb' (' (zz((xx + + aa'))''))' [T8(a)][T8(a)]

= = aa' + ' + bb' (' (zz' + (' + (xx + + aa')')')') [T8(b)][T8(b)]

= = aa' + ' + bb' (' (zz' + ' + xx'('(aa')')')') [T8(a)][T8(a)]

= = aa' + ' + bb' (' (zz' + ' + xx''aa)) [T3][T3]

= = aa' + ' + bb' (' (zz' + ' + xx')') [T5(a)][T5(a)]

((aa((b + cb + c)) + a + a''bb)')' = (= (ab + ac + aab + ac + a''bb)')' [P5(b)][P5(b)]

= = ((b + acb + ac)')' [T6(a)][T6(a)]

= = bb'('(acac)')' [T8(a)][T8(a)]

= b= b'('(aa' + ' + cc')') [T8(b)][T8(b)]

Truth TableTruth Table Provides a Provides a listinglisting of every possible combination of every possible combination

of inputs and its corresponding outputs.of inputs and its corresponding outputs.

Example (2 inputs, 2 outputs):Example (2 inputs, 2 outputs):

x y x . y x + y 0 0 0 0 0 1 0 1 1 0 0 1 1 1 1 1

INPUTS OUTPUTS … … … …

Switching Functions Switching Functions

Switching algebraSwitching algebra: Boolean algebra with the set of elements : Boolean algebra with the set of elements KK = {0, = {0, 1}1}

If there are If there are nn variables, we can define switching functions. variables, we can define switching functions.

Sixteen functions of two variables (Table 2.3):Sixteen functions of two variables (Table 2.3):

A switching function can be represented by a table as above, or by a switching A switching function can be represented by a table as above, or by a switching expression as follows:expression as follows:

ff00((AA,,BB))= = 0, 0, ff66((AA,,BB)) = AB = AB'' + A + A''BB, , ff1111((AA,,BB)) = AB + A = AB + A''B + AB + A''BB'' = A = A'' + B + B, ..., ...

Value of a function can be obtained by plugging in the values of all variables: Value of a function can be obtained by plugging in the values of all variables:

The value of The value of ff66 when A = 1 and B = 0 is: = 0 + 1 = 1. when A = 1 and B = 0 is: = 0 + 1 = 1.

22n

AB f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15

00 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

01 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1

10 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1

11 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

1 0 1 0 ' '

Truth Tables (1)Truth Tables (1)

Shows the value of a function for all possible input Shows the value of a function for all possible input combinations.combinations.

Truth tables for OR, AND, and NOT (Table 2.4):Truth tables for OR, AND, and NOT (Table 2.4):

ab f(a,b)=a+b ab f(a,b)=ab a f(a)=a'

00 0 00 0 0 1

01 1 01 0 1 0

10 1 10 0

11 1 11 1

Truth Tables (2)Truth Tables (2)

Truth tables for Truth tables for ff((AA,,BB,,CC)) = AB + A = AB + A''C + ACC + AC' ' (Table 2.5)(Table 2.5)

ABC f(A,B,C) ABC f(A,B,C)

000 0 FFF F

001 1 FFT T

010 0 FTF F

011 1 FTT T

100 1 TFF T

101 0 TFT F

110 1 TTF T

111 1 TTT T

Truth TableTruth Table Example (3 inputs, 2 outputs):Example (3 inputs, 2 outputs):

x y z y + z x.(y + z) 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 1 0 1 0 0 0 0 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1

Proof using Truth TableProof using Truth Table Can use truth table to prove by perfect induction.Can use truth table to prove by perfect induction. Prove that: x . (y + z) = (x . y) + (x . z)Prove that: x . (y + z) = (x . y) + (x . z)(i) Construct truth table for LHS & RHS of above equality.(i) Construct truth table for LHS & RHS of above equality.

(ii) Check that LHS = RHS(ii) Check that LHS = RHSPostulate is SATISFIED because output column 2 & 5 (for Postulate is SATISFIED because output column 2 & 5 (for LHS & RHS expressions) are equal for all cases.LHS & RHS expressions) are equal for all cases.

x y z y + z x.(y + z) x.y x.z (x.y)+(x.z) 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1

Basic Theorems of Boolean AlgebraBasic Theorems of Boolean Algebra

Apart from the axioms/postulates, there are other useful Apart from the axioms/postulates, there are other useful theorems.theorems.

1.1. Idempotency. Idempotency.

(a) x + x = x (b) x . x = x(a) x + x = x (b) x . x = x

Proof of (a):Proof of (a):

x + x = (x + x).1x + x = (x + x).1 (identity) (identity)

= (x + x).(x + x')= (x + x).(x + x') (complementarity) (complementarity)

= x + x.x'= x + x.x' (distributivity) (distributivity)

= x + 0= x + 0 (complementarity) (complementarity)

= x= x (identity) (identity)

Basic Theorems of Boolean AlgebraBasic Theorems of Boolean Algebra

2. 2. Null elements for + and . operators.Null elements for + and . operators.

(a) x + 1 = 1 (a) x + 1 = 1 (b) x . 0 = 0(b) x . 0 = 0

3. 3. Involution.Involution. (x')' = x (x')' = x

4. 4. Absorption.Absorption.

(a) x + x.y = x(a) x + x.y = x (b) x.(x + y) = x(b) x.(x + y) = x

5. 5. AbsorptionAbsorption (variant). (variant).

(a) x + x'.y = x+y(a) x + x'.y = x+y (b) x.(x' + y) = x.y(b) x.(x' + y) = x.y

Basic Theorems of Boolean AlgebraBasic Theorems of Boolean Algebra

Theorem 4a (absorption) can be proved by:Theorem 4a (absorption) can be proved by:

x + x.y = x.1 + x.y (identity)x + x.y = x.1 + x.y (identity) = x.(1 + y) (distributivity)= x.(1 + y) (distributivity) = x.(y + 1) = x.(y + 1) (commutativity)(commutativity)

= x.1 (Theorem 2a)= x.1 (Theorem 2a) = x (identity)= x (identity) By duality, theorem 4b:By duality, theorem 4b:

x.(x+y) = xx.(x+y) = x Try prove this by algebraic manipulation.Try prove this by algebraic manipulation.

Boolean FunctionsBoolean Functions

Boolean functionBoolean function is an expression formed with is an expression formed with binary variables, the two binary operators, OR binary variables, the two binary operators, OR and AND, and the unary operator, NOT, and AND, and the unary operator, NOT, parenthesis and the equal sign.parenthesis and the equal sign.

Its result is also a binary value.Its result is also a binary value.

We usually use . for AND, + for OR, and ' or ¬ for We usually use . for AND, + for OR, and ' or ¬ for NOT. Sometimes, we may omit the . if there is no NOT. Sometimes, we may omit the . if there is no ambiguity.ambiguity.

Boolean FunctionsBoolean Functions

Examples:Examples: F1= x.y.z'F1= x.y.z' F2= x + y'.zF2= x + y'.z F3=(x'.y'.z)+(x'.y.z)+(x.y')F3=(x'.y'.z)+(x'.y.z)+(x.y') F4=x.y'+x'.zF4=x.y'+x'.z

x y z F1 F2 F3 F4 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 1 1 0 0 0 1 1 1 1 0 1 0 1 1 1 1 1 0 1 1 0 0 1 1 1 0 1 0 0

From the truth table, F3=F4.Can you also prove by algebraic manipulation that F3=F4?

CS1103CS1103 Chapter 3: Boolean Algebra/Logic GateChapter 3: Boolean Algebra/Logic Gatess

Simplifying logic expressions

EXAMPLE

• A(A+B) = AA + AB

= A + AB

= A(1 + B)

= A

• A(A’ + B) = AA’ + AB

= AB

• ( AB + A’B’)’ = (A’ + B’)(A + B)

= A’A + A’B + AB’ + BB’

= AB’ + A’B

CS1103CS1103 Chapter 3: Boolean Algebra/Logic GateChapter 3: Boolean Algebra/Logic Gatess

X = ABC + ABC’

= AB ( C + C’)

= AB.1

= AB

A = X(X’YZ + X’YZ’)

= XX’YZ + XX’YZ’

= 0.YZ + 0.YZ’

= 0

EXAMPLE AB’ + A’B = AB’+AA’+A’B+BB’

= A(B’+A’) + B(A’+B’)

= (A’+B’)(A+B)

= (AB)’(A+B)

A BA B AB’AB’ A’BA’B (AB)’(AB)’ A+BA+B

0 00 0

0 10 1

1 01 0

1 11 1

00

00

11

00

00

11

00

00

11

11

11

00

00

11

11

11

AB’+A’BAB’+A’B (AB)’(A+B)(AB)’(A+B)

00

11

11

00

00

11

11

00

EXAMPLE

Y = AB + A’B +A’B’

Y = B(A + A’) +A’B’

Y = B.1 +A’B’

Y = B +A’B’

Y = B +A’

CS1103CS1103 Chapter 3: Boolean Algebra/Logic GateChapter 3: Boolean Algebra/Logic Gatess

W = AB(A’C + B)

= ABA’C + ABB

= 0.BC + AB

= 0 + AB

= AB

Z = ( X.Y) + [( X’ . ( Y + X )]

Z = ( X.Y) + [( X’.Y) + (X.X’)]

Z = ( X.Y) + [( X’.Y) + (0)]

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

Z = Y. ( X + X’)

Z = Y. 1

Z = Y

Z = ( X.Y’) + [( X . Y ) + Y’ )]

Z = [( X . Y’ ).(X . Y )] + [( X . Y’ ) + Y’ )]

Z = [( X . X ).(Y . Y’ )] + [ X . (Y’ + Y’ )]

Z = [( X . X ).( 0 )] + [ X . (Y’ + Y’ )]

Z = 0 + [ X . Y’]

Z = X . Y’

Z = X + X’.Y + Y’.X’

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

Z = X + X’. (1)

Z = 1

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

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

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

Z = XY( Y’ + X’)

Z = XYY’ + XYX’

Z = 0 + 0

CS1103CS1103 Chapter 3: Boolean Algebra/Logic GateChapter 3: Boolean Algebra/Logic Gatess

Z = w( y + w )( x + y + w )

= (wy + ww)( x + y + w )

= (wy + w)( x + y + w )

= (w + wy)( x + y + w )

= w( x + y + w )

= wx + wy + ww

= wx + ( wy + w )

= wx + ( w + wy)

= wx + w

= w + wx

= w

Simplify

AB + BC(B + C)

AB + BBC + BCC

AB + BC + BC

AB + BC

B( A + C)

AB(A + B’C +C)

ABA + ABB’C + ABC

AB + ABB’C + ABC

AB + ABC

AB(1 + C)

AB

EXAMPLE

SIMPLIFY THE EXPRESSION

AB + A(B +C) + B(B + C) USING BOOLEAN ALGEBRA1. AB + AB + AC +BB + BC

2. AB + AB + AC + B + BC

3. AB + AC + B + BC

4. AB + AC + B(1 + C)

5 . AB + AC + B.1

6. AB + AC + B

7. B(A + 1) +AC

8. B.1 + AC

9. B + AC

SIMPLIFY THE EXPRESSION

[AB’(C + BD)+ A’B’]C USING BOOLEAN ALGEBRA

1. [AB’(C + BD)+ A’B’]C

2. (AB’C + AB’BD + A’B’)C

3. (AB’C + A.0.D + A’B’)C

4. (AB’C + 0 + A’B’)C

5. (AB’C + A’B’)C

6. AB’CC + A’B’C

7. AB’C + A’B’C

8. B’C(A + A’)

9. B’C.1

10.B’C

SIMPLIFY THE EXPRESSION

A’BC + AB’C’ + A’B’C’ + AB’C + ABC USING BOOLEAN ALGEBRA

A’BC + AB’C’ + A’B’C’ + AB’C + ABC

BC(A’ + A) + AB’C’ + A’B’C’ + AB’C

BC.1 + AB’(C’ + C) + A’B’C’

BC + AB’.1 + A’B’C’

BC + B’(A + A’C’)

BC + B’(A + C’)

BC + AB’ + B’C’

Gate Logic: Laws of Boolean AlgebraGate Logic: Laws of Boolean AlgebraApply the laws and theorems to simplify Boolean equations

Example: full adder's carry out functionCout = A' B Cin + A B' Cin + A B Cin' + A B Cin

= A' B Cin + A B' Cin + A B Cin' + A B Cin + A B Cin

= A' B Cin + A B Cin + A B' Cin + A B Cin' + A B Cin

= (A' + A) B Cin + A B' Cin + A B Cin' + A B Cin

= (1) B Cin + A B' Cin + A B Cin' + A B Cin

= B Cin + A B' Cin + A B Cin' + A B Cin + A B Cin

= B Cin + A B' Cin + A B Cin + A B Cin' + A B Cin

= B Cin + A (B' + B) Cin + A B Cin' + A B Cin

= B Cin + A (1) Cin + A B Cin' + A B Cin

= B Cin + A Cin + A B (Cin' + Cin)

= B Cin + A Cin + A B (1)

= B Cin + A Cin + A B

identity

associative

CS1103CS1103 Chapter 3: Boolean Algebra/Logic GateChapter 3: Boolean Algebra/Logic Gatess

Z = (x’ + y’) w’ + (xy)’

= ( x’ + y’ ) w’ + ( x’ + y’ )

= ( x’ + y’ ) w’ + ( x’ + y’ ) . 1

= ( x’ + y’ ) ( w’ + 1)

= ( x’ + y’ ) (1)

= x’ + y’

CS1103CS1103 Chapter 3: Boolean Algebra/Logic GateChapter 3: Boolean Algebra/Logic Gatess

M = (A’ + B’C’)’

= (A’)’ (B’)’(C’)’

= ABC

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

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

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

= A + B + CD

Complement of FunctionsComplement of Functions

Given a function, F, the Given a function, F, the complementcomplement of this function, of this function, F', is obtained by interchanging 1 with 0 in the F', is obtained by interchanging 1 with 0 in the function’s output values.function’s output values. x y z F1 F1'

0 0 0 0 1 0 0 1 0 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1 0 1 1 1 0 1 0 1 1 1 0 1

Example: F1 = xyz'

Complement: F1' = (x.y.z')' = x' + y' + (z')' DeMorgan = x' + y' + z Involution

Complement of FunctionsComplement of Functions

More general DeMorgan’s theorems useful for More general DeMorgan’s theorems useful for obtaining complement functions:obtaining complement functions:

(A + B + C + ... + Z)' (A + B + C + ... + Z)' = A' . B' . C' … . Z'= A' . B' . C' … . Z'

(A . B . C ... . Z)' (A . B . C ... . Z)' = A' + B' + C' + … + Z'= A' + B' + C' + … + Z'

Algebraic Forms of Switching Functions (1)Algebraic Forms of Switching Functions (1)

LiteralLiteral: A variable, complemented or uncomplemented.: A variable, complemented or uncomplemented.Product termProduct term: A literal or literals ANDed together.: A literal or literals ANDed together.Sum termSum term: A literal or literals ORed together.: A literal or literals ORed together.

SOP (Sum of Products)SOP (Sum of Products): : ORing product termsORing product termsff((AA, , BB, , CC) = ) = ABCABC + + AA''CC + + BB''CC

POS (Product of Sums)POS (Product of Sums)ANDing sum termsANDing sum termsff ( (AA, , BB, , CC) = () = (AA' + ' + BB' + ' + CC')(')(AA + + CC')(')(BB + + CC')')

Algebraic Forms of Switching Functions (2)Algebraic Forms of Switching Functions (2)

A A mintermminterm is a product term in which all the variables is a product term in which all the variables appear exactly once either complemented or appear exactly once either complemented or uncomplemented.uncomplemented.

Canonical Sum of Products Canonical Sum of Products ((canonical SOPcanonical SOP)):: Represented as a sum of minterms only.Represented as a sum of minterms only. ExampleExample: : ff11((AA,,BB,,CC)) = A = A''BCBC'' + ABC + ABC'' + A + A''BC + ABCBC + ABC (2.1)(2.1)

Minterms of three variables:Minterms of three variables:Minterm Minterm Code Minterm Number

A'B'C' 000 m0

A'B'C 001 m1

A'BC' 010 m2

A'BC 011 m3

AB'C' 100 m4

AB'C 101 m5

ABC' 110 m6

ABC 111 m7

Algebraic Forms of Switching Functions (3)Algebraic Forms of Switching Functions (3)

Compact form of canonical SOP form:Compact form of canonical SOP form:

ff11((AA,,BB,,CC)) = m = m22 + m + m33 + m + m66 + m + m77 (2.2)(2.2)

A further simplified form:A further simplified form:

ff11((AA,,BB,,CC)) = = m m (2,3,6,7) (minterm list form)(2,3,6,7) (minterm list form) (2.3)(2.3)

The The order of variablesorder of variables in the functional notation is important. in the functional notation is important.

Deriving truth table of Deriving truth table of ff11((AA,,BB,,CC) from minterm list:) from minterm list:Row No.

(i)InputsABC

Outputsf1(A,B,C)=m(2,3,6,7)

Complementf1'(A,B,C)=m(0,1,4,5)

0 000 0 1 m0

1 001 0 1 m1

2 010 1 m2 03 011 1 m3 04 100 0 1 m4

5 101 0 1 m5

6 110 1 m6 07 111 1 m7 0

Algebraic Forms of Switching Functions (4)Algebraic Forms of Switching Functions (4)

ExampleExample: Given : Given ff((AA,,BB,,QQ,,ZZ) = ) = AA''BB''QQ''ZZ'' + A + A''BB''QQ''Z + AZ + A''BQZBQZ'' + A + A''BQZBQZ, , express express ff((AA,,BB,,QQ,,ZZ) and ) and ff '( '(AA,,BB,,QQ,,ZZ) in minterm list form.) in minterm list form.

ff((AA,,BB,,QQ,,ZZ)) = = AA''BB''QQ''ZZ'' + A + A''BB''QQ''Z + AZ + A''BQZBQZ'' + A + A''BQZBQZ

= = mm00 + m + m11 + m + m66 + m + m77

= = mm(0, 1, 6, 7)(0, 1, 6, 7)

ff '( '(AA,,BB,,QQ,,ZZ)) = = mm22 + m + m33 + m + m44 + m + m55 + m + m88 + m + m99 + m + m1010 + m + m1111 + m + m1212

+ m+ m1313 + m + m1414 + m + m1515

= = mm(2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 14, 15)(2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 14, 15)

(2.6)(2.6)

AB + AB + ((ABAB)' = 1 and )' = 1 and AB + AAB + A'' + B + B'' = 1, but = 1, but AB + AAB + A''BB'' 1. 1.

mii

n

0

2 1

1

Algebraic Forms of Switching Functions (5)Algebraic Forms of Switching Functions (5)

A A maxtermmaxterm is a sum term in which all the variables appear is a sum term in which all the variables appear exactly once either complemented or uncomplemented.exactly once either complemented or uncomplemented.

Canonical Product of Sums Canonical Product of Sums ((canonical POScanonical POS)):: Represented as a product of maxterms only.Represented as a product of maxterms only. ExampleExample: : ff22((AA,,BB,,CC)) = = ((AA++B+CB+C)()(A+B+CA+B+C')(')(AA'+'+B+CB+C))

((AA'+'+BB++CC') (2.7)') (2.7)

Maxterms of three variables:Maxterms of three variables:

Maxterm Maxterm Code Maxterm NumberA+B+C 000 M0

A+B+C' 001 M1

A+B'+C 010 M2

A+B'+C' 011 M3

A'+B+C 100 M4

A'+B+C' 101 M5

A'+B'+C 110 M6

A'+B'+C' 111 M7

Algebraic Forms of Switching Functions (6)Algebraic Forms of Switching Functions (6)

ff22((AA,,BB,,CC)) = M = M00MM11MM44MM55 (2.8)(2.8)

= = MM(0,1,4,5) (maxterm list form)(0,1,4,5) (maxterm list form) (2.9)(2.9)

The truth table for The truth table for ff22((AA,,BB,,CC):):

Rwo No.(i)

InputsABC

M0

A+B+CM1

A+B+C'M4

A'+B+CM5

A'+B+C'Outputsf2(A,B,C)

0 000 0 1 1 1 01 001 1 0 1 1 02 010 1 1 1 1 13 011 1 1 1 1 14 100 1 1 0 1 05 101 1 1 1 0 06 110 1 1 1 1 17 111 1 1 1 1 1

Algebraic Forms of Switching Functions (7)Algebraic Forms of Switching Functions (7)

Truth tables of Truth tables of ff11((A,B,CA,B,C) of Eq. (2.3) and ) of Eq. (2.3) and ff22((A,B,CA,B,C) of Eq. (2.7) are identical.) of Eq. (2.7) are identical.

Hence, Hence, ff11((AA,,BB,,CC)) = = m m (2,3,6,7) (2,3,6,7)

= = ff22((A,B,CA,B,C))

= = MM(0,1,4,5) (0,1,4,5) (2.10)(2.10)

Example: GivenExample: Given ff((A,B,CA,B,C) = ( ) = ( A+B+CA+B+C')(')(A+BA+B'+'+CC')(')(AA''+B+C+B+C')(')(AA''+B+B''+C+C'), '), construct the truth table and express in both maxterm and minterm form.construct the truth table and express in both maxterm and minterm form.

ff((A,B,CA,B,C) = ) = MM11MM33MM55MM77 = = MM(1,3,5,7) = (1,3,5,7) = m m (0,2,4,6)(0,2,4,6)

Row No. (i)

InputsABC

Outputsf(A,B,C)= M(1,3,5,7) = m(0,2,4,6)

0 000 1 m0

1 001 0 M1

2 010 1 m2

3 011 0 M3

4 100 1 m4

5 101 0 M5

6 110 1 m6

7 111 0 M7

Algebraic Forms of Switching Functions (8)Algebraic Forms of Switching Functions (8)

Relationship between minterm Relationship between minterm mmii and maxterm and maxterm MMii::

For For ff((A,B,CA,B,C), (), (mm11)' = ()' = (A'B'CA'B'C)' =)' = A + B + C A + B + C' =' = M M11

In general, In general, ((mmii)' = )' = MMii (2.11)(2.11)

((MiMi)' = (()' = ((mmii)')' = )')' = mmii (2.12)(2.12)

Algebraic Forms of Switching Functions (9)Algebraic Forms of Switching Functions (9)

ExampleExample: Relationship between the maxterms for a function and its : Relationship between the maxterms for a function and its complement.complement.

For For ff((A,B,CA,B,C) = ( ) = ( A+B+CA+B+C')(')(A+BA+B'+'+CC')(')(AA''+B+C+B+C')(')(AA''+B+B''+C+C')') The truth table is:The truth table is:

Row No. (i)

InputsABC

Outputsf (A,B,C)

Outputsf '(A,B,C)= M(0,2,4,6)

0 000 1 0 M0

1 001 0 12 010 1 0 M2

3 011 0 14 100 1 0 M4

5 101 0 16 110 1 0 M6

7 111 0 1

Algebraic Forms of Switching Functions (10)Algebraic Forms of Switching Functions (10)

From the truth tableFrom the truth table

ff '( '(A,B,CA,B,C) = ) = MM(0,2,4,6) and (0,2,4,6) and ff((A,B,CA,B,C) = ) = MM(1,3,5,7) (1,3,5,7) Since Since ff((A,B,CA,B,C) ) ff '( '(A,B,CA,B,C) = 0, ) = 0,

((MM00MM22MM44MM66)()(MM11MM33MM55MM77) = 0 or ) = 0 or In general, In general, (2.13)(2.13) Another observation from the truth table:Another observation from the truth table:

ff((A,B,CA,B,C) = ) = m m (0,2,4,6) (0,2,4,6) = = MM(1,3,5,7) (1,3,5,7)

ff '( '(A,B,CA,B,C) = ) = m m (1,3,5,7) (1,3,5,7) = = MM(0,2,4,6)(0,2,4,6)

Mii

0

2 13

0

Mii

n

0

2 1

0

Derivation of Canonical Forms (1)Derivation of Canonical Forms (1)

Derive canonical POS or SOP using switching algebra.Derive canonical POS or SOP using switching algebra.

Theorem 10. Shannon's expansion theoremTheorem 10. Shannon's expansion theorem

(a). (a). ff((xx11, , xx22, …, , …, xxnn) = ) = xx11 ff(1, (1, xx22, …, , …, xxnn) + () + (xx11)' )' ff(0, (0, xx22, …, , …, xxnn))

(b). (b). ff((xx11, , xx22, …, , …, xxnn) = [) = [xx11 + + ff(0, (0, xx22, …, , …, xxnn)] [()] [(xx11)' + )' + ff(1, (1, xx22, …, , …, xxnn)])]

ExampleExample: : ff((A,B,CA,B,C) = ) = AB + ACAB + AC'' + A + A''CC ff((A,B,CA,B,C) = ) = AB + ACAB + AC'' + A + A''CC = = A fA f(1,(1,BB,,CC) + ) + AA' ' ff(0,(0,BB,,CC))

= = AA(1(1BB + 1 + 1CC' + 1'' + 1'CC) + ) + AA'(0'(0BB + 0 + 0CC' + 0'' + 0'CC) = ) = AA((B + CB + C') + ') + AA''CC ff((A,B,CA,B,C) = ) = AA((B + CB + C') + ') + AA''CC = = BB[[AA(1+(1+CC') + ') + AA''CC] + ] + BB'['[AA(0 + (0 + CC') + ') + AA''CC]]

= = BB[[AA + + AA''CC] + ] + BB'['[ACAC' + ' + AA''CC] = ] = ABAB + + AA''BCBC + + ABAB''CC' + ' + AA''BB''CC ff((A,B,CA,B,C) = ) = ABAB + + AA''BCBC + + ABAB''CC' + ' + AA''BB''CC

= = CC[[ABAB + + AA''BB1 + 1 + ABAB''1' + 1' + AA''BB''1] + 1] + CC'['[ABAB + + AA''BB0 + 0 + ABAB''0' + 0' + AA''BB''0] 0]

= = ABCABC + + AA''BCBC + + AA''BB''CC + + ABCABC' + ' + ABAB''CC''

Derivation of Canonical Forms (2)Derivation of Canonical Forms (2)

Alternative: Alternative: Use Theorem 6 to add missing literals.Use Theorem 6 to add missing literals.

ExampleExample: : ff((A,B,CA,B,C) = ) = AB + ACAB + AC'' + A + A''CC to canonical SOP form. to canonical SOP form. AB = ABCAB = ABC'' + ABC = m + ABC = m66 + m + m77

ACAC'' = AB = AB''CC'' + ABC + ABC'' = m = m44 + m + m66

AA''C = AC = A''BB''C + AC + A''BC = mBC = m11 + m + m33

Therefore,Therefore,

ff((A,B,CA,B,C) = () = (mm66 + m + m77) + () + (mm44 + m + m66) + () + (mm11 + m + m33) = ) = mm(1, 3, 4, 6, 7)(1, 3, 4, 6, 7)

ExampleExample: : ff((A,B,CA,B,C) = ) = AA((A + CA + C') to canonical POS form.') to canonical POS form. A = A = ((A+BA+B')(')(A+BA+B)) = = ((A+BA+B''+C+C')(')(A+BA+B''+C+C)()(A+B+CA+B+C')(')(A+B+CA+B+C))

= = MM33MM22MM11MM00

((A+CA+C')')= = ((A+BA+B''+C+C')(')(A+B+CA+B+C')') = M = M33MM11

Therefore,Therefore,

ff((A,B,CA,B,C) = () = (MM33MM22MM11MM00)()(MM33MM11)) = = MM(0, 1, 2, 3)(0, 1, 2, 3)

Incompletely Specified FunctionsIncompletely Specified Functions

A switching function may be incompletely specified.A switching function may be incompletely specified.

Some minterms are omitted, which are called Some minterms are omitted, which are called don't-care mintermsdon't-care minterms..

Don't cares arise in two ways:Don't cares arise in two ways: Certain input combinations never occur.Certain input combinations never occur. Output is required to be 1 or 0 only for certain combinations.Output is required to be 1 or 0 only for certain combinations.

Don't care minterms: Don't care minterms: ddi i Don't care maxterms: Don't care maxterms: DDii

ExampleExample: : ff((AA,,BB,,CC)) has minterms m has minterms m00, , mm33, and , and mm77 and don't-cares and don't-cares dd44 and and dd55.. Minterm list is: Minterm list is: ff((AA,,BB,,CC)) = = mm(0,3,7) + (0,3,7) + dd(4,5) (4,5) Maxterm list is: Maxterm list is: ff((AA,,BB,,CC)) = = MM(1,2,6)·(1,2,6)·DD(4,5)(4,5) ff '( '(AA,,BB,,CC) = ) = mm(1,2,6) + (1,2,6) + dd(4,5) = (4,5) = MM(0,3,7)·(0,3,7)·DD(4,5)(4,5) ff ( (AA,,BB,,CC)= )= AA''BB''CC'' + A + A''BC + ABC + dBC + ABC + d((ABAB''CC'' + AB + AB''CC))

= = BB''CC'' + BC + BC (use (use dd44 and omit and omit dd55))

Standard FormsStandard Forms

Sum TermSum Term: a single literal or a logical sum (OR) of several : a single literal or a logical sum (OR) of several literals.literals.

Examples: Examples: x, x+y+z', A'+B, A+B x, x+y+z', A'+B, A+B Sum-of-Products (SOP) ExpressionSum-of-Products (SOP) Expression: a product term or a : a product term or a

logical sum (OR) of several product terms.logical sum (OR) of several product terms.

Examples: Examples: x, x+y.z', x.y'+x‘.y.z, A.B+A'.B'x, x+y.z', x.y'+x‘.y.z, A.B+A'.B' Product-of-Sums (POS) ExpressionProduct-of-Sums (POS) Expression: a sum term or a logical : a sum term or a logical

product (AND) of several sum terms.product (AND) of several sum terms.

Exampes: Exampes: x, x.(y+z'), (x+y').(x'+y+z), (A+B).(A'+B')x, x.(y+z'), (x+y').(x'+y+z), (A+B).(A'+B')

Standard FormsStandard Forms

Every Boolean expression can either be expressed as Every Boolean expression can either be expressed as sum-of-products or product-of-sums expression.sum-of-products or product-of-sums expression.

Examples:Examples:

SOP:SOP: xx..yy + + x.yx.y + + x.y.zx.y.z

POS:POS: ((xx + + yy).().(xx + + yy).().(xx + + zz))both:both: xx + + yy + + zz or or x.y.zx.y.zneither:neither: x.x.((ww + + y.zy.z) or ) or zz + + w.xw.x..yy + + v.v.((x.zx.z + + ww))

Two Level Canonical FormsTwo Level Canonical FormsSum of Products

Shorthand Notation forMinterms of 3 Variables

product term / minterm:

ANDed product of literals in which eachvariable appears exactly once, in true orcomplemented form (but not both!)

F in canonical form:F(A,B,C) = m(3,4,5,6,7)

= m3 + m4 + m5 + m6 + m7= A' B C + A B' C' + A B' C + A B C' + A B C

canonical form/minimal formF = A B' (C + C') + A' B C + A B (C' + C)

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

2-Level AND/ORRealization

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

B

C

A

F

A B C = m 1 A B C = m 2 A B C = m 3 A B C = m 4 A B C = m 5 A B C = m 6 A B C = m 7

A

0 0 0 0 1 1 1 1

B

0 0 1 1 0 0 1 1

C

0 1 0 1 0 1 0 1

Minterms

A B C = m 0

2 Level Canonical Forms2 Level Canonical FormsProduct of Sums / Conjunctive Normal Form / Maxterm Expansion

Maxterm Shorthand Notationfor a Function of Three Variables

Maxterm:ORed sum of literals in which eachvariable appears exactly once in eithertrue or complemented form, but not both!

Maxterm form:Find truth table rows where F is 00 in input column implies true literal1 in input column implies complemented literal

F(A,B,C) = M(0,1,2)

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

F’(A,B,C) = M(3,4,5,6,7)

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

A 0 0 0 0 1 1 1 1

B 0 0 1 1 0 0 1 1

C 0 1 0 1 0 1 0 1

Maxterms A + B + C = M 0 A + B + C = M 1 A + B + C = M 2 A + B + C = M 3 A + B + C = M 4 A + B + C = M 5 A + B + C = M 6 A + B + C = M 7

= (m(0,1,2))’ = (A’B’C’ + A’B’C + A’BC’)’

Two Level Canonical FormsTwo Level Canonical FormsF' = A' B' C' + A' B' C + A' B C'

Apply DeMorgan's Law to obtain F:(F')' = (A' B' C' + A' B' C + A' B C')'

F = (A + B + C) (A + B + C') (A + B' + C)

F' = (A + B' + C') (A' + B + C) (A' + B + C') (A' + B' + C) (A' + B' + C')

(F')' = {(A + B' + C') (A' + B + C) (A' + B + C') (A' + B' + C) (A' + B' + C')}'

F = A' B C + A B' C' + A B' C + A B C' + A B C

Apply DeMorgan's Law to obtain F:

Recommended