Digitl Design Chpter 6: Optimiztions nd Trdeoffs Slides to ccompny the tetbook Digitl Design, with RTL Design, VHDL, nd Verilog, 2nd Edition, by Frnk Vhid, John Wiley nd Sons Publishers, 2. http://www.ddvhid.com Frnk Vhid Instructors of courses requiring Vhid's Digitl Design tetbook (published by John Wiley nd Sons) hve permission to modify nd use these slides for customry course-relted ctivities, subject to keeping this copyright notice in plce nd unmodified. These slides my be posted s unnimted pdf versions on publicly-ccessible course websites.. PowerPoint source (or pdf with nimtions) Digitl my Design not be posted 2e to publicly-ccessible websites, but my be posted for students on internl protected sites or distributed directly to students by other electronic mens. Instructors my Copyright mke printouts 2 of the slides vilble to students for resonble photocopying chrge, without incurring roylties. Any other use requires eplicit permission. Instructors my obtin PowerPoint Frnk Vhid source or obtin specil use permissions from Wiley see http://www.ddvhid.com for informtion. You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
Krnugh Mps for Two-Level Size Optimiztion Esy to miss possible opportunities to combine terms when doing lgebriclly Krnugh Mps (K-mps) Grphicl method to help us find opportunities to combine terms Minterms differing in one vrible re djcent in the mp Cn clerly see opportunities to combine terms look for djcent s For F, clerly two opportunities Top left circle is shorthnd for: y z + y z = y (z +z) = y () = y Drw circle, write term tht hs ll the literls ecept the one tht chnges in the circle Circle y, = & y= in both cells of the circle, but z chnges (z= in one cell, in the other) Minimized function: OR the finl terms Digitl Design 2e Frnk Vhid Esier thn lgebriclly: F F F F = y z + + + y z F = y + y Notice not in binry order y z y y z y z y z Tret left & right s djcent too F = + + y z + y z F = y(z + z ) + y (z + z ) F = y* + y * F = y + y y K-mp 7 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
K-mps Four djcent s mens two vribles cn be eliminted Mkes intuitive sense those two vribles pper in ll combintions, so one term must be true Drw one big circle shorthnd for the lgebric trnsformtions bove G = y z + y z + + G = (y z + y z + + ) (must be true) G = (y (z +z) + y(z+z )) G = (y +y) G = G Digitl Design 2e Frnk Vhid G Drw the biggest circle possible, or you ll hve more terms thn relly needed y y 8 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
K-mps Four djcent cells cn be in shpe of squre OK to cover twice Just like duplicting term Remember, c + d = c + d + d No need to cover s more thn once Yields etr terms not minimized J y y z z H I H = y z + + y z + (y ppers in ll combintions) y z z The two circles re shorthnd for: I = y z + y z + y z + + I = y z + y z + y z + y z + + I = ( y z + y z) + (y z + y z + + ) I = (y z) + () Digitl Design 2e Frnk Vhid 9 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
K-mps Circles cn cross left/right sides Remember, edges re djcent Minterms differ in one vrible only Circles must hve, 2, 4, or 8 cells 3, 5, or 7 not llowed 3/5/7 doesn t correspond to lgebric trnsformtions tht combine terms to eliminte vrible Circling ll the cells is OK K y z L E z Function just equls Digitl Design 2e Frnk Vhid You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
K-mps for Four Vribles Four-vrible K-mp follows sme principle Adjcent cells differ in one vrible Left/right djcent Top/bottom lso djcent 5 nd 6 vrible mps eist But hrd to use Two-vrible mps eist But not very useful esy to do lgebriclly by hnd F z y F w w y G w F=w y + Digitl Design 2e Frnk Vhid z G=z You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
Two-Level Size Optimiztion Using K-mps Generl K-mp method. Convert the function s eqution into sum-of-minterms form 2. Plce s in the pproprite K-mp cells for ech minterm 3. Cover ll s by drwing the fewest lrgest circles, with every included t lest once; write the corresponding term for ech circle 4. OR ll the resulting terms to crete the minimized function. Digitl Design 2e Frnk Vhid 2 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
Two-Level Size Optimiztion Using K-mps Generl K-mp method. Convert the function s eqution into sum-of-minterms form 2. Plce s in the pproprite K-mp cells for ech minterm Common to revise () nd (2): Crete sum-of-products Drw s for ech product E: F = w'z + + w'y'z' F w w z w y z Digitl Design 2e Frnk Vhid 3 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
Two-Level Size Optimiztion Using K-mps Generl K-mp method. Convert the function s eqution into sum-of-minterms form 2. Plce s in the pproprite K-mp cells for ech minterm 3. Cover ll s by drwing the fewest lrgest circles, with every included t lest once; write the corresponding term for ech circle Emple: Minimize: G = + b c + b*(c + bc ). Convert to sum-of-products G = + b c + bc + bc 2. Plce s in pproprite cells b c G bc bc 4. OR ll the resulting terms to crete the minimized function. 3. Cover s G bc c Digitl Design 2e Frnk Vhid 4. OR terms: G = + c 4 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
Two-Level Size Optimiztion Using K-mps Minimize: H = b (cd + c d ) + b c d + b cd + bd + bcd. Convert to sum-of-products: H = b cd + b c d + b c d + b cd + bd + bcd 2. Plce s in K-mp cells 3. Cover s 4. OR resulting terms Four Vrible Emple H b b c d cd b c d b cd bd bcd b d bc bd b cd H = b d + bc + bd Funny-looking circle, but remember tht left/right djcent, nd top/bottom djcent Digitl Design 2e Frnk Vhid 5 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
Don t Cre Input Combintions Wht if we know tht prticulr input combintions cn never occur? e.g., Minimize F = y z, given tht y z (=) cn never be true, nd tht y z (=) cn never be true So it doesn t mtter wht F outputs when y z or y z is true, becuse those cses will never occur Thus, mke F be or for those cses in wy tht best minimizes the eqution On K-mp Drw Xs for don t cre combintions Include X in circle ONLY if minimizes eqution Don t include other Xs Digitl Design 2e Frnk Vhid F y z X X Good use of don t cres F y z unneeded X X Unnecessry use of don t cres; results in etr term y 6 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
Optimiztion Emple using Don t Cres Minimize: F = bc + bc + b c Given don t cres: bc, bc F bc c b X Note: Introduce don t cres with cution Must be sure tht we relly don t cre wht the function outputs for tht input combintion X F = c + b If we do cre, even the slightest, then it s probbly sfer to set the output to Digitl Design 2e Frnk Vhid 7 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
Optimiztion with Don t Cres Emple: Sliding Switch Switch with 5 positions 3-bit vlue gives position in binry Wnt circuit tht Outputs when switch is in position 2, 3, or 4 Outputs when switch is in position or 5 Note tht the 3-bit input cn never output binry, 6, or 7 Tret s don t cre input combintions Digitl Design 2e Frnk Vhid G Without don t cres: F = y + y z 2 3 4 5 G y z 2,3,4, detector X X X y z y y z F With don t cres: F = y + z 8 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
Automting Two-Level Logic Size Optimiztion Minimizing by hnd Is hrd for functions with 5 or more vribles My not yield minimum cover depending on order we choose Is error prone Minimiztion thus typiclly done by utomted tools Ect lgorithm: finds optiml solution Heuristic: finds good solution, but not necessrily optiml I () I (b) y z y 4 terms y Digitl Design 2e Frnk Vhid y z z y Only 3 terms 9 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
Bsic Concepts Underlying Automted Two-Level Digitl Design 2e Frnk Vhid Logic Size Optimiztion Definitions On-set: All minterms tht define when F= Off-set: All minterms tht define when F= Implicnt: Any product term (minterm or other) tht when cuses F= On K-mp, ny legl (but not necessrily lrgest) circle Cover: Implicnt y covers minterms nd Epnding term: removing vrible (like lrger K-mp circle) y is n epnsion of F y z 4 implicnts of F Note: We use K-mps here just for intuitive illustrtion of concepts; utomted tools do not use K-mps. ' y Prime implicnt: Mimlly epnded implicnt ny epnsion would cover s not in on-set y z, nd y, bove But not or they cn be epnded 2 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
Bsic Concepts Underlying Automted Two-Level Definitions (cont) Logic Size Optimiztion Essentil prime implicnt: The only prime implicnt tht covers prticulr minterm in function s on-set Importnce: We must include ll essentil PIs in function s cover In contrst, some, but not ll, nonessentil PIs will be included G y essentil z not essentil not essentil y z y essentil Digitl Design 2e Frnk Vhid 2 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
Automted Two-Level Logic Size Optimiztion Method Steps nd 2 re ect Step 3: Hrd. Checking ll possibilities: ect, but computtionlly epensive. Checking some but not ll: heuristic. Digitl Design 2e Frnk Vhid 22 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
Tbulr Method Step : Determine Prime Implicnts Methodiclly Compre All Implicnt Pirs, Try to Combine Emple function: F = 'y'z' + 'y'z + ' + y'z + ' + Minterms (3-literl implicnts) () 'y'z' () 'y'z (3) ' 'y'z'+' No 'y'z'+'y'z = 'y' 2-literl implicnts (,) 'y' (,5) y'z (,3) 'z (3,7) Actully, compring ALL pirs isn t necessry just pirs differing in uncomplemented literls by one. Minterms (3-literl implicnts) () 'y'z' () 'y'z (3) ' 2-literl implicnts (,) 'y' (,5) y'z (,3) 'z (3,7) -literl implicnts (,5,3,7) z (,3,5,7) z (5) y'z (5,7) z 2 (5) y'z (5,7) z (6) ' (6,7) y (6) ' (6,7) y (7) 3 (7) Prime implicnts: Digitl Design 2e Frnk Vhid Implicnt's number of uncomplemented literls 'y' y z 23 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
Tbulr Method Step 2: Add Essentil PIs to Cover Prime implicnts (from Step ): 'y', y, z Prime implicnts Prime implicnts Prime implicnts Minterms 'y' (,) y (6,7) z (,3,5,7) Minterms 'y' (,) y (6,7) z (,3,5,7) Minterms 'y' (,) y (6,7) z (,3,5,7) () 'y'z' () 'y'z' () 'y'z' () 'y'z () 'y'z () 'y'z (3) ' (3) ' (3) ' (5) y'z (5) y'z (5) y'z (6) ' (6) ' (6) ' (7) (7) (7) () (b) (c) Digitl Design 2e Frnk Vhid If only one X in row, then tht PI is essentil it's the only PI tht covers tht row's minterm. 24 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
Tbulr Method Step 3: Use Fewest Remining PIs to Cover Remining Minterms Essentil PIs (from Step 2): 'y', y, z Covered ll minterms, thus nothing to do in step 3 Finl minimized eqution: F = 'y' + y + z Minterms () 'y'z' () 'y'z (3) ' Prime implicnts 'y' (,) y (6,7) z (,3,5,7) (5) y'z (6) ' (7) (c) Digitl Design 2e Frnk Vhid 25 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
Problem with Methods tht Enumerte ll Minterms or Compute ll Prime Implicnts Too mny minterms for functions with mny vribles Function with 32 vribles: 2 32 = 4 billion possible minterms. Too much compute time/memory Too mny computtions to generte ll prime implicnts Compring every minterm with every other minterm, for 32 vribles, is (4 billion) 2 = qudrillion computtions Functions with mny vribles could requires dys, months, yers, or more of computtion unresonble Digitl Design 2e Frnk Vhid 26 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
Solution Solution to Computtion Problem Don t generte ll minterms or prime implicnts Insted, just tke input eqution, nd try to itertively improve it E: F = bcdefgh + bcdefgh + jklmnop Note: 5 vribles, my hve thousnds of minterms But cn minimize just by combining first two terms: F = bcdefg(h+h ) + jklmnop = bcdefg + jklmnop Digitl Design 2e Frnk Vhid 27 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
Two-Level Optimiztion using Itertive Method Method: Rndomly pply epnd opertions, see if helps Epnd: remove vrible from term Like epnding circle size on K-mp e.g., Epnding z to z legl, but epnding z to z not legl, in shown function After epnd, remove other terms covered by newly epnded term Keep trying (iterte) until doesn t help I () I (b) y z y z z z z ' Not legl E: F = bcdefgh + bcdefgh + jklmnop F = bcdefg + bcdefgh + jklmnop F = bcdefg + jklmnop Illustrted bove on K-mp, but itertive method is intended for n utomted solution (no K-mp) Digitl Design 2e Frnk Vhid Covered by newly epnded term bcdefg 28 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
E: Itertive Hueristic for Two-Level Logic Size Optimiztion F = + ' + 'y'z' + 'y'z (minterms in on-set) Rndom epnd: F = + ' + 'y'z + 'y'z Legl: Covers ' nd, both in on-set Any implicnt covered by y? Yes, '. F = y + ' + 'y'z' + 'y'z Rndom epnd: F = y + 'y'z' + 'y'z Not legl ( covers y'z', y'z, ', : two not in on-set) Rndom epnd: F = y + 'y'z' + 'y'z Legl X Implicnt covered by 'y': 'y'z X F = y + 'y'z' + 'y'z X X X Digitl Design 2e Frnk Vhid 29 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
Multi-Level Logic Optimiztion Performnce/Size Trdeoffs We don t lwys need the speed of two-level logic Multiple levels my yield fewer gtes Emple F = b + cd + ce F2 = b + c(d + e) = (b + c(d + e)) Generl technique: Fctor out literls y + z = (y+z) b c d c e 4 6 6 22 trnsistors 2 gte delys 6 F = b + cd + ce () F b c d e 4 4 6 trnsistors 4 gte-delys 4 F2 = (b+c(d+e)) (b) 4 size(trnsistors) F2 2 5 5 F (c) F2 2 3 4 dely (gte-delys) Digitl Design 2e Frnk Vhid 3 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
Multi-Level Emple Q: Use multiple levels to reduce number of trnsistors for F = bcd + bcef A: bcd + bcef = bc(d + ef) Hs fewer gte inputs, thus fewer trnsistors b c d b c e f 8 22 trnsistors 8 trnsistors 2 gte delys 3 gte delys 2 F b 6 c 4 F2 5 4 F = bcd + bcef () F d e f 4 4 F2 = bc(d + ef) (b) size (trnsistors) 5 (c) F2 2 3 4 dely (gte-delys) Digitl Design 2e Frnk Vhid 3 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
Multi-Level Emple: Non-Criticl Pth Criticl pth: longest dely pth to output Optimiztion: reduce size of logic on non-criticl pths by using multiple levels b c d e g f 4 6 6 26 trnsistors 3 gte-delys 4 F = (+b)c + dfg + efg () 6 F b c b f g 4 4 22 trnsistors 3 gte-delys 4 6 4 F2 = (+b)c + (d+e)fg (b) F2 Size (trnsistors) 25 2 5 5 (c) F F2 2 3 4 dely (gte-delys) Digitl Design 2e Frnk Vhid 32 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)
Automted Multi-Level Methods Min techniques use heuristic itertive methods Define vrious opertions Fctoring : bc + bd = b(c+d) Plus other trnsformtions similr to two-level itertive improvement Digitl Design 2e Frnk Vhid 33 You creted this PDF from n ppliction tht is not licensed to print to novpdf printer (http://www.novpdf.com)