1 / 62

EE345 – Micro-Controllers Gate-Level Minimization

EE345 – Micro-Controllers Gate-Level Minimization. Prof. Ahmad Abu-El-Haija. Acknowledgement.

Download Presentation

EE345 – Micro-Controllers Gate-Level Minimization

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. EE345 – Micro-ControllersGate-Level Minimization Prof. Ahmad Abu-El-Haija

  2. Acknowledgement • This presentation is a modified version of lecture notes prepared by Dr. Pradondet Nilagupta, Kasetsart University. The latter is also a modified version based upon presentations by Prof. Maciej Ciesielski and Prof. Tilman Wolf, University of Massachusetts Amherst, and original slides from the publisher. Digital System Design

  3. Minimization of Logic Functions • We have chips with millions of gates • Why care about minimizing a function? • What do a few gates matter? • Basic logic functions replicated thousands of times • Saving one gate for a memory cell pays off • What is the criterion for “minimization” • Should we minimize • Number of product terms? • Number of logic operations? • Number of variables (literals)? • Number of wires? • …? • For implementation: minimize number of gates EE345 - Micro-Controllers

  4. How to Minimize Gate Count? • Example: • F=A’BC’+AB’C’+AB’C+ABC’= Σ(2,4,5,6) • How many gates do we need for implementation? • If AND gates have 3 inputs and OR gates have 4 inputs? • If all gates are binary (2 inputs)? • Are there any tricks we can use? • Combine minterms: • A’BC’+ABC’=BC’ • AB’C’+AB’C=AB’ • F = BC’+AB’ • How many gates does F need now? • Simplest expression: • Minimum number of terms and literals per term • We need systematic approach to minimize expression • Answer: Karnaugh maps (K-maps) EE345 - Micro-Controllers

  5. Karnaugh Maps • Karnaugh maps (K-maps) are graphical representations of boolean functions. • One map cell corresponds to a row in the truth table. • Also, one map cell corresponds to a minterm or a maxterm in the boolean expression • Multiple-cell areas of the map correspond to standard terms. EE345 - Micro-Controllers

  6. Two-Variable Map x1 0 1 x2 x2 x1 0 1 0 m0 m1 0 m0 m2 0 1 0 2 OR 1 2 m2 m3 3 1 1 m1 m3 3 NOTE: ordering of variables is IMPORTANT for f(x1,x2), x1 is the row, x2 is the column. Cell 0 represents x1’x2’; Cell 1 represents x1’x2; etc. If a minterm is present in the function, then a 1 is placed in the corresponding cell. EE345 - Micro-Controllers

  7. Boolean Function in Karnaugh Map • 1s and 0s represent function in Karnaugh map • 1 represent On-set (F=1), 0 represents Off-set (F=0) • Similar to truth table • 0s are typically not shown EE345 - Micro-Controllers

  8. Two-Variable Map • Any two adjacent cells in the map differ by ONLY one variable, which appears complemented in one cell and uncomplemented in the other. • Example:m0 (=x1’x2’) is adjacent to m1 (=x1’x2) and m2 (=x1x2’) but NOT m3 (=x1x2) EE345 - Micro-Controllers

  9. 2-Variable Map -- Example • f(x1,x2) = x1’x2’+ x1’x2 + x1x2’ = m0 + m1 + m2 = x1’ + x2’ • 1s placed in K-map for specified minterms m0, m1, m2 • Grouping (ORing) of 1s allows simplification • What (simpler) function is represented by each dashed rectangle? • x1’ = m0 + m1 • x2’ = m0 + m2 • Note m0 covered twice x2 0 1 2 3 EE345 - Micro-Controllers

  10. 3-variable Karnaugh Map • Karnaugh map with 3 variables: • Two variables on one side, one on the other • Note Gray code sequence (single variable change) facilitates grouping of 1-entries into logic blocks EE345 - Micro-Controllers

  11. Blocks in Karnaugh Maps • Identifying blocks in Karnaugh maps • Neighboring minterms can be combined: • x’y’z’ + x’y’z = x’y’(z’+z) = x’y’ • Resulting expression uses fewer literals (z no longer present) EE345 - Micro-Controllers

  12. yz 00 01 11 10 x 0 m0 m1 m3 m2 0 1 3 2 1 m4 m5 m7 m6 4 5 7 6 3-Variable Map -Note: variable ordering is (x,y,z); yz specifies column, x specifies row. -Each cell is adjacent to three other cells (left or right or top or bottom or edge wrap) EE345 - Micro-Controllers

  13. Example: Blocks in Karnaugh Maps • Example: • F(x,y,z) = Σ(2,3,4,5) = x’yz’+x’yz+xy’z’+xy’z • Two blocks of size 2: • F = x’y + xy’ EE345 - Micro-Controllers

  14. Example: Blocks in Karnaugh Maps • What is the Karnaugh map for • F(x,y,z) = Σ(3,4,6,7) ? • Block can continue across “borders”, wrap around • Left to right • Top to bottom F = yz + xz’ EE345 - Micro-Controllers

  15. Blocks in Karnaugh Maps • Can we combine more than two minterms? • Yes: x’y’z’+x’y’z+xy’z’+xy’z = (x’+x)y’(z’+z) = y’ • Any block that is “power of 2 size” can be reduced • Needs to be filled entirely with 1s • Largest possible block yields simplest expression EE345 - Micro-Controllers

  16. Overlapping Blocks • Example: F(A,B,C) = Σ(1,2,3,5,7) • Blocks can overlap • Still find the largest possible power-2 blocks EE345 - Micro-Controllers

  17. Converting Blocks into Expressions • How to convert blocks into algebraic expressions? • Write down the variables that do not change • Example: F(A,B,C) = C + A’B EE345 - Micro-Controllers

  18. Simplification • Enter minterms of the Boolean function into the map, then group terms • Example: f(a,b,c) = ac’ + abc + bc’ • Result: f(a,b,c) = ac’+ b bc a 0 1 0 1 00 01 10 11 00 01 10 11 EE345 - Micro-Controllers

  19. More Examples • f1(x, y, z) = ∑ m(2,3,5,7) f1(x, y, z) = x’y + xz • f2(x, y, z) = ∑ m (0,1,2,3,6) f2(x, y, z) = x’+yz’ EE345 - Micro-Controllers

  20. More Examples EE345 - Micro-Controllers

  21. 4-variable Karnaugh Map • Karnaugh map can be extended to 4 variables: • Top cells are adjacent to bottom cells. Left-edge cells are adjacent to right-edge cells. • Note variable ordering (WXYZ). EE345 - Micro-Controllers

  22. Four-variable Map Simplification • One square represents a minterm of 4 literals. • A rectangle of 2 adjacent squares represents a product term of 3 literals. • A rectangle of 4 squares represents a product term of 2 literals. • A rectangle of 8 squares represents a product term of 1 literal. • A rectangle of 16 squares produces a function that is equal to logic 1. EE345 - Micro-Controllers

  23. cd ab 00 01 11 10 1 1 1 1 1 1 00 1 1 1 1 1 1 01 1 1 1 1 1 1 1 11 1 1 1 10 Example • Simplify the following Boolean function g(A,B,C,D) = ∑m(0,1,2,4,5,7,8,9,10,12,13). • First put the function g( ) into the map, and then group as many 1s as possible. 00 01 11 10 g(A,B,C,D) = c’+b’d’+a’bd EE345 - Micro-Controllers

  24. Example: 4-variable Karnaugh Map • Example: F(w,x,y,z)= Σ(0,1,2,4,5,6,8,9,12,13,14) EE345 - Micro-Controllers

  25. Example: Simplify Boolean Function • F(A,B,C,D)= A’B’C’+B’CD’+A’BCD’+AB’C’ EE345 - Micro-Controllers

  26. Choice of Blocks • We can simplify function by using larger blocks • Do we really need all blocks? • Can we leave some out to further simplify expression? • Function needs to contain special type of blocks • They are called Essential Prime Implicants • Need to define new terms • Implicant • Prime implicant • Essential prime implicant EE345 - Micro-Controllers

  27. Terminology • Implicant • Any product term in the SOP form • A block of 1’s in a K-map • Prime implicant • Product term that cannot be further reduced • Block of 1’s that cannot be further increased • Essential prime implicant • Prime implicant that covers a 1 (minterm) that is not covered by any other prime implicant • Quine’s Theorem: • Boolean function can be implemented with only essential prime implicants (but other solutions exist) • The number of such implicants is minimum EE345 - Micro-Controllers

  28. Example • F(A,B,C,D)= Σ(0, 2,3,5,7,8,9,10,11,13,15) • F(A,B,C,D) = BD+B’D’+CD+AD = BD+B’D’+CD+AB’ = BD+B’D’+B’C+AD = BD+B’D’+B’C+AB’ EE345 - Micro-Controllers

  29. Example • Consider function f(a,b,c,d) whose K-map is shown at right. • a’b’ is not a prime implicant because it is contained in b’. • acdis not a prime implicant because it is contained in ad. • b’,ad, and a’cd’ are prime implicants. b’ ad cd ab 1 1 1 1 1 1 1 1 a’b’ 1 1 1 acd a’cd’ EE345 - Micro-Controllers

  30. Essential Prime Implicants (EPIs) • If a minterm of a function F is included in ONLY one prime implicant p, then p is an essential prime implicant of F. • An essential prime implicant MUST appear in all possible SOP expressions of a function • To find essential prime implicants: • Generate all prime implicants of a function • Select those prime implicants that contain at least one 1 that is not covered by any other prime implicant. • For the previous example, the PIs are b’, ad, and a’cd’; all of these are essential. b’ ad 1 1 1 1 1 1 1 1 1 1 1 a’cd’ EE345 - Micro-Controllers

  31. Another Example • Consider f2(a,b,c,d), whose K-map is shown below. • The only essential PI is b’d. ab cd EE345 - Micro-Controllers

  32. A A 6 prime implicants: A'B'D, BC', AC, A'C'D, AB, B'CD 1 0 1 0 1 0 1 0 0 0 1 1 0 1 1 1 D D essential 1 1 0 0 1 1 1 1 1 0 0 0 0 1 0 1 C C B B 5 prime implicants: BD, ABC', ACD, A'BC, A'C'D essential Examples to illustrate terms minimum cover: AC + BC' + A'B'D minimum cover: 4 essential implicants EE345 - Micro-Controllers

  33. Systematic Procedure for Simplifying Boolean Functions • Generate all PIs of the function. • Include all essential PIs. • For remaining minterms not included in the essential PIs, select a set of other PIs to cover them, with minimal overlap in the set. • The resulting simplified function is the logical OR of the product terms selected above. EE345 - Micro-Controllers

  34. f(a,b,c,d) = ∑m(0,1,2,3,4,5,7,14,15). Five grouped terms, not all needed. 3 shaded cells covered by only one term 3 EPIs, since each shaded cell is covered by a different term. F(a,b,c,d) = a’b’ + a’c’ + a’d + abc cd ab 1 1 1 1 1 1 1 1 1 Example EE345 - Micro-Controllers

  35. Product of Sums Simplification • Use sum-of-products simplification on the zeros of the function in the K-map to get F’. • Find the complement of F’, i.e. (F’)’ = F • Recall that the complement of a boolean function can be obtained by (1) taking the dual and (2) complementing each literal. • OR, using DeMorgan’s Theorem. EE345 - Micro-Controllers

  36. Product of Sums Minimization • How to generate a product of sums from a Karnaugh map? • Use duality of Boolean algebra (DeMorgan law) • Look at 0s in map instead of 1s • Generate blocks around 0’s • Gives inverse of function • Use duality to generate product of sums • Example: • F = Σ(0,1,2,5,8,9,10) • F’ = AB+ CD + BD’ • F = (A’+B’)(C’+D’)(B’+D) EE345 - Micro-Controllers

  37. Gate Implementation EE345 - Micro-Controllers

  38. cd ab 1 1 1 1 1 1 1 0 0 0 1 1 0 0 0 0 Example: POS minimization • F’(a,b,c,d) = ab’ + ac’ + a’bcd’ • Find dual of F’, dual(F’) = (a+b’)(a+c’)(a’+b+c+d’) • Complement of literals in dual(F’) to get FF = (a’+b)(a’+c)(a+b’+c’+d) (verify that this is the same as in slide 33) EE345 - Micro-Controllers

  39. BC DE A=1 16 17 19 18 BC DE 20 21 23 22 0 1 3 2 29 28 31 30 4 5 7 6 24 25 27 26 12 13 15 14 ABCDE’ 8 9 11 10 A=0 A’BCDE’ 5-variable Karnaugh Map EE345 - Micro-Controllers

  40. Relationship between #of adjacent squares and # of literals EE345 - Micro-Controllers

  41. Example: 5-variable Karnaugh Map • Example: F(A,B,C,D,E) = Σ(0,2,4,6,9,13,21,23,25,29,31) F = A’B’E’+BD’E+ACE EE345 - Micro-Controllers

  42. Don't Care Conditions • There may be a combination of input values which • will never occur • if they do occur, the output is of no concern. • The function value for such combinations is called a don't care. • They are usually denoted with x. Each xmay be arbitrarily assigned the value 0 or 1 in an implementation. • Don’t cares can be used to further simplify a function EE345 - Micro-Controllers

  43. Minimization using Don’t Cares • Treat don't cares as if they are 1s to generate PIs. • Delete PI's that cover only don't care minterms. • Treat the covering of remaining don't care minterms as optional in the selection process (i.e. they may be, but need not be, covered). EE345 - Micro-Controllers

  44. Minimization example • F(w,x,y,z) = Σ(1,3,7,11,15) and d(w,x,y,z) = Σ(0,2,5) • What are possible solutions? EE345 - Micro-Controllers

  45. Simplify the function f(a,b,c,d) whose K-map is shown at the right. f = a’c’d+ab’+cd’+a’b’c or f = a’c’d+ab’+cd’+a’bd’ The middle two terms are EPIs, while the first and last terms are selected tocover the minterms m1, m4, and m5. (There’s a third solution!) 0 1 0 1 1 1 0 1 0 0 x x 1 1 x x 0 1 0 1 1 1 0 1 0 0 x x 1 1 x x Example cd ab 01 11 00 10 00 01 11 10 EE345 - Micro-Controllers

  46. Simplify the function g(a,b,c,d) whose K-map is shown at right. g = a’c’+ abor g = a’c’+bd’ Another Example cd ab EE345 - Micro-Controllers

  47. NAND and NOR Implementations • Digital circuit are frequently constructed with NAND or NOR gates rather than AND and OR gates. • NAND and NOR gates are easier to fabricate with electronic components and are the basic gates used in all IC digital logic families. EE345 - Micro-Controllers

  48. Logic Operations with NAND gate • NOT, AND, and OR can be implemented with NAND EE345 - Micro-Controllers

  49. Conversion to NAND Implementation • Minimized expressions are AND-OR combinations • Two illustrations for NAND gates • AND-invert • Invert-OR • Key observation: two “bubbles” eliminate each other • Two bubbles equal straight wire • How to generate a sum of minterms using NAND? • Use AND-invert for minterms • Use invert-OR for sum EE345 - Micro-Controllers

  50. Conversion to NAND Implementation • Sum of minterms • Replace AND with AND-invert and OR with invert-OR • Still same circuit! • Replace AND-invert and invert-OR with NAND • F=((AB)’(CD)’ = AB+CD EE345 - Micro-Controllers

More Related