1 CS 352 Introduction to Logic Design Lecture 2 Ahmed Ezzat Boolean Algebra and Its Applications Ch-3 + Ch-4
CS-352Ahmed Ezzat 2 Outline Multiplying Out and Factoring Expressions XOR and Equivalence Operations The Consensus Theorem Algebraic Simplification of Switching Expressions Proving Validity of an Equation Conversion of English sentence to Boolean Equations Combinational Logic Design using a Truth Table Minterm and Maxterm Expansions General Minterm and Maxterm Expansions Incompletely Specified Functions Examples of Truth Tables Construction Design of Binary Adders and Subtracters
CS-352Ahmed Ezzat 3 Multiplying Out and Factoring Expressions (1) We covered distribution theorem for converting product-of- sums into sum-of-products: – X(Y + Z) = XY + XZ(1) (Multiplying out) – (X + Y)(X + Z) = X + YZ(2) (Multiplying out) In addition, the following theorems for converting sum- of-products into product-of-sums are useful: – (X + Y)(X’ + Z) = XZ + X’Y(3) Multiplying out – XZ + X’Y = (X + Y)(X’ + Z)(4) Factoring
CS-352Ahmed Ezzat 4 Multiplying Out and Factoring Expressions (2) Multiply 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 + BAC + BA’D’ + BA’E + A’C’DE = AC(1 + B) + BA’D’ + BA’E + A’C’DE = AC + BA’D’ + BA’E + A’C’DE
CS-352Ahmed Ezzat 5 Multiplying Out and Factoring Expressions (3) Factoring: AC + A’BD’ + A’BE + A’C’DE = AC + A’(BD’ + BE + C’DE)Use (4) = (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) = (A + C’DE + B)(A + D’ + E)(A’ + C) = (A + B + C’)(A + B + D)(A + B + E)(A + D’ + E)(A’ + C)
CS-352Ahmed Ezzat 6 XOR and Equivalence Operations (1) XOR ( ) is defined as follows: 0 0 = 00 1 = = = 1 Truth Table: X Y = X’Y + XY’ X Y
CS-352Ahmed Ezzat 7 XOR and Equivalence Operations (2) The following theorems applies 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’
CS-352Ahmed Ezzat 8 XOR and Equivalence Operations (3) The equivalence operation (Ξ) is defined as follows: 0 Ξ 0 = 10 Ξ 1 = 0 1 Ξ 1 = 1 1 Ξ 0 = 0 Truth Table: (X Ξ Y) =1 iif X = Y (X Ξ Y) = XY + X’Y’ X Y X Ξ Y
CS-352Ahmed Ezzat 9 XOR and Equivalence Operations (4) Equivalence is the complement of XOR: (X Y)’ = (X’Y + XY’)’ = (X + Y’)(X’ + Y) = XY + X’Y’ = (X Ξ Y) In other words: (X’Y + XY’)’ = XY + X’Y’ Equivalence operation is commutative and associative Equivalence gate is called also an exclusive-NOR gate +
CS-352Ahmed Ezzat 10 XOR and Equivalence Operations (5) Simplify F = (A’B Ξ C) + (B AC’) F = [(A’B)C + (A’B)’C’] + [B’(AC’) + B(AC’)’] = A’BC + (A + B’)C’ + AB’C’ + B(A’ + C)] = B(A’C + A’ + C) + C’(A + B’ + AB’) = B(A’ + C) + C’(A + B’) +
CS-352Ahmed Ezzat 11 The Consensus Theorem (1) Consensus theorem is used to simplify Boolean algebra expression by eliminating redundant items. XY + X’Z = (X + Z)(X’ + Y) XY + X’Z + YZ Then XY + X’Z + YZ, the term YZ is redundant and can be eliminated, and is referred to as the consensus term. Given a pair of terms for which a variable appears in one term and its complement appears in the other term, the consensus term is formed by multiplying the two original terms leaving out the selected variable and its complement
CS-352Ahmed Ezzat 12 The Consensus Theorem (2) Consensus of (ab) and (a’c) is (bc) Consensus of (abd) and (b’de’) is (ade’) Consensus of (ab) and (a’b’) is zero Example: a’b’ + ac + bc’ + b’c + ab = (a’b’ + ac + b’c) + bc’ + ab //eliminate consensus = a’b’ + ac + bc’ + ab = a’b’ + (ac + bc’ + ab) //eliminate consensus = a’b’ + ac + bc’
CS-352Ahmed Ezzat 13 The Consensus Theorem (3) 2nd form of consensus: (X + Y)(X’ + Z)(Y + Z) = (X + Y)(X’ + Z) XZ + X’Y (Y + Z) is the consensus term Example: (a + b + c’)(b + d’ + c)(a + b + d’) The sum of (a + b + b + d’) = (a + b + d’) is the consensus term and as a result we can ignore the last term (a + b + d’) I.e., (a + b + c’)(b + d’ + c)(a + b + d’) = (a + b + c’)(b + d’ + c)
CS-352Ahmed Ezzat 14 The Consensus Theorem (4) Sometimes we need to add consensus term to help eliminating Example: F = ABCD + B’CDE + A’B’ + BCE’ from ABCD, B’CDE consensus is ACDE Then F = ABCD + B’CDE + A’B’ + BCE’ + ACDE (BCE’), (ACDE) consensus is (ABCD) (A’B’), (ACDE) consensus is (B’CDE) Then F = A’B’ + BCE’ + ACDE
CS-352Ahmed Ezzat 15 Algebraic Simplification of Switching Expressions (1) Combining terms: XY + XY’ = X Eliminating terms: X + X’Y = X + Y Example: A’B + A’B’C’D’ + ABCD’ = A’(B + B’C’D’) + ABCD’ = A’(B + C’D’) + ABCD’ = B(A’ + ACD’) + A’C’D’ = B(A’ + CD’) + A’C’D’ = A’B + BCD’ + A’C’D’
CS-352Ahmed Ezzat 16 Proving Validity of an Equation (1) There is no easy way to determine when a Boolean expression has a minimum number of terms or minimum number of literals Instead we will focus here if an expression is valid for all combinations of values of the variables? Validation Proof: – Construct truth table and evaluate both sides of the equation for all combinations. – Manipulate one side by applying different theorems till it is identical with the other side – Reduce both sides independently to the same expression – Perform some operation on both sides provide the operation is reversible (complement is reversible, but multiplication is not – Boolean algebra do not understand division)
CS-352Ahmed Ezzat 17 Proving Validity of an Equation (2) Not Valid Proof: – Sufficient to show one combination of values of the variables for which the 2 sides of the equation have different values
CS-352Ahmed Ezzat 18 Proving Validity of an Equation (3) Show that: F = A’BD’ + BCD + ABC’ + AB’D = BC’D’ + AD + A’BC F = A’BD’ + BCD + ABC’ + AB’D = A’BD’ + BCD + ABC’ + AB’D + BC’D’ + A’BC + ABD where BC’D’ is consensus of (A’BD’) and (ABC’) A’BC is consensus of (A’BD’) and (BCD) ABD is consensus of (BCD) and (ABC’) = AD + A’BD’ + BCD + ABC’ + BC’D’ + A’BC But A’BD’ is the consensus of BC’D’ and A’BC BCD is the consensus of AD and A’BC ABC’ is the consensus of BC’D’ and A’BC F = AD + BC’D’ + A’BC
CS-352Ahmed Ezzat 19 Conversion of English Sentence to Boolean Equations Mary watches TV if it is Monday night and she has finished her homework F A B F = A.B The alarm will ring iff the alarm switch is on and the door is not closed Z A B’ or it is after 6pm and the window is not closed C D’ Z = AB’ + CD’
CS-352Ahmed Ezzat 20 Combinational Network Design Using a Truth Table (1) Switching circuit Logic design using truth table? Derive algebraic expression for f = 1 from the truth table: f = 1 = A’BC + AB’C’ + AB’C + ABC’ + ABC (1) = A’BC + AB’ + AB = A’BC + A = A + BC
CS-352Ahmed Ezzat 21 Combinational Network Design Using a Truth Table (2) An alternative approach: Derive algebraic expression for f = 0 from the truth table: f = 0 = (A + B + C)(A + B + C’)(A + B’ + C) (2) = (A + B)(A + B’ + C) = A + B(B’ + C) = A + BC
CS-352Ahmed Ezzat 22 Minterm and Maxterm Expansions (1) Each term in Eq. (1) is referred to as a minterm and each term in Eq. (2) is a maxterm. A minterm of n variables is a product of n literals in which each variable appears exactly once in true or complemented form, but not in both. When a function is written as a sum of minterms (i.e., as in Eq. 1), it is referred to as a minterm expansion or a standard sum of products. Minterm is written in abbreviated form as m i - where i is the row in the truth table when f = 1.
CS-352Ahmed Ezzat 23 Minterm and Maxterm Expansions (2)
CS-352Ahmed Ezzat 24 Minterm and Maxterm Expansions (3) A maxterm of n variables is the sum of n literals in which each variable appears exactly once in true or complemented form, but not in both. When a function is written as a product of maxterms (i.e., as in Eq. 2), it is referred to as a maxterm expansion or a standard product of sums. Maxterm is written in abbreviated form as M i - where i is the row in the truth table when f = 0.
CS-352Ahmed Ezzat 25 Minterm and Maxterm Expansions (4) Sum of minterms (f) – Eq (1): f (A, B, C) = m 3 + m 4 + m 5 + m 6 + m 7 = Σ m(3, 4, 5, 6, 7) Sum of maxterms (f) – Eq (2): f (A, B, C) = M 0 M 1 M 2 = П M(0, 1, 2)
CS-352Ahmed Ezzat 26 Minterm and Maxterm Expansions (5) Minterm for the complement (any row is either in f =1 or f =0) Complement of minterm (f’ is 1 when f = 0) is the corresponding maxterm: f’ (A, B, C) = m 0 + m 1 + m 2 OR f ‘(A, B, C) = (M 0 M 1 M 2 )’ = M 0 ’ + M 1 ’ + M 2 ’ = m 0 + m 1 + m 2 Maxterm for the complement (any row is either in f =1 or f =0) Complement of maxterm (f’ is 1 when f = 0) is the corresponding minterm: f’ (A, B, C) = m 0 + m 1 + m 2 OR f ‘ (A, B, C) = (m 3 + m 4 + m 5 + m 6 + m 7 ) ’ = m 3 ’ m 4 ’ m 5 ’ m 6 ’ m 7 ’ = M 3 M 4 M 5 M 6 M 7
CS-352Ahmed Ezzat 27 Minterm and Maxterm Expansions (6) Find the minterm expansion of f(a,b,c,d) = a’(b’ + d) + acd’ f = a’b’ + a’d + acd’ = a’b’(c + c’)(d + d’) + a’d(b + b’)(c + c’) + acd’(b + b’) = a’b’c’d’ + a’b’c’d + a’b’cd’ + a’b’cd + a’b’c’d + a’b’cd + a’bc’d + a’bcd + abcd’ + ab’cd’ = a’b’c’d’ + a’b’c’d + a’b’cd’ + a’b’cd + a’bc’d + a’bcd + abcd’ + ab’cd’
CS-352Ahmed Ezzat 28 General Minterm and Maxterm Expansions (1) Truth table for n variables (n = 3) 2 n rows Each row, F can be 0 or 1, then there are possible Functions (2 8 = 256) for n = 3 variables F = a 0 m 0 + a 1 m 1 + ……… + a 7 m 7 = Σ a i m i … (1) If a i = 1, minterm m i is present in the expansion If a i = 0, minterm m i drops out of the expansion F = (a 0 + M 0 )(a 1 + M 1 ) ….. (a 7 + M 7 ) = П (a i + M i ) … (2) If a i = 1, maxterm M i drops out of the expansion If a i = 0, maxterm M i is present in the expansion A B C a a a a a a a a 7 F 2 2 n i=0 2 n -1 i=0 2 n -1
CS-352Ahmed Ezzat 29 General Minterm and Maxterm Expansions (2) F’ expressed in minterms is as follows: F’ = [ П (ai + Mi) ]’ = Σ a i ’ M i ’ = Σ a i ’m i … (3) F’ expressed in maxterms is as follows: F’ = [ Σ (a i m i ) ]’ = П (a i ’ + m i ’) = П (a i ’+ M i ) … (4) i= n -1 i= n -1
CS-352Ahmed Ezzat 30 Incompletely Specified Functions (1) A large digital system would be divided into many subsystems, i.e., N 1 and N 2 as an example. Assume N 1 does not generate all possible combinations of values for A, B, C (e.g., 001, 110). N 2 design do not need to handle these don’t care minterm terms! These don’t care will be denoted “d.”
CS-352Ahmed Ezzat 31 Incompletely Specified Functions (2) Alternatives: 1. Assume d = 0 for both X’s: F = A’B’C’ + A’BC + ABC = A’B’C’ + BC (1) 2. Assume d =1 to the first X and d = 0 for the 2 nd X: F = A’B’C’ + A’B’C + A’BC + ABC = A’B’ + BC (2) 3. Assume d = 1 to both X’s: F = A’B’C’ + A’B’C + A’BC + ABC’ + ABC = A’B’ + BC + AB (3) Choice (2) leads to the simplest solution! F = Σ m(0, 3, 7) + Σ d(1, 6) (4) F = П M(2, 4, 5) П D(1, 6) (5)
CS-352Ahmed Ezzat 32 Examples of Truth Table Construction (1) Design simple binary adder that adds two 1-bit binary numbers (a, b) and produces 2-bit sum. X = AB Y = A’B + AB’ = A B A B X Y SUM +
CS-352Ahmed Ezzat 33 Examples of Truth Table Construction (2) Design simple binary adder that adds two 2-bit binary numbers (N 1, N 2 ) and produces 3-bit sum (N 3 ). X(A,B,C,D)= Σ m(7,10,11,13,14,15) Y(A,B,C,D)= Σ m(2,3,5,6,8,9,12,15) Z(A,B,C,D)= Σ m(1,3,4,6,9,11,12,14)
CS-352Ahmed Ezzat 34 Design of Binary Adders and Subtracters (1) Design a parallel adder that adds two-4-bit unsigned binary numbers and a carry input to give a 4-bit sum and a carry output. One approach is to construct a truth table with 9-inputs and 5-outputs A better model is to design a logic module that adds two 1-bit and a carry (full adder), and then connect four of these modules together to form a 4-bit adder
CS-352Ahmed Ezzat 35 Design of Binary Adders and Subtracters (2) Carry bit A B Sum
CS-352Ahmed Ezzat 36 Design of Binary Adders and Subtracters (3) Full Adder: Sum = X’Y’C in + X’YC’ in + XY’C’ in + XYC in = X’(Y’Cin + YC’in) + X(Y’C’ in + YC in ) = X’(Y Cin) + X (Y Cin)’ = X Y Cin
CS-352Ahmed Ezzat 37 Design of Binary Adders and Subtracters (4) C out = X’YC in + XY’C in + XYC’ in + XYC in = (X’YCin + XYCin) + (XY’C in + XYC in ) + (XYC’ in + XYC in ) = X’(Y Cin) + X (Y Cin)’ = YC in + XC in + XY
CS-352Ahmed Ezzat 38 Design of Binary Adders and Subtracters (5) Extending the unsigned binary parallel adder to support signed numbers (i.e., subtraction), with negative numbers expressed in 2’s complement form.
CS-352Ahmed Ezzat 39 Design of Binary Adders and Subtracters (6) An alternative representation to a full subtracter analogous to full adder is as follows:
CS-352Ahmed Ezzat 40