CS M51A/EE M16 Winter’05 Section 1 Logic Design of Digital Systems Lecture 3 January 19 W’05 Yutao He yutao@cs.ucla.edu 4532B Boelter Hall http://courseweb.seas.ucla.edu/classView.php?term=05W&srs=187154200 CSM51A/EEM16-Sec.1 W’05 Y. He @ 12/9/2018
Outline Administrative Matters Recap: Data presentation Chapter 2.4-2.5, App. A Switching Function Switching Expression Switching (Boolean) Algebra Canonical Forms Summary
Administrative Matter HW #2 is posted HW #1 Solution is posted Quiz #1 will be held on Friday About Lecture note posting
Review - Data Representation Encode with binary number 0s and 1s Character ASCII Unicode Number (positive integer) Positional Number Systems Context is very important! What’s the output? int a = 12; printf (“a is %d”, a); What if char a = ‘2’; printf (“a is %d”, a); How about int a = 12; printf (“a is %x”, a);
Review - Code for Decimal Numbers Binary-Coded-Decimal (BCD) Code: Encode each decimal digit individually using binary codes Example: Encode decimal number sixteen (16): Binary Code: 10000 BCD Code: 0001 0110
Binary-Level Specification High-Level Spec FH XH YH Binary-Level Spec FB n m xB yB Encoding Decoding
Truth Table Tabular representation of switching functions x y f x y f 0 0 0 0 1 1 1 0 0 1 1 1 i 1 2 3 There are 2^n rows for a n-input switching function
2-D Truth Table
Truth Table of 1-Input S. F. x f X f f f f 0 0 0 1 1 1 0 1 0 1 i 1 2 3 0-Constant Identity (Buffer) Complement (NOT) 1-Constant
Truth Table of 2-Input S. F. x y f x y 16 possible functions (f0–f15) 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 AND OR XOR NOR EQU NAND How many different switching functions can be obtained from a n-input switching function? 2 n
Incompletely Specified S. F. Output value is not specified for a given input combination: Don’t care
One/Zero Set Notations One/Zero/D.C. Set Notations: f (x,y,z) = one-set(1,4,7), d.c.-set(3,6) or f(x,y,z) = zero-set(0,2,5), d.c.-set(3,6)
Switching (Boolean) Algebra Symbols: 0, 1 • is logic AND, + is logic OR, ‘ is logic NOT It holds all algebra axioms: 1. set B contains at least two elements, a, b, such that a b 2. closure: a + b is in B a • b is in B 3. commutativity: a + b = b + a a • b = b • a 4. associativity: a + (b + c) = (a + b) + c a • (b • c) = (a • b) • c 5. identity: a + 0 = a a • 1 = a 6. distributivity: a + (b • c) = (a + b) • (a + c) a • (b + c) = (a • b) + (a • c) 7. complementarity: a + a' = 1 a • a' = 0
Switching Expressions Any switching function that can be expressed as a truth table can be written as an expression in Boolean algebra using operators: ', +, and •, i.e. Switching Expressions. X Y X • Y 0 0 0 0 1 0 1 0 0 1 1 1 X Y X' X' • Y 0 0 1 0 0 1 1 1 1 0 0 0 1 1 0 0 X Y X' Y' X • Y X' • Y' ( X • Y ) + ( X' • Y' ) 0 0 1 1 0 1 1 0 1 1 0 0 0 0 1 0 0 1 0 0 0 1 1 0 0 1 0 1
S. F and Logic Gates NOT X' X ~X AND X • Y XY X Y OR X + Y X Y X Y Z 0 0 0 0 1 0 1 0 0 1 1 1 X Y Z X Y Z 0 0 0 0 1 1 1 0 1 1 1 1 X Z Y
X xor Y = X Y' + X' Y X or Y but not both ("inequality", "difference") Logic Gates (Cont.) X Y Z 0 0 1 0 1 1 1 0 1 1 1 0 NAND NOR XOR X Y XNOR X Z Y X Y Z 0 0 1 0 1 0 1 0 0 1 1 0 X Z Y X Y Z 0 0 0 0 1 1 1 0 1 1 1 0 X xor Y = X Y' + X' Y X or Y but not both ("inequality", "difference") X Z Y X Y Z 0 0 1 0 1 0 1 0 0 1 1 1 X xnor Y = X Y + X' Y' X and Y are the same ("equality", "coincidence") X Z Y
Universal sets Can we implement all switching functions from NOT, NOR, and NAND? Univerval sets: {NOT, AND, OR} {NOR} {NAND}
Axioms of Boolean Algebra Identity 1. X + 0 = X 1D. X • 1 = X Null 2. X + 1 = 1 2D. X • 0 = 0 Idempotency: 3. X + X = X 3D. X • X = X Involution: 4. (X')' = X Complementarity: 5. X + X' = 1 5D. X • X' = 0 Commutativity: 6. X + Y = Y + X 6D. X • Y = Y • X Associativity: 7. (X + Y) + Z = X + (Y + Z) 7D. (X • Y) • Z = X • (Y • Z)
Axioms of Boolean Algebra (Cont.) Distributivity: 8. X • (Y + Z) = (X • Y) + (X • Z) 8D. X + (Y • Z) = (X + Y) • (X + Z) Uniting: 9. X • Y + X • Y' = X 9D. (X + Y) • (X + Y') = X Absorption: 10. X + X • Y = X 10D. X • (X + Y) = X 11. (X + Y') • Y = X • Y 11D. (X • Y') + Y = X + Y Factoring: 12. (X + Y) • (X' + Z) = 12D. X • Y + X' • Z = X • Z + X' • Y (X + Z) • (X' + Y) Concensus: 13. (X • Y) + (Y • Z) + (X' • Z) = 13D. (X + Y) • (Y + Z) • (X' + Z) = X • Y + X' • Z (X + Y) • (X' + Z)
De Morgan’s Law de Morgan's Law: 14. (X + Y )' = X' • Y' 14D. (X • Y )' = X' + Y' establishes relationship between • and + also called “bubble logic” X y X y
Equivalent Switching Expressions Two switching expressions are equivalent if they represent the same switching function: Have the same number of inputs variables Output is same for all combinations of input values Example:
Equivalence Proof Show that E1 and E2 are equivalent: E1 = bc+cb’+ac E2 = c Show that a+a’b = a+b Show that xyz+x’y+xyz’ = y
Canonical Forms Truth table is the unique signature of a switching function Many alternative switching expressions may have the same truth table - equivalence Canonical forms Standard forms for a switching expression Provides a unique algebraic signature
Sum Of Products (S.O.P.) Also known as sum of minterms Corresponding to two-level AND-OR networks F = 001 011 101 110 111 + ABC A'B'C + ABC' + A'BC + AB'C F = A B C F F' 0 0 0 0 1 0 0 1 1 0 0 1 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 0 F' = A'B'C' + A'BC' + AB'C'
Sum Of Products (Cont.) Minterm ANDed product of literals – input combination for which output is true Each variable appears exactly once, in true or inverted form (but not both) F in canonical form: F(A, B, C) = m(1,3,5,6,7) = m1 + m3 + m5 + m6 + m7 = A'B'C + A'BC + AB'C + ABC' + ABC canonical form minimal form F(A, B, C) = A'B'C + A'BC + AB'C + ABC + ABC' = (A'B' + A'B + AB' + AB)C + ABC' = ((A' + A)(B' + B))C + ABC' = C + ABC' = ABC' + C = AB + C A B C minterms 0 0 0 A'B'C' m0 0 0 1 A'B'C m1 0 1 0 A'BC' m2 0 1 1 A'BC m3 1 0 0 AB'C' m4 1 0 1 AB'C m5 1 1 0 ABC' m6 1 1 1 ABC m7 m-Notation short-hand notation for minterms of 3 variables
Product of Sums Also known as product of maxterm Corresponds to two-level OR-AND networks F = 000 010 100 F = (A + B' + C) (A' + B + C) (A + B + C) A B C F F' 0 0 0 0 1 0 0 1 1 0 0 1 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 0 F' = (A + B + C') (A + B' + C') (A' + B + C') (A' + B' + C) (A' + B' + C')
Product of Sums (Cont.) Maxterm ORed sum of literals – input combination for which output is false each variable appears exactly once, in true or inverted form (but not both) A B C maxterms 0 0 0 A+B+C M0 0 0 1 A+B+C' M1 0 1 0 A+B'+C M2 0 1 1 A+B'+C' M3 1 0 0 A'+B+C M4 1 0 1 A'+B+C' M5 1 1 0 A'+B'+C M6 1 1 1 A'+B'+C' M7 F in canonical form: F(A, B, C) = M(0,2,4) = M0 • M2 • M4 = (A + B + C) (A + B' + C) (A' + B + C) canonical form minimal form F(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 + C) (B + C) M-Notation short-hand notation for maxterms of 3 variables
Canonical form conversions Minterm to maxterm conversion Use maxterms whose indices do not appear in minterm expansion e.g., F(A,B,C) = m(1,3,5,6,7) = M(0,2,4) Maxterm to minterm conversion Use minterms whose indices do not appear in maxterm expansion e.g., F(A,B,C) = M(0,2,4) = m(1,3,5,6,7) Minterm expansion of F to minterm expansion of F' Use minterms whose indices do not appear e.g., F(A,B,C) = m(1,3,5,6,7) F'(A,B,C) = m(0,2,4) Maxterm expansion of F to maxterm expansion of F' Use maxterms whose indices do not appear e.g., F(A,B,C) = M(0,2,4) F'(A,B,C) = M(1,3,5,6,7)
An Example: Binary coded decimal increment by 1 BCD digits encode decimal digits 0 – 9 in bit patterns 0000 – 1001 A B C D W X Y Z 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 1 0 0 1 1 0 1 0 0 0 1 0 0 0 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0 1 1 1 0 1 1 1 1 0 0 0 1 0 0 0 1 0 0 1 1 0 0 1 0 0 0 0 1 0 1 0 X X X X 1 0 1 1 X X X X 1 1 0 0 X X X X 1 1 0 1 X X X X 1 1 1 0 X X X X 1 1 1 1 X X X X 0-set of W 1-set of W don't care (DC) set of W these inputs patterns should never be encountered in practice – "don't care" about associated output values, can be exploited in minimization
An Example - Cont. Canonical representations of the BCD increment by 1 function: Z = m0 + m2 + m4 + m6 + m8 + d10 + d11 + d12 + d13 + d14 + d15 Z = [ m(0,2,4,6,8) + d.c.(10,11,12,13,14,15) ] Z = M1 • M3 • M5 • M7 • M9 • D10 • D11 • D12 • D13 • D14 • D15 Z = [ M(1,3,5,7,9) • D.C.(10,11,12,13,14,15) ]
Summary Truth tables and switching functions NOT, AND, OR, NAND, NOR, XOR Axioms and theorems of Boolean algebra Proofs by re-writing Canonical forms SOP, POS, m/M-notation, 1/0/dc-sets Expression equivalence Incompletely specified Functions
Next Lecture Chapter 3 – Combinational IC’s