ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
sclSize.h
Go to the documentation of this file.
1
20
21#ifndef ABC__map__scl__sclSize_h
22#define ABC__map__scl__sclSize_h
23
24
28
29#include "base/abc/abc.h"
30#include "misc/vec/vecQue.h"
31#include "misc/vec/vecWec.h"
32#include "sclLib.h"
33
35
39
43
44typedef struct SC_Man_ SC_Man;
45struct SC_Man_
46{
47 SC_Lib * pLib; // library
48 Abc_Ntk_t * pNtk; // network
49 int nObjs; // allocated size
50 // get assignment
51 Vec_Int_t * vGatesBest; // best gate sizes found so far
52 Vec_Int_t * vUpdates; // sizing updates in this round
53 Vec_Int_t * vUpdates2; // sizing updates in this round
54 // timing information
55 SC_WireLoad * pWLoadUsed; // name of the used WireLoad model
56 Vec_Flt_t * vWireCaps; // wire capacitances
57 SC_Pair * pLoads; // loads for each gate
58 SC_Pair * pDepts; // departures for each gate
59 SC_Pair * pTimes; // arrivals for each gate
60 SC_Pair * pSlews; // slews for each gate
61 Vec_Flt_t * vInDrive; // maximum input drive strength
62 Vec_Flt_t * vTimesOut; // output arrival times
63 Vec_Que_t * vQue; // outputs by their time
64 SC_Cell * pPiDrive; // cell driving primary inputs
65 // backup information
66 Vec_Flt_t * vLoads2; // backup storage for loads
67 Vec_Flt_t * vLoads3; // backup storage for loads
68 Vec_Flt_t * vTimes2; // backup storage for times
69 Vec_Flt_t * vTimes3; // backup storage for slews
70 // buffer trees
71 float EstLoadMax; // max ratio of Cout/Cin when this kicks in
72 float EstLoadAve; // average load of the gate
73 float EstLinear; // linear coefficient
74 int nEstNodes; // the number of estimations
75 // intermediate data
76 Vec_Que_t * vNodeByGain; // nodes by gain
77 Vec_Flt_t * vNode2Gain; // mapping node into its gain
78 Vec_Int_t * vNode2Gate; // mapping node into its best gate
79 Vec_Int_t * vNodeIter; // the last iteration the node was upsized
80 Vec_Int_t * vBestFans; // best fanouts
81 // incremental timing update
85 // optimization parameters
86 float SumArea; // total area
87 float MaxDelay; // max delay
88 float SumArea0; // total area at the begining
89 float MaxDelay0; // max delay at the begining
90 float BestDelay; // best delay in the middle
91 float ReportDelay; // delay to report
92 // runtime statistics
93 abctime timeTotal; // starting/total time
94 abctime timeCone; // critical path selection
95 abctime timeSize; // incremental sizing
96 abctime timeTime; // timing update
97 abctime timeOther; // everything else
98 float (*pFuncFanin)(void * p, Abc_Obj_t * pObj, Abc_Obj_t * pFanin, int iFanin, int fRise); // called to get info about the node's fanin
99};
100
104
108
109static inline SC_Lib * Abc_SclObjLib( Abc_Obj_t * p ) { return (SC_Lib *)p->pNtk->pSCLib; }
110static inline int Abc_SclObjCellId( Abc_Obj_t * p ) { return Vec_IntEntry( p->pNtk->vGates, Abc_ObjId(p) ); }
111static inline SC_Cell * Abc_SclObjCell( Abc_Obj_t * p ) { int c = Abc_SclObjCellId(p); return c == -1 ? NULL:SC_LibCell(Abc_SclObjLib(p), c); }
112static inline void Abc_SclObjSetCell( Abc_Obj_t * p, SC_Cell * pCell ) { Vec_IntWriteEntry( p->pNtk->vGates, Abc_ObjId(p), pCell->Id ); }
113
114static inline SC_Pair * Abc_SclObjLoad( SC_Man * p, Abc_Obj_t * pObj ) { return p->pLoads + Abc_ObjId(pObj); }
115static inline SC_Pair * Abc_SclObjDept( SC_Man * p, Abc_Obj_t * pObj ) { return p->pDepts + Abc_ObjId(pObj); }
116static inline SC_Pair * Abc_SclObjTime( SC_Man * p, Abc_Obj_t * pObj ) { return p->pTimes + Abc_ObjId(pObj); }
117static inline SC_Pair * Abc_SclObjSlew( SC_Man * p, Abc_Obj_t * pObj ) { return p->pSlews + Abc_ObjId(pObj); }
118
119static inline double Abc_SclObjLoadMax( SC_Man * p, Abc_Obj_t * pObj ) { return Abc_MaxFloat(Abc_SclObjLoad(p, pObj)->rise, Abc_SclObjLoad(p, pObj)->fall); }
120static inline float Abc_SclObjLoadAve( SC_Man * p, Abc_Obj_t * pObj ) { return 0.5 * Abc_SclObjLoad(p, pObj)->rise + 0.5 * Abc_SclObjLoad(p, pObj)->fall; }
121static inline double Abc_SclObjTimeOne( SC_Man * p, Abc_Obj_t * pObj, int fRise ){ return fRise ? Abc_SclObjTime(p, pObj)->rise : Abc_SclObjTime(p, pObj)->fall; }
122static inline float Abc_SclObjTimeMax( SC_Man * p, Abc_Obj_t * pObj ) { return Abc_MaxFloat(Abc_SclObjTime(p, pObj)->rise, Abc_SclObjTime(p, pObj)->fall); }
123static inline double Abc_SclObjSlewMax( SC_Man * p, Abc_Obj_t * pObj ) { return Abc_MaxFloat(Abc_SclObjSlew(p, pObj)->rise, Abc_SclObjSlew(p, pObj)->fall); }
124static inline float Abc_SclObjGetSlackR( SC_Man * p, Abc_Obj_t * pObj, float D ){ return D - (Abc_SclObjTime(p, pObj)->rise + Abc_SclObjDept(p, pObj)->rise); }
125static inline float Abc_SclObjGetSlackF( SC_Man * p, Abc_Obj_t * pObj, float D ){ return D - (Abc_SclObjTime(p, pObj)->fall + Abc_SclObjDept(p, pObj)->fall); }
126static inline float Abc_SclObjGetSlack( SC_Man * p, Abc_Obj_t * pObj, float D ) { return D - Abc_MaxFloat(Abc_SclObjTime(p, pObj)->rise + Abc_SclObjDept(p, pObj)->rise, Abc_SclObjTime(p, pObj)->fall + Abc_SclObjDept(p, pObj)->fall); }
127static inline double Abc_SclObjSlackMax( SC_Man * p, Abc_Obj_t * pObj, float D ) { return Abc_SclObjGetSlack(p, pObj, D); }
128static inline void Abc_SclObjDupFanin( SC_Man * p, Abc_Obj_t * pObj ) { assert( Abc_ObjIsCo(pObj) ); *Abc_SclObjTime(p, pObj) = *Abc_SclObjTime(p, Abc_ObjFanin0(pObj)); }
129static inline float Abc_SclObjInDrive( SC_Man * p, Abc_Obj_t * pObj ) { return Vec_FltEntry( p->vInDrive, pObj->iData ); }
130static inline void Abc_SclObjSetInDrive( SC_Man * p, Abc_Obj_t * pObj, float c){ Vec_FltWriteEntry( p->vInDrive, pObj->iData, c ); }
131static inline void Abc_SclManSetFaninCallBack( SC_Man * p, void * pCallBack ) { p->pFuncFanin = (float (*)(void *, Abc_Obj_t *, Abc_Obj_t *, int, int))pCallBack; }
132
136
148static inline SC_Man * Abc_SclManAlloc( SC_Lib * pLib, Abc_Ntk_t * pNtk )
149{
150 SC_Man * p;
151 Abc_Obj_t * pObj;
152 int i;
153 assert( pLib->unit_time == 12 );
154 assert( pLib->unit_cap_snd == 15 );
155 assert( Abc_NtkHasMapping(pNtk) );
156 p = ABC_CALLOC( SC_Man, 1 );
157 p->pLib = pLib;
158 p->pNtk = pNtk;
159 p->nObjs = Abc_NtkObjNumMax(pNtk);
160 p->pLoads = ABC_CALLOC( SC_Pair, p->nObjs );
161 p->pDepts = ABC_CALLOC( SC_Pair, p->nObjs );
162 p->pTimes = ABC_CALLOC( SC_Pair, p->nObjs );
163 p->pSlews = ABC_CALLOC( SC_Pair, p->nObjs );
164 p->vBestFans = Vec_IntStart( p->nObjs );
165 p->vTimesOut = Vec_FltStart( Abc_NtkCoNum(pNtk) );
166 p->vQue = Vec_QueAlloc( Abc_NtkCoNum(pNtk) );
167 Vec_QueSetPriority( p->vQue, Vec_FltArrayP(p->vTimesOut) );
168 for ( i = 0; i < Abc_NtkCoNum(pNtk); i++ )
169 Vec_QuePush( p->vQue, i );
170 p->vUpdates = Vec_IntAlloc( 1000 );
171 p->vUpdates2 = Vec_IntAlloc( 1000 );
172 p->vLoads2 = Vec_FltAlloc( 1000 );
173 p->vLoads3 = Vec_FltAlloc( 1000 );
174 p->vTimes2 = Vec_FltAlloc( 1000 );
175 p->vTimes3 = Vec_FltAlloc( 1000 );
176 // intermediate data
177 p->vNode2Gain = Vec_FltStart( p->nObjs );
178 p->vNode2Gate = Vec_IntStart( p->nObjs );
179 p->vNodeByGain = Vec_QueAlloc( p->nObjs );
180 Vec_QueSetPriority( p->vNodeByGain, Vec_FltArrayP(p->vNode2Gain) );
181 p->vNodeIter = Vec_IntStartFull( p->nObjs );
182 p->vLevels = Vec_WecStart( 2 * Abc_NtkLevel(pNtk) + 1 );
183 p->vChanged = Vec_IntAlloc( 100 );
184 Abc_NtkForEachCo( pNtk, pObj, i )
185 pObj->Level = Abc_ObjFanin0(pObj)->Level + 1;
186 // set CI/CO ids
187 Abc_NtkForEachCi( pNtk, pObj, i )
188 pObj->iData = i;
189 Abc_NtkForEachCo( pNtk, pObj, i )
190 pObj->iData = i;
191 return p;
192}
193static inline void Abc_SclManFree( SC_Man * p )
194{
195 Abc_Obj_t * pObj;
196 int i;
197 // set CI/CO ids
198 Abc_NtkForEachCi( p->pNtk, pObj, i )
199 pObj->iData = 0;
200 Abc_NtkForEachCo( p->pNtk, pObj, i )
201 pObj->iData = 0;
202 // other
203 p->pNtk->pSCLib = NULL;
204 Vec_IntFreeP( &p->pNtk->vGates );
205 Vec_IntFreeP( &p->vNodeIter );
206 Vec_QueFreeP( &p->vNodeByGain );
207 Vec_FltFreeP( &p->vNode2Gain );
208 Vec_IntFreeP( &p->vNode2Gate );
209 // intermediate data
210 Vec_FltFreeP( &p->vLoads2 );
211 Vec_FltFreeP( &p->vLoads3 );
212 Vec_FltFreeP( &p->vTimes2 );
213 Vec_FltFreeP( &p->vTimes3 );
214 Vec_IntFreeP( &p->vUpdates );
215 Vec_IntFreeP( &p->vUpdates2 );
216 Vec_IntFreeP( &p->vGatesBest );
217 Vec_WecFreeP( &p->vLevels );
218 Vec_IntFreeP( &p->vChanged );
219// Vec_QuePrint( p->vQue );
220 Vec_QueCheck( p->vQue );
221 Vec_QueFreeP( &p->vQue );
222 Vec_FltFreeP( &p->vTimesOut );
223 Vec_IntFreeP( &p->vBestFans );
224 Vec_FltFreeP( &p->vInDrive );
225 Vec_FltFreeP( &p->vWireCaps );
226 ABC_FREE( p->pLoads );
227 ABC_FREE( p->pDepts );
228 ABC_FREE( p->pTimes );
229 ABC_FREE( p->pSlews );
230 ABC_FREE( p );
231}
232/*
233static inline void Abc_SclManCleanTime( SC_Man * p )
234{
235 Vec_Flt_t * vSlews;
236 Abc_Obj_t * pObj;
237 int i;
238 vSlews = Vec_FltAlloc( 2 * Abc_NtkPiNum(p->pNtk) );
239 Abc_NtkForEachPi( p->pNtk, pObj, i )
240 {
241 SC_Pair * pSlew = Abc_SclObjSlew( p, pObj );
242 Vec_FltPush( vSlews, pSlew->rise );
243 Vec_FltPush( vSlews, pSlew->fall );
244 }
245 memset( p->pDepts, 0, sizeof(SC_Pair) * p->nObjs );
246 memset( p->pTimes, 0, sizeof(SC_Pair) * p->nObjs );
247 memset( p->pSlews, 0, sizeof(SC_Pair) * p->nObjs );
248 Abc_NtkForEachPi( p->pNtk, pObj, i )
249 {
250 SC_Pair * pSlew = Abc_SclObjSlew( p, pObj );
251 pSlew->rise = Vec_FltEntry( vSlews, 2 * i + 0 );
252 pSlew->fall = Vec_FltEntry( vSlews, 2 * i + 1 );
253 }
254 Vec_FltFree( vSlews );
255}
256*/
257static inline void Abc_SclManCleanTime( SC_Man * p )
258{
259 memset( p->pTimes, 0, sizeof(SC_Pair) * p->nObjs );
260 memset( p->pSlews, 0, sizeof(SC_Pair) * p->nObjs );
261 memset( p->pDepts, 0, sizeof(SC_Pair) * p->nObjs );
262/*
263 if ( p->pPiDrive != NULL )
264 {
265 SC_Pair * pSlew, * pTime, * pLoad;
266 Abc_Obj_t * pObj;
267 int i;
268 Abc_NtkForEachPi( p->pNtk, pObj, i )
269 {
270 pLoad = Abc_SclObjLoad( p, pObj );
271 pTime = Abc_SclObjTime( p, pObj );
272 pSlew = Abc_SclObjSlew( p, pObj );
273 Scl_LibHandleInputDriver( p->pPiDrive, pLoad, pTime, pSlew );
274 }
275 }
276*/
277}
278
279
291static inline void Abc_SclLoadStore( SC_Man * p, Abc_Obj_t * pObj )
292{
293 Abc_Obj_t * pFanin;
294 int i;
295 Vec_FltClear( p->vLoads2 );
296 Abc_ObjForEachFanin( pObj, pFanin, i )
297 {
298 Vec_FltPush( p->vLoads2, Abc_SclObjLoad(p, pFanin)->rise );
299 Vec_FltPush( p->vLoads2, Abc_SclObjLoad(p, pFanin)->fall );
300 }
301}
302static inline void Abc_SclLoadRestore( SC_Man * p, Abc_Obj_t * pObj )
303{
304 Abc_Obj_t * pFanin;
305 int i, k = 0;
306 Abc_ObjForEachFanin( pObj, pFanin, i )
307 {
308 Abc_SclObjLoad(p, pFanin)->rise = Vec_FltEntry(p->vLoads2, k++);
309 Abc_SclObjLoad(p, pFanin)->fall = Vec_FltEntry(p->vLoads2, k++);
310 }
311 assert( Vec_FltSize(p->vLoads2) == k );
312}
313
314static inline void Abc_SclLoadStore3( SC_Man * p, Abc_Obj_t * pObj )
315{
316 Abc_Obj_t * pFanin;
317 int i;
318 Vec_FltClear( p->vLoads3 );
319 Vec_FltPush( p->vLoads3, Abc_SclObjLoad(p, pObj)->rise );
320 Vec_FltPush( p->vLoads3, Abc_SclObjLoad(p, pObj)->fall );
321 Abc_ObjForEachFanin( pObj, pFanin, i )
322 {
323 Vec_FltPush( p->vLoads3, Abc_SclObjLoad(p, pFanin)->rise );
324 Vec_FltPush( p->vLoads3, Abc_SclObjLoad(p, pFanin)->fall );
325 }
326}
327static inline void Abc_SclLoadRestore3( SC_Man * p, Abc_Obj_t * pObj )
328{
329 Abc_Obj_t * pFanin;
330 int i, k = 0;
331 Abc_SclObjLoad(p, pObj)->rise = Vec_FltEntry(p->vLoads3, k++);
332 Abc_SclObjLoad(p, pObj)->fall = Vec_FltEntry(p->vLoads3, k++);
333 Abc_ObjForEachFanin( pObj, pFanin, i )
334 {
335 Abc_SclObjLoad(p, pFanin)->rise = Vec_FltEntry(p->vLoads3, k++);
336 Abc_SclObjLoad(p, pFanin)->fall = Vec_FltEntry(p->vLoads3, k++);
337 }
338 assert( Vec_FltSize(p->vLoads3) == k );
339}
340static inline void Abc_SclConeStore( SC_Man * p, Vec_Int_t * vCone )
341{
342 Abc_Obj_t * pObj;
343 int i;
344 Vec_FltClear( p->vTimes2 );
345 Abc_NtkForEachObjVec( vCone, p->pNtk, pObj, i )
346 {
347 Vec_FltPush( p->vTimes2, Abc_SclObjTime(p, pObj)->rise );
348 Vec_FltPush( p->vTimes2, Abc_SclObjTime(p, pObj)->fall );
349 Vec_FltPush( p->vTimes2, Abc_SclObjSlew(p, pObj)->rise );
350 Vec_FltPush( p->vTimes2, Abc_SclObjSlew(p, pObj)->fall );
351 }
352}
353static inline void Abc_SclConeRestore( SC_Man * p, Vec_Int_t * vCone )
354{
355 Abc_Obj_t * pObj;
356 int i, k = 0;
357 Abc_NtkForEachObjVec( vCone, p->pNtk, pObj, i )
358 {
359 Abc_SclObjTime(p, pObj)->rise = Vec_FltEntry(p->vTimes2, k++);
360 Abc_SclObjTime(p, pObj)->fall = Vec_FltEntry(p->vTimes2, k++);
361 Abc_SclObjSlew(p, pObj)->rise = Vec_FltEntry(p->vTimes2, k++);
362 Abc_SclObjSlew(p, pObj)->fall = Vec_FltEntry(p->vTimes2, k++);
363 }
364 assert( Vec_FltSize(p->vTimes2) == k );
365}
366static inline void Abc_SclEvalStore( SC_Man * p, Vec_Int_t * vCone )
367{
368 Abc_Obj_t * pObj;
369 int i;
370 Vec_FltClear( p->vTimes3 );
371 Abc_NtkForEachObjVec( vCone, p->pNtk, pObj, i )
372 {
373 Vec_FltPush( p->vTimes3, Abc_SclObjTime(p, pObj)->rise );
374 Vec_FltPush( p->vTimes3, Abc_SclObjTime(p, pObj)->fall );
375 }
376}
377static inline float Abc_SclEvalPerform( SC_Man * p, Vec_Int_t * vCone )
378{
379 Abc_Obj_t * pObj;
380 float Diff, Multi = 1.5, Eval = 0;
381 int i, k = 0;
382 Abc_NtkForEachObjVec( vCone, p->pNtk, pObj, i )
383 {
384 Diff = (Vec_FltEntry(p->vTimes3, k++) - Abc_SclObjTime(p, pObj)->rise);
385 Diff += (Vec_FltEntry(p->vTimes3, k++) - Abc_SclObjTime(p, pObj)->fall);
386 Eval += 0.5 * (Diff > 0 ? Diff : Multi * Diff);
387 }
388 assert( Vec_FltSize(p->vTimes3) == k );
389 return Eval / Vec_IntSize(vCone);
390}
391static inline float Abc_SclEvalPerformLegal( SC_Man * p, Vec_Int_t * vCone, float D )
392{
393 Abc_Obj_t * pObj;
394 float Rise, Fall, Multi = 1.0, Eval = 0;
395 int i, k = 0;
396 Abc_NtkForEachObjVec( vCone, p->pNtk, pObj, i )
397 {
398 Rise = Vec_FltEntry(p->vTimes3, k++) - Abc_SclObjTime(p, pObj)->rise;
399 Fall = Vec_FltEntry(p->vTimes3, k++) - Abc_SclObjTime(p, pObj)->fall;
400 if ( Rise + Multi * Abc_SclObjGetSlackR(p, pObj, D) < 0 || Fall + Multi * Abc_SclObjGetSlackF(p, pObj, D) < 0 )
401 return -1;
402 Eval += 0.5 * Rise + 0.5 * Fall;
403 }
404 assert( Vec_FltSize(p->vTimes3) == k );
405 return Eval / Vec_IntSize(vCone);
406}
407static inline void Abc_SclConeClean( SC_Man * p, Vec_Int_t * vCone )
408{
409 SC_Pair Zero = { 0.0, 0.0 };
410 Abc_Obj_t * pObj;
411 int i;
412 Abc_NtkForEachObjVec( vCone, p->pNtk, pObj, i )
413 {
414 *Abc_SclObjTime(p, pObj) = Zero;
415 *Abc_SclObjSlew(p, pObj) = Zero;
416 }
417}
418
430static inline int Abc_SclGetBufInvCount( Abc_Ntk_t * pNtk )
431{
432 Abc_Obj_t * pObj;
433 int i, Count = 0;
434 Abc_NtkForEachNodeNotBarBuf1( pNtk, pObj, i )
435 Count += (Abc_ObjFaninNum(pObj) == 1);
436 return Count;
437}
438static inline float Abc_SclGetAverageSize( Abc_Ntk_t * pNtk )
439{
440 Abc_Obj_t * pObj;
441 double Total = 0;
442 int i, Count = 0;
443 Abc_NtkForEachNodeNotBarBuf1( pNtk, pObj, i )
444 Count++, Total += 100.0*Abc_SclObjCell(pObj)->Order/Abc_SclObjCell(pObj)->nGates;
445 return (float)(Total / Count);
446}
447static inline float Abc_SclGetTotalArea( Abc_Ntk_t * pNtk )
448{
449 double Area = 0;
450 Abc_Obj_t * pObj;
451 int i;
452 Abc_NtkForEachNodeNotBarBuf1( pNtk, pObj, i )
453 Area += Abc_SclObjCell(pObj)->area;
454 return Area;
455}
456static inline float Abc_SclGetMaxDelay( SC_Man * p )
457{
458 float fMaxArr = 0;
459 Abc_Obj_t * pObj;
460 int i;
461 Abc_NtkForEachCo( p->pNtk, pObj, i )
462 fMaxArr = Abc_MaxFloat( fMaxArr, Abc_SclObjTimeMax(p, pObj) );
463 return fMaxArr;
464}
465static inline float Abc_SclGetMaxDelayNodeFanins( SC_Man * p, Abc_Obj_t * pNode )
466{
467 float fMaxArr = 0;
468 Abc_Obj_t * pObj;
469 int i;
470 assert( Abc_ObjIsNode(pNode) );
471 Abc_ObjForEachFanin( pNode, pObj, i )
472 fMaxArr = Abc_MaxFloat( fMaxArr, Abc_SclObjTimeMax(p, pObj) );
473 return fMaxArr;
474}
475static inline float Abc_SclReadMaxDelay( SC_Man * p )
476{
477 return Abc_SclObjTimeMax( p, Abc_NtkCo(p->pNtk, Vec_QueTop(p->vQue)) );
478}
479
491static inline SC_Cell * Abc_SclObjResiable( SC_Man * p, Abc_Obj_t * pObj, int fUpsize )
492{
493 SC_Cell * pOld = Abc_SclObjCell(pObj);
494 if ( fUpsize )
495 return pOld->pNext->Order > pOld->Order ? pOld->pNext : NULL;
496 else
497 return pOld->pPrev->Order < pOld->Order ? pOld->pPrev : NULL;
498}
499
511static inline void Abc_SclDumpStats( SC_Man * p, char * pFileName, abctime Time )
512{
513 static char FileNameOld[1000] = {0};
514 static int nNodesOld, nAreaOld, nDelayOld;
515 static abctime clk = 0;
516 FILE * pTable;
517 pTable = fopen( pFileName, "a+" );
518 if ( strcmp( FileNameOld, p->pNtk->pName ) )
519 {
520 sprintf( FileNameOld, "%s", p->pNtk->pName );
521 fprintf( pTable, "\n" );
522 fprintf( pTable, "%s ", Extra_FileNameWithoutPath(p->pNtk->pName) );
523 fprintf( pTable, "%d ", Abc_NtkPiNum(p->pNtk) );
524 fprintf( pTable, "%d ", Abc_NtkPoNum(p->pNtk) );
525 fprintf( pTable, "%d ", (nNodesOld = Abc_NtkNodeNum(p->pNtk)) );
526 fprintf( pTable, "%d ", (nAreaOld = (int)p->SumArea) );
527 fprintf( pTable, "%d ", (nDelayOld = (int)p->ReportDelay) );
528 clk = Abc_Clock();
529 }
530 else
531 {
532 fprintf( pTable, " " );
533 fprintf( pTable, "%.1f ", 100.0 * Abc_NtkNodeNum(p->pNtk) / nNodesOld );
534 fprintf( pTable, "%.1f ", 100.0 * (int)p->SumArea / nAreaOld );
535 fprintf( pTable, "%.1f ", 100.0 * (int)p->ReportDelay / nDelayOld );
536 fprintf( pTable, "%.2f", 1.0*(Abc_Clock() - clk)/CLOCKS_PER_SEC );
537 }
538 fclose( pTable );
539}
540
541/*=== sclBuffer.c ===============================================================*/
542extern Abc_Ntk_t * Abc_SclBufferingPerform( Abc_Ntk_t * pNtk, SC_Lib * pLib, SC_BusPars * pPars );
543/*=== sclBufferOld.c ===============================================================*/
544extern int Abc_SclIsInv( Abc_Obj_t * pObj );
545extern void Abc_NodeInvUpdateFanPolarity( Abc_Obj_t * pObj );
546extern void Abc_NodeInvUpdateObjFanoutPolarity( Abc_Obj_t * pObj, Abc_Obj_t * pFanout );
547extern void Abc_SclReportDupFanins( Abc_Ntk_t * pNtk );
548extern Abc_Ntk_t * Abc_SclUnBufferPerform( Abc_Ntk_t * pNtk, int fVerbose );
549extern Abc_Ntk_t * Abc_SclUnBufferPhase( Abc_Ntk_t * pNtk, int fVerbose );
550extern Abc_Ntk_t * Abc_SclBufferPhase( Abc_Ntk_t * pNtk, int fVerbose );
551extern int Abc_SclCheckNtk( Abc_Ntk_t * p, int fVerbose );
552extern Abc_Ntk_t * Abc_SclPerformBuffering( Abc_Ntk_t * p, int DegreeR, int Degree, int fUseInvs, int fVerbose );
553extern Abc_Ntk_t * Abc_SclBufPerform( Abc_Ntk_t * pNtk, int FanMin, int FanMax, int fBufPis, int fSkipDup, int fVerbose );
554/*=== sclDnsize.c ===============================================================*/
555extern void Abc_SclDnsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars, void * pFuncFanin );
556/*=== sclLoad.c ===============================================================*/
557extern Vec_Flt_t * Abc_SclFindWireCaps( SC_WireLoad * pWL, int nFanoutMax );
558extern float Abc_SclFindWireLoad( Vec_Flt_t * vWireCaps, int nFans );
559extern void Abc_SclAddWireLoad( SC_Man * p, Abc_Obj_t * pObj, int fSubtr );
560extern void Abc_SclComputeLoad( SC_Man * p );
561extern void Abc_SclUpdateLoad( SC_Man * p, Abc_Obj_t * pObj, SC_Cell * pOld, SC_Cell * pNew );
562extern void Abc_SclUpdateLoadSplit( SC_Man * p, Abc_Obj_t * pBuffer, Abc_Obj_t * pFanout );
563/*=== sclSize.c ===============================================================*/
564extern Abc_Obj_t * Abc_SclFindCriticalCo( SC_Man * p, int * pfRise );
565extern Abc_Obj_t * Abc_SclFindMostCriticalFanin( SC_Man * p, int * pfRise, Abc_Obj_t * pNode );
566extern void Abc_SclTimeNtkPrint( SC_Man * p, int fShowAll, int fPrintPath );
567extern SC_Man * Abc_SclManStart( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUseWireLoads, int fDept, float DUser, int nTreeCRatio );
568extern void Abc_SclTimeCone( SC_Man * p, Vec_Int_t * vCone );
569extern void Abc_SclTimeNtkRecompute( SC_Man * p, float * pArea, float * pDelay, int fReverse, float DUser );
570extern int Abc_SclTimeIncUpdate( SC_Man * p );
571extern void Abc_SclTimeIncInsert( SC_Man * p, Abc_Obj_t * pObj );
572extern void Abc_SclTimeIncUpdateLevel( Abc_Obj_t * pObj );
573extern void Abc_SclTimePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, int nTreeCRatio, int fUseWireLoads, int fShowAll, int fPrintPath, int fDumpStats );
574extern void Abc_SclPrintBuffers( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fVerbose );
575/*=== sclUpsize.c ===============================================================*/
577extern void Abc_SclUpsizePerform( SC_Lib * pLib, Abc_Ntk_t * pNtk, SC_SizePars * pPars, void * pFuncFanin );
578/*=== sclUtil.c ===============================================================*/
579extern void Abc_SclMioGates2SclGates( SC_Lib * pLib, Abc_Ntk_t * p );
580extern void Abc_SclSclGates2MioGates( SC_Lib * pLib, Abc_Ntk_t * p );
581extern void Abc_SclTransferGates( Abc_Ntk_t * pOld, Abc_Ntk_t * pNew );
582extern void Abc_SclPrintGateSizes( SC_Lib * pLib, Abc_Ntk_t * p );
583extern void Abc_SclMinsizePerform( SC_Lib * pLib, Abc_Ntk_t * p, int fUseMax, int fVerbose );
584extern int Abc_SclCountMinSize( SC_Lib * pLib, Abc_Ntk_t * p, int fUseMax );
585extern Vec_Int_t * Abc_SclExtractBarBufs( Abc_Ntk_t * pNtk );
586extern void Abc_SclInsertBarBufs( Abc_Ntk_t * pNtk, Vec_Int_t * vBufs );
587
588
590
591#endif
592
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition abc.h:522
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
#define Abc_NtkForEachNodeNotBarBuf1(pNtk, pNode, i)
Definition abc.h:473
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition abcDfs.c:1449
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
Definition abc.h:455
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define ABC_FREE(obj)
Definition abc_global.h:267
#define ABC_NAMESPACE_HEADER_END
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Cube * p
Definition exorList.c:222
char * Extra_FileNameWithoutPath(char *FileName)
struct SC_SizePars_ SC_SizePars
Definition sclLib.h:82
struct SC_Lib_ SC_Lib
Definition sclLib.h:128
struct SC_Pair_ SC_Pair
Definition sclLib.h:69
struct SC_BusPars_ SC_BusPars
Definition sclLib.h:102
struct SC_WireLoad_ SC_WireLoad
STRUCTURE DEFINITIONS ///.
Definition sclLib.h:120
struct SC_Cell_ SC_Cell
Definition sclLib.h:127
void Abc_SclUpsizePerform(SC_Lib *pLib, Abc_Ntk_t *pNtk, SC_SizePars *pPars, void *pFuncFanin)
Definition sclUpsize.c:1028
float Abc_SclFindWireLoad(Vec_Flt_t *vWireCaps, int nFans)
Definition sclLoad.c:96
Abc_Ntk_t * Abc_SclBufferingPerform(Abc_Ntk_t *pNtk, SC_Lib *pLib, SC_BusPars *pPars)
Definition sclBufSize.c:491
int Abc_SclTimeIncUpdate(SC_Man *p)
Definition sclSize.c:555
Vec_Int_t * Abc_SclExtractBarBufs(Abc_Ntk_t *pNtk)
Definition sclUtil.c:287
Abc_Ntk_t * Abc_SclUnBufferPerform(Abc_Ntk_t *pNtk, int fVerbose)
Definition sclBuffer.c:129
Abc_Ntk_t * Abc_SclBufPerform(Abc_Ntk_t *pNtk, int FanMin, int FanMax, int fBufPis, int fSkipDup, int fVerbose)
Definition sclBuffer.c:986
void Abc_SclPrintBuffers(SC_Lib *pLib, Abc_Ntk_t *pNtk, int fVerbose)
Definition sclSize.c:912
void Abc_SclTimeCone(SC_Man *p, Vec_Int_t *vCone)
Definition sclSize.c:398
Abc_Ntk_t * Abc_SclUnBufferPhase(Abc_Ntk_t *pNtk, int fVerbose)
Definition sclBuffer.c:239
void Abc_SclUpdateLoad(SC_Man *p, Abc_Obj_t *pObj, SC_Cell *pOld, SC_Cell *pNew)
Definition sclLoad.c:201
void Abc_SclTimeIncInsert(SC_Man *p, Abc_Obj_t *pObj)
Definition sclSize.c:577
void Abc_SclSclGates2MioGates(SC_Lib *pLib, Abc_Ntk_t *p)
Definition sclUtil.c:70
void Abc_NodeInvUpdateObjFanoutPolarity(Abc_Obj_t *pObj, Abc_Obj_t *pFanout)
Definition sclBuffer.c:336
void Abc_NodeInvUpdateFanPolarity(Abc_Obj_t *pObj)
Definition sclBuffer.c:322
void Abc_SclMioGates2SclGates(SC_Lib *pLib, Abc_Ntk_t *p)
DECLARATIONS ///.
Definition sclUtil.c:47
int Abc_SclIsInv(Abc_Obj_t *pObj)
Definition sclBuffer.c:116
void Abc_SclTimePerform(SC_Lib *pLib, Abc_Ntk_t *pNtk, int nTreeCRatio, int fUseWireLoads, int fShowAll, int fPrintPath, int fDumpStats)
Definition sclSize.c:707
int Abc_SclCheckNtk(Abc_Ntk_t *p, int fVerbose)
Definition sclBuffer.c:286
void Abc_SclComputeLoad(SC_Man *p)
Definition sclLoad.c:108
int Abc_SclCountMinSize(SC_Lib *pLib, Abc_Ntk_t *p, int fUseMax)
Definition sclUtil.c:222
void Abc_SclReportDupFanins(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition sclBuffer.c:90
int Abc_SclCountNearCriticalNodes(SC_Man *p)
Definition sclUpsize.c:187
void Abc_SclTimeIncUpdateLevel(Abc_Obj_t *pObj)
Definition sclSize.c:591
void Abc_SclDnsizePerform(SC_Lib *pLib, Abc_Ntk_t *pNtk, SC_SizePars *pPars, void *pFuncFanin)
Definition sclDnsize.c:361
void Abc_SclInsertBarBufs(Abc_Ntk_t *pNtk, Vec_Int_t *vBufs)
Definition sclUtil.c:307
Abc_Ntk_t * Abc_SclBufferPhase(Abc_Ntk_t *pNtk, int fVerbose)
Definition sclBuffer.c:198
Abc_Ntk_t * Abc_SclPerformBuffering(Abc_Ntk_t *p, int DegreeR, int Degree, int fUseInvs, int fVerbose)
Definition sclBuffer.c:459
Abc_Obj_t * Abc_SclFindCriticalCo(SC_Man *p, int *pfRise)
DECLARATIONS ///.
Definition sclSize.c:52
void Abc_SclPrintGateSizes(SC_Lib *pLib, Abc_Ntk_t *p)
Definition sclUtil.c:156
Abc_Obj_t * Abc_SclFindMostCriticalFanin(SC_Man *p, int *pfRise, Abc_Obj_t *pNode)
Definition sclSize.c:84
SC_Man * Abc_SclManStart(SC_Lib *pLib, Abc_Ntk_t *pNtk, int fUseWireLoads, int fDept, float DUser, int nTreeCRatio)
Definition sclSize.c:648
void Abc_SclTimeNtkPrint(SC_Man *p, int fShowAll, int fPrintPath)
Definition sclSize.c:136
void Abc_SclAddWireLoad(SC_Man *p, Abc_Obj_t *pObj, int fSubtr)
Definition sclLoad.c:102
void Abc_SclTimeNtkRecompute(SC_Man *p, float *pArea, float *pDelay, int fReverse, float DUser)
Definition sclSize.c:415
void Abc_SclUpdateLoadSplit(SC_Man *p, Abc_Obj_t *pBuffer, Abc_Obj_t *pFanout)
Definition sclLoad.c:214
void Abc_SclTransferGates(Abc_Ntk_t *pOld, Abc_Ntk_t *pNew)
Definition sclUtil.c:102
typedefABC_NAMESPACE_HEADER_START struct SC_Man_ SC_Man
INCLUDES ///.
Definition sclSize.h:44
void Abc_SclMinsizePerform(SC_Lib *pLib, Abc_Ntk_t *p, int fUseMax, int fVerbose)
Definition sclUtil.c:204
Vec_Flt_t * Abc_SclFindWireCaps(SC_WireLoad *pWL, int nFanoutMax)
DECLARATIONS ///.
Definition sclLoad.c:45
int iData
Definition abc.h:146
unsigned Level
Definition abc.h:142
SC_Cell * pNext
Definition sclLib.h:215
SC_Cell * pPrev
Definition sclLib.h:216
int Id
Definition sclLib.h:203
int Order
Definition sclLib.h:219
int unit_time
Definition sclLib.h:230
int unit_cap_snd
Definition sclLib.h:232
SC_Cell * pPiDrive
Definition sclSize.h:64
SC_WireLoad * pWLoadUsed
Definition sclSize.h:55
abctime timeTime
Definition sclSize.h:96
float MaxDelay0
Definition sclSize.h:89
Vec_Flt_t * vTimesOut
Definition sclSize.h:62
int nEstNodes
Definition sclSize.h:74
Vec_Flt_t * vTimes3
Definition sclSize.h:69
float SumArea
Definition sclSize.h:86
int nIncUpdates
Definition sclSize.h:84
float BestDelay
Definition sclSize.h:90
Vec_Flt_t * vTimes2
Definition sclSize.h:68
Vec_Int_t * vUpdates2
Definition sclSize.h:53
Vec_Int_t * vNode2Gate
Definition sclSize.h:78
SC_Pair * pLoads
Definition sclSize.h:57
float ReportDelay
Definition sclSize.h:91
abctime timeSize
Definition sclSize.h:95
Vec_Que_t * vNodeByGain
Definition sclSize.h:76
Vec_Int_t * vBestFans
Definition sclSize.h:80
Vec_Flt_t * vLoads2
Definition sclSize.h:66
Vec_Flt_t * vLoads3
Definition sclSize.h:67
Abc_Ntk_t * pNtk
Definition sclSize.h:48
float EstLoadMax
Definition sclSize.h:71
float EstLoadAve
Definition sclSize.h:72
float MaxDelay
Definition sclSize.h:87
SC_Lib * pLib
Definition sclSize.h:47
SC_Pair * pDepts
Definition sclSize.h:58
Vec_Int_t * vNodeIter
Definition sclSize.h:79
SC_Pair * pTimes
Definition sclSize.h:59
int nObjs
Definition sclSize.h:49
Vec_Que_t * vQue
Definition sclSize.h:63
Vec_Flt_t * vInDrive
Definition sclSize.h:61
Vec_Int_t * vUpdates
Definition sclSize.h:52
Vec_Flt_t * vNode2Gain
Definition sclSize.h:77
float SumArea0
Definition sclSize.h:88
Vec_Wec_t * vLevels
Definition sclSize.h:82
Vec_Int_t * vChanged
Definition sclSize.h:83
Vec_Int_t * vGatesBest
Definition sclSize.h:51
abctime timeCone
Definition sclSize.h:94
float EstLinear
Definition sclSize.h:73
SC_Pair * pSlews
Definition sclSize.h:60
abctime timeTotal
Definition sclSize.h:93
abctime timeOther
Definition sclSize.h:97
float(* pFuncFanin)(void *p, Abc_Obj_t *pObj, Abc_Obj_t *pFanin, int iFanin, int fRise)
Definition sclSize.h:98
Vec_Flt_t * vWireCaps
Definition sclSize.h:56
#define assert(ex)
Definition util_old.h:213
char * memset()
int strcmp()
char * sprintf()
typedefABC_NAMESPACE_HEADER_START struct Vec_Flt_t_ Vec_Flt_t
INCLUDES ///.
Definition vecFlt.h:42
typedefABC_NAMESPACE_HEADER_START struct Vec_Que_t_ Vec_Que_t
INCLUDES ///.
Definition vecQue.h:40
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition vecWec.h:42