CS137: Today Electronic Design Automation • Multilevel Synthesis/Optimization – Why – Transforms -- defined Day 5: October 7, 2005 – Division/extraction Multi-level Synthesis • How we support transforms – Boolean Division • Higher quality division – Speedup sketch 1 2 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Multi-level Why multi-level? • General circuit netlist • ab(c+d+e)(f+g) • May have – sums within products • abcf+abdf+abef+abcg+abdg+abeg – products within sum • 6 product terms – arbitrarily deep • vs. 3 gates: and4,or3,or2 • y=((a (b+c)+e)fg+h)i • Cannot share sub-expressions 3 4 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Why Multilevel Why Multilevel • a xor b • a xor b • Multi-level – a/b+/ab – x1=a/b+/ab – exploit common • a xor b xor c • a xor b xor c sub-expressions – a/bc+/abc+/a/b/c+ab/c – x2=x1/c+/x1*c – linear complexity • a xor b xor c xor d • a xor b xor c xor d • Two-level – a/bcd+/abcd+/a/b/cd+ab/cd+/ab/c/d+a/b/c/d+abc/d+/a/bc/d – x3=x2/d+x2*d – exponential complexity 5 6 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon 1
Goal Multi-level Transformations • Find the structure • Decomposition • Exploit to minimize gates • Extraction – Total (area) • Factoring – In path (delay) • Substitution • Collapsing • [copy these to board so stay up as we move forward] 7 8 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Decomposition Decomposition • F=abc+abd+/a/c/d+/b/c/d • F=abc+abd+/a/c/d+/b/c/d – 4 3-input + 1 4-input • F=XY+/X/Y • F=XY+/X/Y • X=ab • X=ab • Y=c+d • Y=c+d – 5 2-input gates • Note: use X and /X, use at multiple places 9 10 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Extraction Extraction • F=(a+b)cd+e • F=XY+e • F=(a+b)cd+e • F=XY+e • G=(a+b)/e • G=X/e • G=(a+b)/e • G=X/e • H=cde • H=Ye • H=cde • H=Ye • X=a+b • X=a+b • Y=cd • 2-input: 4 • Y=cd • 3-input: 2 • 2-input: 6 Common sub-expressions over multiple output 11 12 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon 2
Factoring Factoring • F=ac+ad+bc+bd+e • F=ac+ad+bc+bd+e – 4 2-input, 1 5-input – 9 literals • F=(a+b)(c+d)+e • F=(a+b)(c+d)+e – 4 2-input – 5 literals 13 14 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Substitution Collapsing • G=a+b • F=Ga+/Gb • F=a+bc • G=c+d • Substitute G into F • F=ac+ad+b/c/d • F=G(a+c) – (verify) F=(a+b)(a+c)=aa+ab+ac+bc=a+bc • opposite of substitution – sometimes want to collapse and refactor • useful if also have H=a+c? (F=GH) – especially for delay optimization 15 16 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Moves • These transforms define the “moves” we can make to modify our network. • Goal is to apply, usually repeatedly, to Division minimize gates – …then apply as necessary to accelerate design • MIS/SIS – Applies to canonical 2-input gates – Then covers with target gate library • (back to day2) 17 18 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon 3
Division Algebraic Division • Given : function (f) and divisor (p) • Use basic rules of algebra, rather than full boolean properties • Find : quotient and remainder • Computationally simple f=pq+r • Weaker than boolean division • f=a+bc p=(a+b) E.g. • Algebra: not divisible f=abc+abd+ef, p=ab • Boolean: q=(a+c), r=0 q=c+d, r=ef 19 20 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Algebraic Division Example Algebraic Division (stay on alg.; work ex on board) • f and p are expressions (lists of cubes) • f=abc+abd+de • p={a 1 ,a 2 ,…} • g=ab+e • h i ={c j | a i * c j ∈ f} • f/p = h 1 ∩ h 2 ∩ h 3 … 21 22 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Algebraic Division Example Algebraic Division Time • f=abc+abd+de, p=ab+e • O(|f||p|) as described – compare every cube pair • Sort cubes first • p={ab,e} • r=f- p *(f/g) – O((|f|+|p|)log(|f|+|p|) • h1={c,d} • r=abc+abd+de-(ab+e)d • r=abc • h2={d} • h1 ∩ h2={d} • f/g=d 23 24 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon 4
Primary Divisor Cube Free • f/c such that c is a cube • The only cube that divides p is 1 • f =abc+abde • f/a=bc+bde is a primary divisor • c+de is cube free • bc+bde is not cube free 25 26 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Must be to Kernel Extraction Generate Kernel Non-trivial kernel • Kernel1(j,g) – R=g • Kernels of f are • Find c f = largest – N max index in g cube factor of f – cube free primary divisors of f – for(i=j+1 to N) • K=Kernel1(0,f/c f ) – Informally: sums w/ cubes factored out • if (l i in 2 or more cubes) • if (f is cube-free) – c f =largest cube divide g/l i – return(f ∪ K) • f=abc+abde – if (forall k ≤ i, l k ∉ c f ) • else • f/ab = c+de is a kernel » R=R ∪ KERNEL1(i,g/(l i ∩ c f )) – return(K) • ab is cokernel of f to (c+de) – return(R) – cokernels always cubes Consider each literal for cofactor once 27 28 (largest kernels will already have been found) CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Kernel Extract Example Factoring (stay on prev. slide, ex. on board) • Recurse � e+d • f=abcd+abce+abef • Gfactor(f) • c f =ab • R={cd+ce+ef,e+d} if (terms==1) return(f) • f/c f =cd+ce+ef • only 1 d p=CHOOSE_DIVISOR(f) • R={cd+ce+ef} • (d+ce+ef)/e=c+f (h,r)=DIVIDE(f,p) • Recurse � c+f • N=6 f=Gfactor(h)*Gfactor(p)+Gfactor(r) • a,b not present • R={cd+ce+ef,e+d,c+f} return(f) // factored • (cd+ce+ef)/c=e+d • largest cube 1 29 30 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon 5
Factoring Extraction • Identify cube-free expressions in many • Trick is picking divisor functions (common sub expressions) – pick from kernels • Generate kernels for each function – goal minimize literals after resubstitution • select pair such that k1 ∩ k2 is not a cube • Re-express design using new intermediate • new variable from intersection variables – v= k1 ∩ k2 • Variable and complement • update functions (resubstitute) – f i = v*(f i /v)+ r i – (similar for common cubes) 31 32 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Extraction Example Extraction Example • X=ab(c(d+e)+f+g)+g • X=ab(c(d+e)+f+g)+g • Y=ai(c(d+e)+f+j)+k • Y=ai(c(d+e)+f+j)+k • d+e kernel of both • L=d+e • X=ab(cL+f+g)+h • Y=ai(cL+f+j)+k 33 34 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Extraction Example Extraction Example • L=d+e • L=d+e • N=aM • M=cL+f • M=cL+f • X=ab(cL+f+g)+h • X=ab(M+g)+h • L=d+e • Y=ai(cL+f+j)+k • Y=ai(M+j)+h • X=b(N+ag)+h • kernels:(cL+f+g), (cL+f+j) • no kernels • Y=I(N+aj)+k • extract: M=cL+f • common cube: aM • X=ab(M+g)+h • Y=ai(M+f)+h 35 36 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon 6
Extraction Example Resubstitution • Also useful to try complement on new factors • N=aM • Can collapse • f=ab+ac+/b/cd – L into M into N • M=cL+f – Only used once • X=b+c • L=d+e • Get larger common • f=aX+/b/cd • X=b(N+ag)+h kernel N • /X=/b/c • Y=I(N+aj)+k – maybe useful if • f=aX+/Xd components • …extracting complements not a direct target becoming too small for efficient gate implementation 37 38 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Good Divisors? • Key to CHOOSE_DIVISOR in GFACTOR Boolean Division • Variations to improve – e.g. rectangle covering (Devadas 7.4) 39 40 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Don’t Care Don’t Care Example • Mentioned last time • e=/a/b • Structure of logic restricts values • g=/c/d intermediates can take on • f=/e/g • e=0, a=0, b=0 cannot occur • DC: e(a+b)+/e/a/b 41 42 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon 7
Satisfiability DC Observability DC • In general: • If output F not differentiated by input y, � z=F(x,y) – then don’t care value of y � z/F(x,y) + /zF(x,y) is don’t care – i.e. input conditions where (F y =F /y ) • ODC = Π (F y =F /y ) – (product over all outputs) 43 44 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Don’t Care Optimization Boolean Division • f//p assuming sup(p) ⊆ sup(f) • Select a node in Boolean network • add input P to f (for p) • Compute ODC for all outputs wrt node • new function F = f//p • Compute SDC in terms of local inputs – DC-set D=P/p+/Pp • Minimize wrt ODC ∪ SDC – ON-set f ∩ /D – OFF-set /(f ∪ D) • minimize F for minimum literals in sum- of-products (last time) 45 46 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon Boolean Division (check) Boolean Division Example • F ON-set f ∩ /D • f=abc+a/b/c+/ab/c+/a/bc • D=P/p+/Pp • p=ab+/a/b • /D = Pp+/P/p • F-DC=ab/P+/a/b/P+/abP+a/bP • F = f ∩ /D = F(Pp+/P/p) • F-On=abcP+/a/bcP+/ab/cP+a/b/c/P • f = F(Pp+/P/p)p = Fp • After minimization get: � F=cP+/c/P – Goal since want F=f//p � P=ab+/a/b 47 48 CALTECH CS137 Fall2005 -- DeHon CALTECH CS137 Fall2005 -- DeHon 8
Recommend
More recommend