L 5 Combinational Logic Design Construction and Boolean
L 5: Combinational Logic Design (Construction and Boolean Algebra) Acknowledgements: Materials in this lecture are courtesy of the following sources and are used with permission. Prof. Randy Katz (Unified Microelectronics Corporation Distinguished Professor in Electrical Engineering and Computer Science at the University of California, Berkeley) and Prof. Gaetano Borriello (University of Washington Department of Computer Science & Engineering) from Chapter 2 of R. Katz, G. Borriello. Contemporary Logic Design. 2 nd ed. Pentice-Hall/Pearson Education, 2005. J. Rabaey, A. Chandrakasan, B. Nikolic. Digital Integrated Circuits: A Design Perspective. Prentice Hall/Pearson, 2003. Introductory Digital Systems Laboratory 1
Review: Noise Margin Truth Table IN "1" V OH V IH OUT "0" VOL OUT 0 1 1 0 V(y) VOH Slope = -1 NML= VIL -VOL NMH= VOH -VIH Undefined Region VIL IN Slope = -1 VOL VOH VOL V V IL IH V(x) Large noise margins protect against various noise sources Introductory Digital Systems Laboratory 2
MOS Technology: The NMOS Switch gate source drain N+ N+ D VT = 0. 5 V G P-substrate S Vs Switch Model OFF RNMOS ON VGS < VT RNMOS VGS > VT NMOS ON when Switch Input is High Introductory Digital Systems Laboratory 3
NMOS Device Characteristics -4 body polysilicon gate source 6 5 n+ Resistiv e (A) 4 n+ n+ VGS= 2. 5 V drain gate p+ x 10 Saturation VGS= 2. 0 V 3 D I p n 2 inversion layer channel VGS= 1. 5 V gate oxide 1 0 0 D VGS= 1. 0 V 0. 5 1 VDS (V) 1. 5 2 2. 5 ID G + VGS VT = 0. 5 V - MOS is a very non-linear. Switch-resistor model sufficient for first order analysis. S Introductory Digital Systems Laboratory 4
PMOS: The Complementary Switch gate source S drain P+ P+ G VT = -0. 5 V N-substrate D VDD Switch Model OFF RPMOS ON VGS > VT RPMOS VGS < VT PMOS ON when Switch Input is Low Introductory Digital Systems Laboratory 5
The CMOS Inverter Switch Model VDD S RPMOS G IN D OUT IN D RNMOS G S IN Rail-to-rail Swing in CMOS Introductory Digital Systems Laboratory 6
Inverter VTC: Load Line Analysis I Dn VDD G PMOS V in = 0 V in = 2. 5 Vin = 0. 5 Vin = 2 S Vin = 1 D DOU T IN NMOS Vin = 1. 5 Vin = 2 Vin = 1. 5 V in = 1 Vin = 0. 5 Vin = 2. 5 Vin = 0 G S Vout 2. 5 2 1. 5 V out (V) CMOS gates have: Rail-to-rail swing (0 V to VDD) Large noise margins “zero” static power dissipation 1 0. 5 0 0 0. 5 1 1. 5 2 2. 5 V (V) in Introductory Digital Systems Laboratory 7
Possible Function of Two Inputs There are 16 possible functions of 2 input variables: X F Y X Y 0 0 1 16 possible functions (F 0–F 15) 0 0 0 X AND Y 0 0 0 1 0 X 0 0 1 1 0 0 Y 0 1 0 1 1 0 0 1 1 1 X XOR Y X OR Y 1 0 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 0 NOT X X = Y NOT Y X NOR Y NOT (X OR Y) 1 1 1 X NAND Y NOT (X AND Y) In general, there are 2 (2^n) functions of n inputs Introductory Digital Systems Laboratory 8
Common Logic Gates Gate NAND NOR OR Symbol X Y X Y Z Z Truth-Table X Y Z 0 0 1 1 1 0 X Y Z 0 0 1 1 1 X Y Z 0 0 1 0 1 0 0 1 1 0 X Y Z 0 0 1 1 1 0 1 1 Introductory Digital Systems Laboratory Expression Z=X • Y Z=X+Y 9
Exclusive (N)OR Gate XOR (X Y) XNOR (X Y) X Y Z Z X Y Z 0 0 1 1 1 0 X Y Z 0 0 1 0 1 0 0 1 1 1 Z=XY+XY X or Y but not both ("inequality", "difference") Z=XY+XY X and Y the same ("equality") Widely used in arithmetic structures such as adders and multipliers Introductory Digital Systems Laboratory 10
Generic CMOS Recipe Vdd . . . pullup: make this connection when we want F(A 1, …, An) = 1 . . . A 1 F(A 1, …, An) An. . . pulldown: make this connection when we want F(A 1, …, An) = 0 A A B B PUN O A CL PDN B Note: CMOS gates result in inverting functions! (easier to build NAND vs. AND) A 0 0 1 1 B PDN PUN 0 0 ff 0 n 1 0 ff 0 n 0 0 ff 0 n 1 0 n 0 ff O 1 1 1 0 How do you build a 2 -input NOR Gate? Introductory Digital Systems Laboratory 11
Theorems of Boolean Algebra (I) Elementary 1. X + 0 = X 2. X + 1 = 1 3. X + X = X 1 D. X • 1 = X 2 D. X • 0 = 0 3 D. X • X = X 4. (X) = X 5 D. X • X = 0 5. X + X = 1 Commutativity: 6. X + Y = Y + X 6 D. X • Y = Y • X Associativity: 7. (X + Y) + Z = X + (Y + Z) Distributivity: 8. X • (Y + Z) = (X • Y) + (X • Z) 8 D. X + (Y • Z) = (X + Y) • (X + Z) Uniting: 9. X • Y + X • Y = X 7 D. (X • Y) • Z = X • (Y • Z) Absorption: 9 D. (X + Y) • (X + Y) = X 10. X + X • Y = X 11. (X + Y) • Y = X • Y 10 D. X • (X + Y) = X 11 D. (X • Y) + Y = X + Y Introductory Digital Systems Laboratory 12
Theorems of Boolean Algebra (II) Factoring: 12. (X • Y) + (X • Z) = X • (Y + Z) 12 D. (X + Y) • (X + Z) = X + (Y • Z) Consensus: 13. (X • Y) + (Y • Z) + (X • Z) = X • Y+X • Z De Morgan's: 14. (X + Y +. . . ) = X • Y • . . . 13 D. (X + Y) • (Y + Z) • (X + Z) = (X + Y) • (X + Z) 14 D. (X • Y • . . . ) = X + Y +. . . Generalized De Morgan's: 15. f(X 1, X 2, . . . , Xn, 0, 1, +, • ) = f(X 1, X 2, . . . , Xn, 1, 0, • , +) Duality Dual of a Boolean expression is derived by replacing • by +, + by • , 0 by 1, and 1 by 0, and leaving variables unchanged f (X 1, X 2, . . . , Xn, 0, 1, +, • ) f(X 1, X 2, . . . , Xn, 1, 0, • , +) Introductory Digital Systems Laboratory 13
Simple Example: One Bit Adder 1 -bit binary adder inputs: A, B, Carry-in outputs: Sum, Carry-out A B Cin S Cout 0 0 1 1 0 1 0 1 0 1 1 0 0 0 1 1 1 A B Cin S Cout Sum-of-Products Canonical Form S = A B Cin + A B Cin Cout = A B Cin + A B Cin Product term (or 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) Introductory Digital Systems Laboratory 14
Simplify Boolean Expressions Cout = A B Cin + A B Cin + A B Cin = (A + A) B Cin + A (B + B) Cin + A B (Cin + Cin) = B Cin + A B = (B + A) Cin + A B S = A B Cin + A B Cin =( A B + A B )Cin + (A B + A B) Cin =(A B) Cin + (A B) Cin = A B Cin Introductory Digital Systems Laboratory 15
Sum-of-Products & Product-of-Sum Product term (or minterm): ANDed product of literals – input combination for which output is true A 0 0 B 0 0 C 0 1 minterms A B C m 0 m 1 0 0 1 1 0 1 0 1 A A A m 2 m 3 m 4 m 5 m 6 m 7 B B B C C C F in canonical form: F(A, B, C) = m(1, 3, 5, 6, 7) = m 1 + m 3 + m 5 + m 6 + m 7 F = A B C + A B C + ABC canonical form minimal form F(A, B, C) = A B C + ABC = (A B + AB)C + ABC = ((A + A)(B + B))C + ABC = ABC + C = AB + C short-hand notation form in terms of 3 variables Sum term (or maxterm) - ORed sum of literals – input combination for which output is false A B C maxterms 0 0 0 A+B+C M 0 F in canonical form: 0 0 1 A+B+C M 1 F(A, B, C) = M(0, 2, 4) 0 1 0 A+B+C M 2 = M 0 • M 2 • M 4 0 1 1 A+B+C M 3 = (A + B + C) 1 0 0 A+B+C M 4 canonical form minimal form 1 0 1 A + B+ C M 5 F(A, B, C) = (A + B + C) 1 1 0 A + B +C M 6 = (A + B + C) (A+ B + C) 1 1 1 A +B + C M 7 (A + B + C) = (A + C) (B + C) short-hand notation for maxterms of 3 variables Introductory Digital Systems Laboratory 16
Mapping Between Forms 1. Minterm to Maxterm conversion: rewrite minterm shorthand using maxterm shorthand replace minterm indices with the indices not already used E. g. , F(A, B, C) = m(3, 4, 5, 6, 7) = M(0, 1, 2) 2. Maxterm to Minterm conversion: rewrite maxterm shorthand using minterm shorthand replace maxterm indices with the indices not already used E. g. , F(A, B, C) = M(0, 1, 2) = m(3, 4, 5, 6, 7) 3. Minterm expansion of F to Minterm expansion of F': in minterm shorthand form, list the indices not already used in F E. g. , F(A, B, C) = m(3, 4, 5, 6, 7) = M(0, 1, 2) 4. F'(A, B, C) = m(0, 1, 2) = M(3, 4, 5, 6, 7) Minterm expansion of F to Maxterm expansion of F': rewrite in Maxterm form, using the same indices as F E. g. , F(A, B, C) = m(3, 4, 5, 6, 7) = M(0, 1, 2) F'(A, B, C) = M(3, 4, 5, 6, 7) = m(0, 1, 2) Introductory Digital Systems Laboratory 17
The Uniting Theorem Key tool to simplification: A (B + B) = A Essence of simplification of two-level logic Find two element subsets of the ON-set where only one variable changes its value – this single varying variable can be eliminated and a single product term used to represent both elements A B F 0 0 1 0 1 1 1 0 F = A B +AB = (A +A)B = B B has the same value in both on-set rows – B remains A has a different value in the two rows – A is eliminated Introductory Digital Systems Laboratory 18
Boolean Cubes Just another way to represent truth table Visual technique for identifying when the uniting theorem can be applied n input variables = n-dimensional "cube" XY 0 1 -cube 1 Y X 00 XYZ 111 011 11 01 2 -cube 10 X 110 1111 0011 010 1110 0010 0110 Y 000 001 Z 101 100 X 3 -cube WXYZ 1011 Y 0001 Z 1001 0101 1100 W 0000 X 1101 1000 0100 4 -cube Introductory Digital Systems Laboratory 19
Mapping Truth Tables onto Boolean Cubes Uniting theorem A B F 0 0 1 0 1 1 1 0 Circled group of the on-set is called the adjacency plane. Each adjacency plane F corresponds to a product term. 11 01 ON-set = solid nodes OFF-set = empty nodes B 00 A 10 A varies within face, B does not this face represents the literal B Three variable example: Binary full-adder carry-out logic A 0 0 1 1 B 0 0 1 1 Cin 0 1 0 1 Cout 0 0 0 1 1 1 (A+A)BCin AB(Cin+Cin) 111 Cout = BCin+AB+ACin B C 000 101 A A(B+B)Cin The on-set is completely covered by the combination (OR) of the subcubes of lower dimensionality - note that “ 111” is covered three times Introductory Digital Systems Laboratory 20
Higher Dimension Cubes F(A, B, C) = m(4, 5, 6, 7) 011 110 010 B C 000 001 A 101 100 on-set forms a square i. e. , a cube of dimension 2 (2 -D adjacency plane) represents an expression in one variable i. e. , 3 dimensions – 2 dimensions A is asserted (true) and unchanged B and C vary This subcube represents the literal A In a 3 -cube (three variables): 0 -cube, i. e. , a single node, yields a term in 3 literals 1 -cube, i. e. , a line of two nodes, yields a term in 2 literals 2 -cube, i. e. , a plane of four nodes, yields a term in 1 literal 3 -cube, i. e. , a cube of eight nodes, yields a constant term "1" In general, m-subcube literals within an n-cube (m < n) yields a term with n – m Introductory Digital Systems Laboratory 21
Karnaugh Maps Alternative to truth-tables to help visualize adjacencies Guide to applying the uniting theorem - On-set elements with only one variable changing value are adjacent unlike in a linear truth-table A B 0 1 0 1 1 2 0 3 1 0 A B F 0 0 1 0 1 1 1 0 Numbering scheme based on Gray–code e. g. , 00, 01, 10 (only a single bit changes in code for adjacent map cells) A 0 B 0 2 -variable K-map 1 1 0 2 1 3 AB CD 00 AB C 3 -variable K-map 00 0 1 01 A 01 11 11 10 C 0 2 6 4 1 3 7 5 10 A 00 01 11 10 0 4 12 8 1 5 13 9 3 7 15 11 2 6 14 10 B B Introductory Digital Systems Laboratory D 4 -variable K-map 22
K-Map Examples A AB 00 01 11 10 0 1 0 1 1 1 Cin AB C A 00 01 11 0 0 0 1 1 1 0 0 1 1 B 10 B Cout = F(A, B, C) = A A 00 01 11 10 AB C 0 1 0 0 1 1 1 0 0 AB C 00 01 11 10 B B F(A, B, C) = m(0, 4, 5, 7) F= F' simply replace 1's with 0's and vice versa F'(A, B, C) = m(1, 2, 3, 6) F' = Introductory Digital Systems Laboratory 23
Four Variable Karnaugh Map AB CD A 00 01 11 10 00 1 01 0 0 F(A, B, C, D) = m(0, 2, 3, 5, 6, 7, 8, 10, 11, 14, 15) F=C+ABD+B D Find the smallest number of the largest possible subcubes that cover the ON-set D C 11 1 1 10 1 1 B 1011 0011 1010 0010 1110 K-map Corner Adjacency Illustrated in the 4 -Cube 0110 D 1101 1100 A B 1001 0101 0001 C 0000 1111 0100 1000 Introductory Digital Systems Laboratory 24
K-Map Example: Don’t Cares Don't. Carescan canbe betreatedas as 1'sor or 0'sififititis isadvantageousto todo do so so AB CD A 00 01 11 10 00 0 0 X 0 01 1 1 X 1 F(A, B, C, D) = m(1, 3, 5, 7, 9) + d(6, 12, 13) F = A D + B C D w/o don't cares D C 11 1 1 0 0 10 0 X 0 0 F = C D + A D w/ don't cares By treating this DC as a "1", a 2 -cube can be formed rather than one 0 -cube B AB CD In Po. S form: F = D (A + C) Equivalent answer as above, but fewer literals C A 00 01 11 10 00 0 0 X 0 01 1 1 X 1 11 1 1 0 0 10 0 X 0 0 D B Introductory Digital Systems Laboratory 25
Hazards AB Static hazards: Consider this function: C F = A * C + B *C A C 0 0 0 1 1 1 0 F B Implemented with MSI gates: 1 A '00 '00 F C '00 B 2 A = B =1 C 1 2 F 00 01 11 10 Gate delay Glitch Figure by MIT Open. Course. Ware. Introductory Digital Systems Laboratory 26
Fixing Hazards The glitch is the result of timing differences in parallel data paths. It is associated with the function jumping between groupings or product terms on the K-map. To fix it, cover it up with another grouping or product term! AB C 00 01 11 10 A C B F 0 0 0 1 1 1 0 F=A*C +B*C+A*B Figure by MIT Open. Course. Ware. In general, it is difficult to avoid hazards – need a robust design methodology to deal with hazards. L 2: 6. 111 Spring 2006 Introductory Digital Systems Laboratory 27
- Slides: 27