EE210: Switching Systems Lecture 5: NAND, NOR and XOR Gates, Simplification of Algebraic Expressions Prof. YingLi Tian Feb. 15, 2018 Department of Electrical Engineering The City College of New York The City University of New York (CUNY) 1
Announcement: HW 2 due on Feb. 22. Review Chapter 2.6-2.7 Next class (Chapter 2.8-2.9, Chapter 3.1): Manipulation of Algebraic Functions Boolean Algebra Karnaugh Maps 2
Truth Table to Algebraic Expressions f is 1 f is 1 f is 1 ab = 1 if a = 0 AND b = 1 OR if a = 1 AND b = 0 OR if a = 1 AND b = 1 if a = 1 AND b = 1 OR if a = 1 AND b = 1 OR if a = 1 AND b = 1 if a b = 1 OR if ab = 1 OR if f = a b + ab + ab = a + b (OR)
A standard product term, also minterm is a product term that includes each variable of the problem, either uncomplemented or complemented. To obtain f (A, B, C), add all minterms with output = 1 (SOP): f (A, B, C) = m(1, 2, 3, 4,5) = A B C + A BC + A BC + AB C + AB C f (A, B, C) = m(0, 6, 7) = A B C + ABC + ABC f f 0 1 1 0 1 0 1 0 1 0 1 0 0 1 0 1
A standard sum term, also called a maxterm, is a sum term that includes each variable of the problem, either uncomplemented or complemented. POS: f = (f ) = (A + B + C)(A +B +C)(A +B +C ) f f 0 1 1 0 1 0 1 0 1 0 1 0 0 1 0 1
To simplify: f (A, B, C) = A B C + A BC + A BC + AB C + AB C = A B C + A B + AB = A (B C + 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 P10a: B + C See page56 for details. P8a: a (b + c) = ab + ac P9a: ab + ab = a P10a: a + a b = a + b 6
Truth Table with don t care Include them as a separate sum. f (a, b, c) = m(1, 2, 5) + d(0, 3) What is the values of f? a b c f f 0 0 0 X 0 0 1 1 0 1 0 1 0 1 1 X 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 0 7
Definition of Switching Algebra OR (written as +) a + b (read a OR b) is 1 if a = 1 or b = 1 or both. AND (written as or simply two variables catenated) 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. 8
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. 9
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. 10
NAND and NOR Gates DeMorgan: P11a: (a + b) = a b P11b: (ab) = a + b 11
NAND and NOR Gates OR NOR NOR AND NAND NAND 12
NOT, AND, OR gates from NAND Gates 13
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 15
Function Implementation Example f = wx(y+z) + x y (Example 2.12, page 61) 16
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. 17
Truth Table of NAND, NOR, Ex- OR, and Ex-NOR A B AND NAND OR NOR Ex-OR Ex-NOR 0 0 0 1 0 1 0 1 1 0 0 1 1 0 1 0 0 1 0 1 1 0 1 0 1 1 1 0 1 0 0 1 18
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 19
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 20
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 21
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 = wx + w (z + xy) P9a: ab + ab = a = 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! 22
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 at 1 and the second as a t 2 (where t 1 and t 2 represent product terms), then, the consensus is defined. at 1 a t 2 = t 1 t 2 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. at 1 + a t 2 + t 1 t 2 = at 1 + a t 2 P13b. (a + t 1 )(a + t 2 )(t 1 + t 2 )= (a + t 1 )(a + t 2 ) P9a: ab + ab = a P12a: a + ab = a P13a. at 1 + a t 2 = (at 1 + at 1 t 2 ) + (a t 2 + a t 1 t 2 ) = at 1 + a t 2 + (at 1 t 2 + a t 1 t 2 ) = at 1 + a t 2 + t 1 t 2 Common Mistake: ab + b c + ac = ab + b c ac
Reduce functions by applying --consensus The consensus term is redundant and can be removed: Example 2.20: P10a: a + a b = a + b 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: HW 2 is out, due on Feb. 22. Review Chapter 2.6-2.7 Next class (Chapter 2.8-2.9, Chapter 3.1): Manipulation of Algebraic Functions Boolean Algebra Karnaugh Maps 28