Metodologie di progetto HW Tehnology Mpping Lst updte: 19/03/09
Tehnology Mpping 2
Tehnology Mpping Exmple: t 1 = + b; t 2 = d + e; t 3 = b + d; t 4 = t 1 t 2 + fg; t 5 = t 4 h + t 2 t 3 ; F = t 5 ; t 1 t 2 + fg t 5 t 4 h + t 2 t 3 F +b d+e b+d This shows n unoptimized set of logi equtions onsisting of 16 literls 3
Optimized Equtions Using tehnology independent optimiztion, these equtions re optimized using only 14 literls: t 1 = d + e; t 2 = b + h; t 3 = t 2 + ; t 4 = t 1 t 3 + fgh; F = t 4 ; t 5 F t 1 t 3 + fgh t 4 F t 1 t 2 + fg t 4 h + t 2 t 3 t 2 + +b d+e b+d d+e b+h 4
Optimized Equtions Implement this network using set of gtes whih form librry. Eh gte hs ost (i.e. its re, dely, et.) 5
Tehnology Mpping Two pprohes: Rule-Bsed [LSS] Sme struture s rule bsed tehniques for tehnology independent optimiztion Useful for lol optimiztions Lrge exeution times Algoritmi [DAGON, MISII] Represent eh funtion of network using set of bse funtions. This representtion is lled the subjet grph. Typilly the bse is 2-input NANDs nd inverters (Best hoie) The set should be funtionlly omplete. Eh gte of the librry is likewise represented using the bse set. This genertes pttern grphs Represent eh gte in ll possible wys 6
Subjet Grph F F t 4 f Subjet grph of 2-input NANDs nd Invertors (NAND/INV) t 1 t 3 + fgh d+e t 2 + b+h d e b h g h 7
Algorithmi Approh A over is olletion of pttern grphs suh tht every node of the subjet grph is ontined in one (or more) pttern grphs eh input required by pttern grph is tully n output of some other grph (i.e. the inputs of one gte must exists s outputs of other gtes.) For minimum re, the ost of the over is the sum of the res of the gtes in the over. Tehnology mpping problem: Find minimum ost overing of the subjet grph by hoosing from the olletion of pttern grphs for ll the gtes in the librry. 8
Subjet Grph f g t 1 = d + e; t 2 = b + h; t 3 = t 2 + ; t 4 = t 1 t 3 + fgh; F = t 4 ; d e h b F 9
Pttern Grphs for the IWLS Librry inv(1) nnd2(2) nnd3 (3) nor(2) nor3 (3) oi21 (3) oi22 (4) xor (5) 10
Subjet grph overing f t 1 = d + e; t 2 = b + h; t 3 = t 2 + ; t 4 = t 1 t 3 + fgh; F = t 4 ; Totl ost = 23 g d e h b F 11
Better Covering nd2(3) f t 1 = d + e; t 2 = b + h; t 3 = t 2 + ; g d e or2(3) oi22(4) F t 4 = t 1 t 3 + fgh; F = t 4 ; h or2(3) b nnd2(2) Totl re = 19 nnd2(2) inv(1) 12
Alternte Covering f nnd3(3) t 1 = d + e; t 2 = b + h; g d e oi21(3) nd2(3) F t 3 = t 2 + ; t 4 = t 1 t 3 + fgh; h F = t 4 ; b oi21 (3) Totl re = 15 nnd2(2) inv(1) 13
Teh. mpping using DAG overing Input: Output: Tehnology independent, optimized logi network Desription of the gtes in the librry with their ost Netlist of gtes (from librry) whih minimizes totl ost Generl Approh: Construt subjet DAG for the network Represent eh gte in the trget librry by pttern DAG s Find n optiml-ost overing of subjet DAG using the olletion of pttern DAG s 14
DAG overing s binte overing problem Compute ll possible mthes {m k } (ellipses in fig.) for eh node Using vrible m i for eh mth of pttern grph in the subjet grph, (m i =1 if mth is hosen) Write luse for eh node of the subjet grph inditing whih mthes over this node. Eh node hs to be overed. e.g., if subjet node is overed by mthes {m 2, m 5, m 10 }, then the luse would be (m 2 + m 5 + m 10 ). m 1 m 2... m k Repet for eh subjet node nd tke the produt over ll subjet nodes. (CNF) n 1 n nodes 2... n l 15
DAG overing s binte overing problem Any stisfying ssignment gurntees tht ll subjet nodes re overed, but does not gurntee tht other mthes hosen rete outputs needed s inputs needed for given mth. not n output of hosen mth Retify this by dding dditionl luses. 16
DAG overing s binte overing problem Let mth m i hve subjet nodes s i1,,s in s n inputs. If m i is hosen, one of the mthes tht relizes s ij must lso be hosen for eh input j ( j not primry input). Let S ij be the disjuntive expression in the vribles m k giving the possible mthes whih relize s ij s n output node. Seleting mth m i implies stisfying eh of the expressions S ij for j = 1 n. This n be written (m i (S i1 S in ) ) (m i + (S i1 S in ) ) ((m i + S i1 ) (m i + S in ) ) 17
DAG overing s binte overing problem Also, one of the mthes for eh primry output of the iruit must be seleted. An ssignment of vlues to vribles m i tht stisfies the bove overing expression is legl grph over For re optimiztion, eh mth m i hs ost i tht is the re of the gte the mth represents. The gol is stisfying ssignment with the lest totl ost. Find lest-ost prime: if vrible m i = 0 its ost is 0, else its ost in i m i = 0 mens tht mth i is not hosen 18
Binte Covering This problem is more generl thn unte-overing for two-level minimiztion beuse vribles re present in the overing expression in both their true nd omplemented forms. The overing expression is binte logi funtion, nd the problem is referred to s the binte-overing problem. 19
Binte Covering: Exmple 1 3 5 o 1 2 b d 4 6 7 8 9 o 2 Gte Cost Inputs Produes Covers m1 inv 1 b g1 g1 m2 inv 1 g2 g2 m3 nnd2 2 g1, g2 g3 g3 m4 nnd2 2, b g4 g4 m5 nnd2 2 g3, g4 g5 g5 m6 inv 1 g4 g6 g6 m7 nnd2 2 g6, g7 g7 m8 inv 1 g7 g8 g8 m9 nnd2 2 g8, d g9 g9 m10 nnd3 3 g6,, d g9 g7, g 8, g 9 m11 nnd3 3, b, g7 g4, g 6, g 7 m12 xnor2 5, b g5 g1, g 2, g 3, g 4, g 5 m13 nnd4 4, b,, d g9 g4, g 6, g 7, g 8, g 9 m14 oi21 3, b, g4 g5 g1, g 2, g 3, g 5 20
Binte Covering: Exmple Generte onstrints tht eh node g i be overed by some mth. (m 1 + m 12 + m 14 ) (m 2 + m 12 + m 14 ) (m 3 + m 12 + m 14 ) (m 4 + m 11 + m 12 + m 13 ) (m 5 + m 12 + m 13 ) (m 6 + m 11 + m 13 ) (m 7 + m 10 + m 11 + m 13 ) (m 8 + m 10 + m 13 ) (m 9 + m 10 + m 13 ) To ensure tht over leds to vlid iruit, extr luses re generted. For exmple, seleting m 3 requires tht mth be hosen whih produes g 2 s n output, nd mth be hosen whih produes g 1 s n output. The only mth whih produes g 1 is m 1, nd the only mth whih produes g 2 is m 2 21
Binte Covering: Exmple The primry output nodes g 5 nd g 9 must be relized s n output of some mth. The mthes whih relize g 5 s n output re m 5, m 12, m 14 ; The mthes whih relize g 9 s n output re m 9, m 10, m 13 Note: A mth whih requires primry input s n input is stisfied trivilly. Mthes m 1,m 2,m 4,m 11,m 12,m 13 re driven only by primry inputs nd do not require dditionl luses 22
Binte Covering: Exmple Finlly, we get (m 3 + m 1 ) (m 3 + m 2 ) (m 3 +m 5 ) (m 5 + m 4 ) (m 6 + m 4 ) (m 7 + m 6 ) (m 8 + m 7 + m 11 ) (m 8 +m 9 ) (m 10 + m 6 ) (m 14 + m 4 ) (m 5 + m 12 + m 14 ) (m 9 + m 10 + m 13 ) The overing expression hs 58 implints The lest ost prime implint is m 3 m 5 m 6 m 7 m 8 m 9 m 10 m 12 m 13 m 14 This uses two gtes for ost of nine gte units. This orresponds to over whih selets mthes m 12 (xor2) nd m 13 (nnd4). 23
Gte Cost Inputs Produes Covers m1 inv 1 b g1 g1 m2 inv 1 g2 g2 m3 nnd2 2 g1, g2 g3 g3 m4 nnd2 2, b g4 g4 m5 nnd2 2 g3, g4 g5 g5 m6 inv 1 g4 g6 g6 m7 nnd2 2 g6, g7 g7 m8 inv 1 g7 g8 g8 m9 nnd2 2 g8, d g9 g9 m10 nnd3 3 g6,, d g9 g7, g8, g9 m11 nnd3 3, b, g7 g4, g6, g7 m12 xnor2 5, b g5 g1, g2, g3, g4, g5 m13 nnd4 4, b,, d g9 g4, g6, g7, g8, g9 m14 oi21 3, b, g4 g5 g1, g2, g3, g5 m 3 m 5 m 6 m 7 m 8 m 9 m 10 m 12 m 13 m 14 1 2 3 5 o 1 Note tht the node g 4 is overed by both mthes b d 4 6 7 8 9 o 2 24
Complexity of DAG overing More generl thn unte overing Finding lest ost prime of binte funtion. Even finding fesible solution is NP-omplete (SAT). For unte overing, finding fesible solution is esy. DAG-overing: overing + implition onstrints Given subjet grph, the binte overing provides the ext solution to the tehnology-mpping problem. However, better results my be obtined with different initil deomposition into 2-input NANDS nd inverters Methods to solve the binte overing formultion: Brnh nd bound [Thelen] BDD-bsed [Lin nd Somenzi] Even for moderte-size networks, these re expensive. 25
Optiml Tree Covering by Trees If the subjet DAG nd primitive DAG s re trees, then n effiient lgorithm to find the best over exists Bsed on dynmi progrmming First proposed for optiml ode genertion in ompiler (KEUTZER) 26
Optiml Tree Covering by Trees Prtition subjet grph into forest of trees Cover eh tree optimlly using dynmi progrmming Given: Subjet trees (networks to be mpped) Forest of ptterns (gte librry) Consider node N of subjet tree Reursive Assumption: for ll hildren of N, best ost mth (whih implements the node) is known Cost of lef of the tree is 0. Compute ost of eh pttern tree whih mthes t N, Cost = SUM of best osts of implementing eh input of pttern plus the ost of the pttern Choose lest ost mthing pttern for implementing N 27
Optimum Are Algorithm Algorithm OPTIMAL_AREA_COVER(node) { foreh input of node { OPTIMAL_AREA_COVER(input);// stisfies reurs. ssumption } // Using these, find the best over t node nodere = INFINITY; nodemth = 0; foreh mth t node { re = mthre; foreh pin of mth { re = re + pinre; } if (re < nodere) { nodere = re; nodemth = mth; } } } 28
Tree Covering in Ation 0 0 0 0 NAND2 NAND2 NAND2 AOI22 3xNAND2 AOI22 + NAND2 + INV AOI22 + NAND2 + 2INV NAND2 NAND3 0 INV 0 0 0 NAND3 QUICKLY FINAL COST: 2xNAND3 + AOI22 + INV 29
Complexity of Tree Covering Complexity is ontrolled by finding ll sub-trees of the subjet grph whih re isomorphi to pttern tree. Liner omplexity in both size of subjet tree nd size of olletion of pttern trees 30
Prtitioning the Subjet DAG into Trees Trivil prtition: brek the grph t ll multiple-fnout points leds to no duplition or overlp of ptterns drwbk - sometimes results in mny of smll trees Leds to 3 trees 31
DAG-to-Tree Deomposition Forest of Trees 32
Prtitioning the subjet DAG into trees Single-one prtition: from single output, form lrge tree bk to the primry inputs; mp suessive outputs until they hit mth output formed from mpping previous primry outputs. Duplites some logi (where trees overlp) Produes muh lrger trees, potentilly better re results output output 33
Min-Dely Covering For trees: identil to min-re overing use optiml dely vlues within the dynmi progrmming prdigm For DAGs: if dely does not depend on number of fnouts: use dynmi progrmming s presented for trees leds to optiml solution in polynomil time Combined objetive e.g. pply dely s first riteri, then re s seond ombine with stti timing nlysis to fous on ritil pths 34
Combined Deomposition nd Tehnology Mpping Common Approh: Phse 1: Tehnology independent optimiztion ommit to prtiulr Booln network lgebri deomposition used Phse 2: AND2/INV deomposition ommit to prtiulr deomposition of generl Boolen network using 2-input ANDs nd inverters Phse 3: Tehnology mpping (tree-mpping) 35
Combined Deomposition nd Tehnology Mpping Lehmn Wtnbe Algorithm: Key Ide: Effiiently enode set of AND2/INV deompositions into single struture lled mpping grph Apply modified tree-bsed tehnology mpper while dynmilly performing lgebri logi deomposition on the mpping grph 36
A set of AND2/INV Deompositions f = b n be represented in vrious wys b f b b f f b f 37
Combine them using hoie node b A set of AND2/INV Deompositions b b b 38
A set of AND2/INV Deompositions b b b f These deompositions n be represented more omptly s: b 39
Mpping Grph A Boolen network ontining 4 modifitions: Choie node: hoies on different deompositions Cyli: funtions written in terms of eh other, e.g. inverter hin with n rbitrry length Redued: No two hoie nodes with sme funtion. No two AND2s with sme fnin. (like BDD node shring) Ugtes: just for effiient implementtion - do not expliitly represent hoie nodes nd inverters b b b b ugtes b 40
Tree-mpping on Mpping Grph Grph-Mpping on Trees: Apply dynmi progrmming from primry inputs: find mthes t eh AND2 nd INV, nd retin the ost of best over t eh node mth my ontin hoie nodes the ost t hoie node is the minimum of fnin osts fixed-point itertion on eh yle, until osts of ll the nodes in the yle beome stble Run-time is typilly liner in the size of the mpping grph b b b b AND3 b 41
Exmple: Tree-mpping Dely: best hoie if is lter thn nd b. subjet grph librry pttern grph 42
THE END 43