CT455: Computer Organization Boolean Algebra Lecture 3: Boolean Algebra Digital circuits Boolean Algebra Two-Valued Boolean Algebra Boolean Algebra Postulates Precedence of Operators Truth Table & Proofs Duality Lecture 3: Boolean Algebra Basic Theorems of Boolean Algebra Boolean Functions Complement of Functions Standard Forms Minterm & Maxterm Canonical Forms Conversion of Canonical Forms Binary Functions Digital Circuits Digital circuit can be represented by a black-box with inputs on one side, and outputs on the other. inputs : Digital circuit : outputs The input/output signals are discrete/digital in nature, typically with two distinct voltages (a high voltage and a low voltage). High Low In contrast, analog circuits use continuous signals. Digital Circuits Advantages of Digital Circuits over Analog Circuits: more reliable (simpler circuits, less noise-prone) specified accuracy (determinable) but slower response time (sampling rate) Important advantages for two-valued Digital Circuit: Mathematical Model – Boolean Algebra Can help design, analyse, simplify Digital Circuits. Boolean Algebra 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 Algebra named after George Boole who used it to study human logical reasoning – calculus of proposition. Events : true or false Connectives : a OR b; a AND b, NOT a Example: Either “it has rained” OR “someone splashed water”, “must be tall” AND “good vision”. Boolean Algebra a F F T T b F T F T a AND b F F F T a F F T T b F T F T a OR b F T T T a F T NOT a T F Later, Shannon introduced switching algebra (two-valued Boolean algebra) to represent bi-stable switching circuit. Two-valued Boolean Algebra Set of Elements: {0,1} Set of Operations: { ., + , ¬ } x 0 0 1 1 x y y 0 1 0 1 x 0 0 1 1 x.y 0 0 0 1 x.y y 0 1 0 1 x+y 0 1 1 1 Sometimes denoted by ’, for example a’ x 0 1 ¬x 1 0 x y x+y Signals: High = 5V = 1; Low = 0V = 0 x x' Boolean Algebra Postulates A Boolean algebra consists of a set of elements B, with two binary operations {+} and {.} and a unary operation {'}, such that the following axioms hold: Commutative laws: A + B = B + A A . B = B . A Boolean Algebra Postulates Associative laws: (A + B) + C = A + (B + C) = A + B + C (A . B) . C = A .( B . C) = A . B . C Distributive laws: A . (B + C) = (A . B) + (A . C) A + (B . C) = (A + B) . (A + C) Boolean Algebra Postulates Complement: For every x in B, there exists an element x' in B such that x + x' = 1 x . x' = 0 Precedence of Operators To lessen the brackets used in writing Boolean expressions, operator precedence can be used. Precedence (highest to lowest): ' . Examples: a . b + c = (a . b) + c b' + c = (b') + c a + b' . c = a + ((b') . c) + Precedence of Operators Use brackets to overwrite precedence. Examples: 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 + AB A 0 0 1 1 = A = A(1 + B) DISTRIBUTIVE LAW = A . 1 RULE 2 = A RULE 4 B 0 1 0 1 AB 0 0 0 1 A+AB 0 0 1 1 Theorem 10 (Absorption) (a) a + ab = a (b) a(a + b) = a Examples: (X + Y) + (X + Y)Z AB'(AB' + B'C) = X + Y = AB' [T4(a)] [T4(b)] 11. A + A’B A + A’B = A+ B = (A + AB) + A’B = (AA + AB) + A’B = AA + AB + AA’ + A’B = (A + A’)(A + B) = 1. (A + B) = ( A + B) A 0 0 1 1 B 0 1 0 1 A’B 0 1 0 0 A+A’B 0 1 1 1 A+B 0 1 1 1 Theorem 11 (a) a + a'b = a + b (b) a(a' + b) = ab Examples: B + AB'C'D (X + Y)((X + Y)' + Z) = B + AC'D [T11(a)] = (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 ABC A+B A+C 000 001 010 011 100 101 110 111 0 0 1 1 1 1 1 1 0 1 0 1 1 1 1 1 (A+B)(A+C) BC 0 0 0 1 1 1 1 1 0 0 0 1 0 0 0 1 A+BC 0 0 0 1 1 1 1 1 Theorem (a) ab + ab' = a Examples: ABC + AB'C = AC (b) (a + b)(a + b') = a [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 Examples: wy' + wx'y + wxyz + wxz' (x'y' + z)(w + x'y' + z') (b) (a + b)(a + b' + c) = (a + b)(a + c) = 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') [T7(b)] Basic Theorems of Boolean Algebra 6. DeMorgan. (a) (x + y)' = x'.y' (b) (x.y)' = x' + y' 7. Consensus. (a) x.y + x'.z + y.z = x.y + x'.z (b) (x+y).(x'+z).(y+z) = (x+y).(x'+z) Laws of Boolean Algebra DeMorgan's Law (X + Y)' = X' Y' NOR is equivalent to AND with inputs complemented (X Y)' = X' + Y' NAND is equivalent to OR with inputs complemented X 0 0 1 1 Y 0 1 0 1 X 1 1 0 0 Y X+Y X•Y 1 1 1 0 0 0 1 0 0 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 X+Y 1 1 1 1 1 1 0 0 DeMorgan's Law can be used to convert AND/OR expressions to OR/AND expressions or NAND/NAND expression Example: Z = A' B' C + A' B C + A B' C + A B C’ = {(A’B’C)’ (A’BC)’ (AB’C)’ (ABC’)’ } ‘ AND - OR NAND - NAND Z' = (A + B + C') (A + B' + C') (A' + B + C') (A' + B' + C) Theorem 8 (DeMorgan's Theorem) (a) (a + b)' = a'b' (b) (ab)' = a' + b' Generalized DeMorgan's Theorem (a) (a + b + … z)' = a'b' … z' (b) (ab … z)' = a' + b' + … z' Examples: (a + bc)' = (a + (bc))' = a'(bc)' = a'(b' + c') = a'b' + a'c' Note: (a + bc)' ¹ a'b' + c' [T8(a)] [T8(b)] [P5(b)] More Examples for DeMorgan's Theorem (a(b + z(x + a')))' = a' + (b + z(x + a'))' = a' + b' (z(x + a'))' = a' + b' (z' + (x + a')') = a' + b' (z' + x'(a')') = a' + b' (z' + x'a) = a' + b' (z' + x') (a(b + c) + a'b)' = (ab + ac + a'b)' = (b + ac)' = b'(ac)' = b'(a' + c') [T8(b)] [T8(a)] [T8(b)] [T8(a)] [T3] [T5(a)] [P5(b)] [T6(a)] [T8(a)] [T8(b)] Truth Table Provides a listing of every possible combination of inputs and its corresponding outputs. INPUTS OUTPUTS … … … … Example (2 inputs, 2 outputs): x 0 0 1 1 y 0 1 0 1 x.y 0 0 0 1 x+y 0 1 1 1 Switching Functions Switching algebra: Boolean algebra with the set of elements K = {0, 1} If there are n variables, we can define 2 2 switching functions. Sixteen functions of two variables (Table 2.3): n AB f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 00 01 10 11 0 0 0 0 1 0 0 0 0 1 0 0 1 1 0 0 0 0 1 0 1 0 1 0 0 1 1 0 1 1 1 0 0 0 0 1 1 0 0 1 0 1 0 1 1 1 0 1 0 0 1 1 1 0 1 1 0 1 1 1 1 1 1 1 A switching function can be represented by a table as above, or by a switching expression as follows: f0(A,B)= 0, f6(A,B) = AB' + A'B, f11(A,B) = AB + A'B + A'B' = A' + B, ... Value of a function can be obtained by plugging in the values of all variables: The value of f6 when A = 1 and B = 0 is: 1 0'1'0 = 0 + 1 = 1. Truth Tables (1) Shows the value of a function for all possible input combinations. 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 for f(A,B,C) = AB + A'C + AC' (Table 2.5) ABC f(A,B,C) ABC f(A,B,C) 000 0 FFF F 001 010 011 100 101 110 111 1 0 1 1 0 1 1 FFT FTF FTT TFF TFT TTF TTT T F T T F T T Truth Table Example (3 inputs, 2 outputs): x 0 0 0 0 1 1 1 1 y 0 0 1 1 0 0 1 1 z 0 1 0 1 0 1 0 1 y+z 0 1 1 1 0 1 1 1 x.(y + z) 0 0 0 0 0 1 1 1 Proof using Truth Table Can use truth table to prove by perfect induction. Prove that: x . (y + z) = (x . y) + (x . z) (i) Construct truth table for LHS & RHS of above equality. x 0 0 0 0 1 1 1 1 y 0 0 1 1 0 0 1 1 z 0 1 0 1 0 1 0 1 y+z 0 1 1 1 0 1 1 1 x.(y + z) 0 0 0 0 0 1 1 1 x.y 0 0 0 0 0 0 1 1 x.z 0 0 0 0 0 1 0 1 (x.y)+(x.z) 0 0 0 0 0 1 1 1 (ii) Check that LHS = RHS Postulate is SATISFIED because output column 2 & 5 (for LHS & RHS expressions) are equal for all cases. Basic Theorems of Boolean Algebra Apart from the axioms/postulates, there are other useful theorems. 1. Idempotency. (a) x + x = x (b) x . x = x Proof of (a): x + x = (x + x).1 (identity) = (x + x).(x + x') (complementarity) = x + x.x' (distributivity) =x+0 (complementarity) =x (identity) Basic Theorems of Boolean Algebra 2. Null elements for + and . operators. (a) x + 1 = 1 (b) x . 0 = 0 3. Involution. (x')' = x 4. Absorption. (a) x + x.y = x (b) x.(x + y) = x 5. Absorption (variant). (a) x + x'.y = x+y(b) x.(x' + y) = x.y Basic Theorems of Boolean Algebra Theorem 4a (absorption) can be proved by: x + x.y = x.1 + x.y (identity) = x.(1 + y) (distributivity) = x.(y + 1) (commutativity) = x.1 (Theorem 2a) =x (identity) By duality, theorem 4b: x.(x+y) = x Try prove this by algebraic manipulation. Boolean Functions Boolean function is an expression formed with binary variables, the two binary operators, OR and AND, and the unary operator, NOT, parenthesis and the equal sign. Its result is also a binary value. We usually use . for AND, + for OR, and ' or ¬ for NOT. Sometimes, we may omit the . if there is no ambiguity. Boolean Functions Examples: F1= x.y.z' F2= x + y'.z F3=(x'.y'.z)+(x'.y.z)+(x.y') F4=x.y'+x'.z x 0 0 0 0 1 1 1 1 y 0 0 1 1 0 0 1 1 z 0 1 0 1 0 1 0 1 F1 0 0 0 0 0 0 1 0 F2 0 1 0 0 1 1 1 1 F3 0 1 0 1 1 1 0 0 From the truth table, F3=F4. Can you also prove by algebraic manipulation that F3=F4? F4 0 1 0 1 1 1 0 0 Simplifying logic expressions CS1103 Chapter 3: Boolean Algebra/Logic Gates EXAMPLE • A(A+B) • A(A’ + B) • ( AB + A’B’)’ = AA + AB = A + AB = A(1 + B) = A = AA’ + AB = AB = (A’ + B’)(A + B) = A’A + A’B + AB’ + BB’ = AB’ + A’B X = ABC + ABC’ = AB ( C + C’) = AB.1 = AB A = X(X’YZ + X’YZ’) = XX’YZ + XX’YZ’ = 0.YZ + 0.YZ’ = 0 CS1103 Chapter 3: Boolean Algebra/Logic Gates EXAMPLE AB’ + A’B = AB’+AA’+A’B+BB’ = A(B’+A’) + B(A’+B’) = (A’+B’)(A+B) = (AB)’(A+B) A B 0 0 1 1 0 1 0 1 AB’ A’B (AB)’ A+B 0 0 1 0 0 1 0 0 1 1 1 0 0 1 1 1 AB’+A’B (AB)’(A+B) 0 0 1 1 1 1 0 0 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’ W = AB(A’C + B) = ABA’C + ABB = 0.BC + AB = 0 + AB = AB CS1103 Chapter 3: Boolean Algebra/Logic Gates 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 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 CS1103 Chapter 3: Boolean Algebra/Logic Gates 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 ALGEBRA 1. 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 Algebra Apply the laws and theorems to simplify Boolean equations Example: full adder's carry out function identity Cout = 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 associative B Cin + A Cin + A B (Cin' + Cin) B Cin + A Cin + A B (1) B Cin + A Cin + A B 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’ CS1103 Chapter 3: Boolean Algebra/Logic Gates M = (A’ + B’C’)’ = (A’)’ (B’)’(C’)’ = ABC S = (A’B’(C’ + D’))’ = (A’B’)’ + (C’ + D’)’ = (A’)’ + (B’)’ + (C’)’ (D’)’ = A + B + CD CS1103 Chapter 3: Boolean Algebra/Logic Gates Complement of Functions Given a function, F, the complement of this function, F', is obtained by interchanging 1 with 0 in the function’s output values. x y z F1 F1' 0 0 0 0 1 Example: F1 = xyz' 0 0 1 0 1 0 1 0 0 1 Complement: 0 1 1 0 1 F1' = (x.y.z')' 1 = x' + y' + (z')' DeMorgan 1 0 0 0 1 = x' + y' + z Involution 1 0 1 0 1 1 0 1 0 1 1 1 0 1 Complement of Functions More general DeMorgan’s theorems useful for obtaining complement functions: (A + B + C + ... + Z)' (A . B . C ... . Z)' = A' . B' . C' … . Z' = A' + B' + C' + … + Z' Algebraic Forms of Switching Functions (1) Literal: A variable, complemented or uncomplemented. Product term: A literal or literals ANDed together. Sum term: A literal or literals ORed together. SOP (Sum of Products): ORing product terms f(A, B, C) = ABC + A'C + B'C POS (Product of Sums) ANDing sum terms f (A, B, C) = (A' + B' + C')(A + C')(B + C') Algebraic Forms of Switching Functions (2) A minterm is a product term in which all the variables appear exactly once either complemented or uncomplemented. Canonical Sum of Products (canonical SOP): Represented as a sum of minterms only. Example: f1(A,B,C) = A'BC' + ABC' + A'BC + ABC (2.1) Minterms of three variables: Minterm A'B'C' A'B'C A'BC' A'BC AB'C' AB'C ABC' ABC Minterm Code 000 001 010 011 100 101 110 111 Minterm Number m0 m1 m2 m3 m4 m5 m6 m7 Algebraic Forms of Switching Functions (3) Compact form of canonical SOP form: f1(A,B,C) = m2 + m3 + m6 + m7 (2.2) A further simplified form: f1(A,B,C) = S m (2,3,6,7) (minterm list form) (2.3) The order of variables in the functional notation is important. Deriving truth table of f1(A,B,C) from minterm list: Row No. Inputs (i) ABC 0 000 1 001 2 010 3 011 4 100 5 101 6 110 7 111 Outputs f1(A,B,C)=Sm(2,3,6,7) 0 0 1 m2 1 m3 0 0 1 m6 1 m7 Complement f1'(A,B,C)=Sm(0,1,4,5) 1 m0 1 m1 0 0 1 m4 1 m5 0 0 Algebraic Forms of Switching Functions (4) Example: Given f(A,B,Q,Z) = A'B'Q'Z' + A'B'Q'Z + A'BQZ' + A'BQZ, express f(A,B,Q,Z) and f '(A,B,Q,Z) in minterm list form. f(A,B,Q,Z) = A'B'Q'Z' + A'B'Q'Z + A'BQZ' + A'BQZ = m0 + m1 + m6 + m7 = S m(0, 1, 6, 7) f '(A,B,Q,Z) = m2 + m3 + m4 + m5 + m8 + m9 + m10 + m11 + m12 + m13 + m14 + m15 = S m(2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 14, 15) 2 n 1 m i 1 (2.6) AB + (AB)' = 1 and AB + A' + B' = 1, but AB + A'B' 1. i 0 Algebraic Forms of Switching Functions (5) A maxterm is a sum term in which all the variables appear exactly once either complemented or uncomplemented. Canonical Product of Sums (canonical POS): Represented as a product of maxterms only. Example: f2(A,B,C) = (A+B+C)(A+B+C')(A'+B+C)(A'+B+C') (2.7) Maxterms of three variables: Maxterm A+B+C A+B+C' A+B'+C A+B'+C' A'+B+C A'+B+C' A'+B'+C A'+B'+C' Maxterm Code 000 001 010 011 100 101 110 111 Maxterm Number M0 M1 M2 M3 M4 M5 M6 M7 Algebraic Forms of Switching Functions (6) f2(A,B,C) = M0M1M4M5 = PM(0,1,4,5) (maxterm list form) The truth table for f2(A,B,C): Rwo No. Inputs M0 M1 M4 M5 Outputs (i) ABC A+B+C A+B+C' A'+B+C A'+B+C' f2(A,B,C) 0 000 0 1 1 1 0 1 001 1 0 1 1 0 2 010 1 1 1 1 1 3 011 1 1 1 1 1 4 100 1 1 0 1 0 5 101 1 1 1 0 0 6 110 1 1 1 1 1 7 111 1 1 1 1 1 (2.8) (2.9) Algebraic Forms of Switching Functions (7) Truth tables of f1(A,B,C) of Eq. (2.3) and f2(A,B,C) of Eq. (2.7) are identical. Hence, f1(A,B,C) = S m (2,3,6,7) = f2(A,B,C) = PM(0,1,4,5) (2.10) Example: Given f(A,B,C) = ( A+B+C')(A+B'+C')(A'+B+C')(A'+B'+C'), construct the truth table and express in both maxterm and minterm form. f(A,B,C) = M1M3M5M7 = PM(1,3,5,7) = S m (0,2,4,6) Row No. (i) 0 1 2 3 4 5 6 7 Inputs ABC 000 001 010 011 100 101 110 111 Outputs f(A,B,C)= PM(1,3,5,7) = Sm(0,2,4,6) 1 m0 0 M1 1 m2 0 M3 1 m4 0 M5 1 m6 0 M7 Algebraic Forms of Switching Functions (8) Relationship between minterm mi and maxterm Mi: For f(A,B,C), (m1)' = (A'B'C)' = A + B + C' = M1 In general, (mi)' = Mi (Mi)' = ((mi)')' = mi (2.11) (2.12) Algebraic Forms of Switching Functions (9) Example: Relationship between the maxterms for a function and its complement. For f(A,B,C) = ( A+B+C')(A+B'+C')(A'+B+C')(A'+B'+C') The truth table is: Row No. Inputs (i) ABC 0 000 1 001 2 010 3 011 4 100 5 101 6 110 7 111 Outputs f (A,B,C) 1 0 1 0 1 0 1 0 Outputs f '(A,B,C)= PM(0,2,4,6) 0 M0 1 0 M2 1 0 M4 1 0 M6 1 Algebraic Forms of Switching Functions (10) From the truth table f '(A,B,C) = PM(0,2,4,6) and f(A,B,C) = PM(1,3,5,7) Since f(A,B,C) f '(A,B,C) = 0, (M0M2M4M6)(M1M3M5M7) = 0 or M 0 In general, M 0 Another observation from the truth table: f(A,B,C) = S m (0,2,4,6) = PM(1,3,5,7) f '(A,B,C) = S m (1,3,5,7) = PM(0,2,4,6) 2 3 1 i i 0 2 1 n i 0 i (2.13) Derivation of Canonical Forms (1) Derive canonical POS or SOP using switching algebra. Theorem 10. Shannon's expansion theorem (a). f(x1, x2, …, xn) = x1 f(1, x2, …, xn) + (x1)' f(0, x2, …, xn) (b). f(x1, x2, …, xn) = [x1 + f(0, x2, …, xn)] [(x1)' + f(1, x2, …, xn)] Example: f(A,B,C) = AB + AC' + A'C f(A,B,C) = AB + AC' + A'C = A f(1,B,C) + A' f(0,B,C) = A(1B + 1C' + 1'C) + A'(0B + 0C' + 0'C) = A(B + C') + A'C f(A,B,C) = A(B + C') + A'C = B[A(1+C') + A'C] + B'[A(0 + C') + A'C] = B[A + A'C] + B'[AC' + A'C] = AB + A'BC + AB'C' + A'B'C f(A,B,C) = AB + A'BC + AB'C' + A'B'C = C[AB + A'B1 + AB'1' + A'B'1] + C'[AB + A'B0 + AB'0' + A'B'0] = ABC + A'BC + A'B'C + ABC' + AB'C' Derivation of Canonical Forms (2) Alternative: Use Theorem 6 to add missing literals. Example: f(A,B,C) = AB + AC' + A'C to canonical SOP form. AB = ABC' + ABC = m6 + m7 AC' = AB'C' + ABC' = m4 + m6 A'C = A'B'C + A'BC = m1 + m3 Therefore, f(A,B,C) = (m6 + m7) + (m4 + m6) + (m1 + m3) = Sm(1, 3, 4, 6, 7) Example: f(A,B,C) = A(A + C') to canonical POS form. A = (A+B')(A+B) = (A+B'+C')(A+B'+C)(A+B+C')(A+B+C) = M3M2M1M0 (A+C')= (A+B'+C')(A+B+C') = M3M1 Therefore, f(A,B,C) = (M3M2M1M0)(M3M1) = PM(0, 1, 2, 3) Incompletely Specified Functions A switching function may be incompletely specified. Some minterms are omitted, which are called don't-care minterms. Don't cares arise in two ways: Certain input combinations never occur. Output is required to be 1 or 0 only for certain combinations. Don't care minterms: di Don't care maxterms: Di Example: f(A,B,C) has minterms m0, m3, and m7 and don't-cares d4 and d5. Minterm list is: f(A,B,C) = Sm(0,3,7) + d(4,5) Maxterm list is: f(A,B,C) = PM(1,2,6)·D(4,5) f '(A,B,C) = Sm(1,2,6) + d(4,5) = PM(0,3,7)·D(4,5) f (A,B,C)= A'B'C' + A'BC + ABC + d(AB'C' + AB'C) = B'C' + BC (use d4 and omit d5) Standard Forms Sum Term: a single literal or a logical sum (OR) of several literals. Examples: x, x+y+z', A'+B, A+B Sum-of-Products (SOP) Expression: a product term or a logical sum (OR) of several product terms. Examples: x, x+y.z', x.y'+x‘.y.z, A.B+A'.B' Product-of-Sums (POS) Expression: a sum term or a logical product (AND) of several sum terms. Exampes: x, x.(y+z'), (x+y').(x'+y+z), (A+B).(A'+B') Standard Forms Every Boolean expression can either be expressed as sum-of-products or product-of-sums expression. Examples: SOP: POS: both: neither: x.y + x.y + x.y.z (x + y).(x + y).(x + z) x + y + z or x.y.z x.(w + y.z) or z + w.x.y + v.(x.z + w) Two Level Canonical Forms Sum of Products 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 ABC =m A B C = m0 A B C = m1 A B C = m2 A B C = m3 A B C = m4 A B C = m5 A B C = m6 7 Shorthand Notation for Minterms of 3 Variables B C F A 2-Level AND/OR Realization product term / minterm: ANDed product of literals in which each variable appears exactly once, in true or complemented form (but not both!) F in canonical form: F(A,B,C) = Sm(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 form F = 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 + BC F’ = (A + B C)' = A' (B' + C') = A' B' + A' C' 2 Level Canonical Forms Product of Sums / Conjunctive Normal Form / Maxterm Expansion 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 = M0 A + B + C = M1 A + B + C = M2 A + B + C = M3 A + B + C = M4 A + B + C = M5 A + B + C = M6 A + B + C = M7 Maxterm: ORed sum of literals in which each variable appears exactly once in either true or complemented form, but not both! Maxterm form: Find truth table rows where F is 0 0 in input column implies true literal 1 in input column implies complemented literal Maxterm Shorthand Notation for a Function of Three Variables F(A,B,C) = PM(0,1,2) = (Sm(0,1,2))’ = (A’B’C’ + A’B’C + A’BC’)’ = (A + B + C) (A + B + C') (A + B' + C) F’(A,B,C) = PM(3,4,5,6,7) = (A + B' + C') (A' + B + C) (A' + B + C') (A' + B' + C) (A' + B' + C') Two Level Canonical Forms F' = 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') Apply DeMorgan's Law to obtain F: (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