EE210: Switching Systems Lecture 5: NAND, NOR and XOR Gates, Simplification of Algebraic Expressions Prof. YingLi Tian Sept. 19, 2016 Department of Electrical Engineering The City College of New York The City University of New York (CUNY) 1 Definition of Switching Algebra OR (written as +) AND (written as · or simply two variables catenated) a + b (read a OR b) is 1 if a = 1 or b = 1 or both. a · b = ab (read a AND b) is 1 if and only if a = 1 and b = 1. NOT (written´) a´ (read NOT a) is 1 if and only if a = 0. 2 OR, AND, NOT Gates A gate is a circuit with one output that implements one of the basic functions such as OR and AND, but the input can be 2, 3, 4 or 8. 3 OR, AND, NOT Gates A gate is a circuit with one output that implements one of the basic functions such as OR and AND, but the # of inputs can be 2, 3, 4 or 8. 4 NAND and NOR Gates DeMorgan: P11a: (a + b)´ = a´ b´ P11b: (ab)´ = a´ + b´ 5 NAND and NOR Gates OR NOR NOR AND NAND NAND 6 NOT, AND, OR gates from NAND Gates 7 NAND Gate Logical Design f = x´y + xy´ + xz AND OR gates NAND gates Function Implementation Example f = wx(y+z) + x´y (Example 2.12, page 61) 1. Use AND and OR gates 2. Use NAND gates 9 Function Implementation Example f = wx(y+z) + x´y (Example 2.12, page 61) 10 Exclusive-OR and Exclusive-NOR Gates Ex-OR: The output is 1 if the inputs are different. Ex-NOR: The output is 1 if the inputs are same. EX-OR and Ex-NOR gates can only have 2 inputs. 11 Truth Table of NAND, NOR, ExOR, and Ex-NOR A B AND NAND OR NOR Ex-OR Ex-NOR 0 1 0 1 0 0 1 1 0 0 0 1 1 1 1 0 1 0 0 0 0 1 1 0 0 1 1 1 1 0 0 1 12 Simplification of Algebraic Expressions Example in Lecture 4: (1) x´yz´ + x´yz + xy´z´ + xy´z + xyz (2) x´y + xy´ + xyz (3) x´y + xy´ + xz (4) x´y + xy´ + yz 13 Simplification of Algebraic Expressions Example in Lecture 4: f (A, B, C) = A´B´C + A´BC´ + A´BC + AB´C´+ AB´C = A´B´C + A´B + AB´ = A´C + A´B + AB´ = B´C + A´B + AB´ f ´(A, B, C) = A´B´C´ + ABC´ + ABC = A´B´C´ + AB See page56 for details. P8a: a (b + c) = ab + ac P9a: ab + ab´ = a P10a: a + a´ b = a + b 14 Simplification of Algebraic Expressions Example 2.16, page 66 (3 terms, 6 literals) f = wx + wxy + w´yz + w´y´z + w´xyz´ P8a: a (b + c) = ab + ac P9a: ab + ab´ = a P10a: a + a´ b = a + b P12a: a + ab = a 15 Simplification of Algebraic Expressions Example 2.16, page 66 (3 terms, 6 literals) f = wx + wxy + w´yz + w´y´z + w´xyz´ = (wx + wxy) + (w´yz + w´y´z ) + w´xyz´ = wx + w´z + w´xyz´ P8a: a (b + c) = ab + ac = wx + w´(z + xyz´ ) -----P10a P9a: ab + ab´ = a = wx + w´(z + xy) = wx + w´z + w´xy P10a: a + a´ b = a + b = w´z + x(w + w´y) -----P10a P12a: a + ab = a = w´z + wx + xy ---done! 16 Consensus For any two product terms where exactly one variable appears uncomplemented in one and complemented in the other, the consensus is defined as the product of the remaining literals. If no such variable exists or if more than one such variable exists, then the consensus is undefined. If we write one term as at1 and the second as a´t2 (where t1 and t2 represent product terms), then, the consensus is defined. at1 ¢ a´t2 = t1t2 Examples: ab´c ¢ a´d = b´cd ab´c ¢ a´cd= b´cd abc´ ¢ bcd´ = abd´ b´c´d´ ¢ b´cd ´= b´d´ abc´ ¢ bc´d= Undefined – no variable a´ bd ¢ ab´cd= Undefined – two variables Property -- Consensus The consensus term is redundant and can be removed: P13a. at1 + a´t2 + t1t2 = at1 + a´t2 P13b. (a + t1)(a´ + t2)(t1 + t2)= (a + t1)(a´ + t2) P9a: ab + ab´ = a P12a: a + ab = a P13a. at1 + a´t2 = (at1 + at1t2 ) + (a´t2 + a´t1t2 ) = at1 + a´t2 + (at1t2 + a´t1t2 ) = at1 + a´t2 + t1t2 Common Mistake: ab + b´c + ac = ab + b´c ≠ ac Reduce functions by applying --consensus The consensus term is redundant and can be removed: P10a: a + a´ b = a + b Example 2.20: f = a´b´c´ + a´bc´ + a´bc + ab´c´ = a´c´ + a´bc + ab´c´ = a´(c´ + bc) + ab´c´ = a´(c´ + b) + ab´c´ = a´c´ + a´b + ab´c´ = a´b + c´ (a´ + ab´) = a´b + a´c´ + b´c´ = a´b + b´c´ Consensus, removed, a´b ¢ b´c´ = a´c´ Reduce functions by applying --consensus The consensus term is redundant and can be removed: Example 2.22: Reduce f to 3 terms with 6 literals (use consensus): f = c´d´+ ac´ + ad + bd´ + ab = ? Reduce functions by applying --consensus The consensus term is redundant and can be removed: Example 2.22: Reduce f to 3 terms with 6 literals (use consensus): f = c´d´+ ac´ + ad + bd´ + ab = c´d´ + ad + bd´ c´d´ ¢ ad = ac´ ad ¢ bd´ = ab Announcement: HW2 due 9/21. Review Chapter 2.6-2.7 Next class (Chapter 2.8-2.9, Chapter 3.1): Manipulation of Algebraic Functions Boolean Algebra Karnaugh Maps 22