abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
sclBufSize.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [sclBufSize.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Standard-cell library representation.]
8 
9  Synopsis [Buffering and sizing combined.]
10 
11  Author [Alan Mishchenko, Niklas Een]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - August 24, 2012.]
16 
17  Revision [$Id: sclBufSize.c,v 1.0 2012/08/24 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "sclSize.h"
22 #include "map/mio/mio.h"
23 #include "base/main/main.h"
24 
26 
27 
28 ////////////////////////////////////////////////////////////////////////
29 /// DECLARATIONS ///
30 ////////////////////////////////////////////////////////////////////////
31 
32 typedef struct Bus_Man_t_ Bus_Man_t;
33 struct Bus_Man_t_
34 {
35  // user data
36  SC_BusPars * pPars; // parameters
37  Abc_Ntk_t * pNtk; // user's network
38  SC_Cell * pPiDrive; // PI driver
39  // library
40  SC_Lib * pLib; // cell library
41  SC_Cell * pInv; // base interter (largest/average/???)
42  SC_WireLoad * pWLoadUsed; // name of the used WireLoad model
43  Vec_Flt_t * vWireCaps; // estimated wire loads
44  // internal
45  Vec_Flt_t * vCins; // input cap for fanouts
46  Vec_Flt_t * vETimes; // fanout edge departures
47  Vec_Flt_t * vLoads; // loads for all nodes
48  Vec_Flt_t * vDepts; // departure times
49  Vec_Ptr_t * vFanouts; // fanout array
50 };
51 
52 
53 static inline Bus_Man_t * Bus_SclObjMan( Abc_Obj_t * p ) { return (Bus_Man_t *)p->pNtk->pBSMan; }
54 static inline float Bus_SclObjCin( Abc_Obj_t * p ) { return Vec_FltEntry( Bus_SclObjMan(p)->vCins, Abc_ObjId(p) ); }
55 static inline void Bus_SclObjSetCin( Abc_Obj_t * p, float cap ) { Vec_FltWriteEntry( Bus_SclObjMan(p)->vCins, Abc_ObjId(p), cap ); }
56 static inline float Bus_SclObjETime( Abc_Obj_t * p ) { return Vec_FltEntry( Bus_SclObjMan(p)->vETimes, Abc_ObjId(p) ); }
57 static inline void Bus_SclObjSetETime( Abc_Obj_t * p, float time ) { Vec_FltWriteEntry( Bus_SclObjMan(p)->vETimes, Abc_ObjId(p), time ); }
58 static inline float Bus_SclObjLoad( Abc_Obj_t * p ) { return Vec_FltEntry( Bus_SclObjMan(p)->vLoads, Abc_ObjId(p) ); }
59 static inline void Bus_SclObjSetLoad( Abc_Obj_t * p, float cap ) { Vec_FltWriteEntry( Bus_SclObjMan(p)->vLoads, Abc_ObjId(p), cap ); }
60 static inline float Bus_SclObjDept( Abc_Obj_t * p ) { return Vec_FltEntry( Bus_SclObjMan(p)->vDepts, Abc_ObjId(p) ); }
61 static inline void Bus_SclObjUpdateDept( Abc_Obj_t * p, float time ) { float *q = Vec_FltEntryP( Bus_SclObjMan(p)->vDepts, Abc_ObjId(p) ); if (*q < time) *q = time; }
62 
63 ////////////////////////////////////////////////////////////////////////
64 /// FUNCTION DEFINITIONS ///
65 ////////////////////////////////////////////////////////////////////////
66 
67 /**Function*************************************************************
68 
69  Synopsis []
70 
71  Description []
72 
73  SideEffects []
74 
75  SeeAlso []
76 
77 ***********************************************************************/
78 Bus_Man_t * Bus_ManStart( Abc_Ntk_t * pNtk, SC_Lib * pLib, SC_BusPars * pPars )
79 {
80  Bus_Man_t * p;
81  p = ABC_CALLOC( Bus_Man_t, 1 );
82  p->pPars = pPars;
83  p->pNtk = pNtk;
84  p->pLib = pLib;
85  p->pInv = Abc_SclFindInvertor(pLib, pPars->fAddBufs)->pRepr->pPrev;//->pAve;
86  if ( pPars->fUseWireLoads )
87  {
88  if ( pNtk->pWLoadUsed == NULL )
89  {
90  p->pWLoadUsed = Abc_SclFindWireLoadModel( pLib, Abc_SclGetTotalArea(pNtk) );
91  if ( p->pWLoadUsed )
92  pNtk->pWLoadUsed = Abc_UtilStrsav( p->pWLoadUsed->pName );
93  }
94  else
95  p->pWLoadUsed = Abc_SclFetchWireLoadModel( pLib, pNtk->pWLoadUsed );
96  }
97  if ( p->pWLoadUsed )
98  p->vWireCaps = Abc_SclFindWireCaps( p->pWLoadUsed, Abc_NtkGetFanoutMax(pNtk) );
99  p->vFanouts = Vec_PtrAlloc( 100 );
100  p->vCins = Vec_FltAlloc( 2*Abc_NtkObjNumMax(pNtk) + 1000 );
101  p->vETimes = Vec_FltAlloc( 2*Abc_NtkObjNumMax(pNtk) + 1000 );
102  p->vLoads = Vec_FltAlloc( 2*Abc_NtkObjNumMax(pNtk) + 1000 );
103  p->vDepts = Vec_FltAlloc( 2*Abc_NtkObjNumMax(pNtk) + 1000 );
104  Vec_FltFill( p->vCins, Abc_NtkObjNumMax(pNtk), 0 );
105  Vec_FltFill( p->vETimes, Abc_NtkObjNumMax(pNtk), 0 );
106  Vec_FltFill( p->vLoads, Abc_NtkObjNumMax(pNtk), 0 );
107  Vec_FltFill( p->vDepts, Abc_NtkObjNumMax(pNtk), 0 );
108  pNtk->pBSMan = p;
109  return p;
110 }
112 {
113  Vec_PtrFreeP( &p->vFanouts );
114  Vec_FltFreeP( &p->vWireCaps );
115  Vec_FltFreeP( &p->vCins );
116  Vec_FltFreeP( &p->vETimes );
117  Vec_FltFreeP( &p->vLoads );
118  Vec_FltFreeP( &p->vDepts );
119  ABC_FREE( p );
120 }
121 
122 /**Function*************************************************************
123 
124  Synopsis []
125 
126  Description []
127 
128  SideEffects []
129 
130  SeeAlso []
131 
132 ***********************************************************************/
134 {
135  if ( Abc_FrameReadMaxLoad() )
136  {
137  Abc_Obj_t * pObj; int i;
138  float MaxLoad = Abc_FrameReadMaxLoad();
139  Abc_NtkForEachCo( p->pNtk, pObj, i )
140  Bus_SclObjSetCin( pObj, MaxLoad );
141 // printf( "Default output load is specified (%f ff).\n", MaxLoad );
142  }
143  if ( Abc_FrameReadDrivingCell() )
144  {
145  int iCell = Abc_SclCellFind( p->pLib, Abc_FrameReadDrivingCell() );
146  if ( iCell == -1 )
147  printf( "Cannot find the default PI driving cell (%s) in the library.\n", Abc_FrameReadDrivingCell() );
148  else
149  {
150 // printf( "Default PI driving cell is specified (%s).\n", Abc_FrameReadDrivingCell() );
151  p->pPiDrive = SC_LibCell( p->pLib, iCell );
152  assert( p->pPiDrive != NULL );
153  assert( p->pPiDrive->n_inputs == 1 );
154 // printf( "Default input driving cell is specified (%s).\n", p->pPiDrive->pName );
155  }
156  }
157 }
158 
159 /**Function*************************************************************
160 
161  Synopsis [Compute load and departure times of the node.]
162 
163  Description []
164 
165  SideEffects []
166 
167  SeeAlso []
168 
169 ***********************************************************************/
170 static inline float Abc_NtkComputeEdgeDept( Abc_Obj_t * pFanout, int iFanin, float Slew )
171 {
172  float Load = Bus_SclObjLoad( pFanout );
173  float Dept = Bus_SclObjDept( pFanout );
174  float Edge = Scl_LibPinArrivalEstimate( Abc_SclObjCell(pFanout), iFanin, Slew, Load );
175 //if ( Abc_ObjFaninNum(pFanout) == 0 )
176 //printf( "Edge = %.2f\n", Edge );
177  assert( Edge > 0 );
178  return Dept + Edge;
179 }
180 float Abc_NtkComputeNodeDeparture( Abc_Obj_t * pObj, float Slew )
181 {
182  Abc_Obj_t * pFanout;
183  int i;
184  assert( Bus_SclObjDept(pObj) == 0 );
185  Abc_ObjForEachFanout( pObj, pFanout, i )
186  if ( !Abc_ObjIsCo(pFanout) ) // add required times here
187  Bus_SclObjUpdateDept( pObj, Abc_NtkComputeEdgeDept(pFanout, Abc_NodeFindFanin(pFanout, pObj), Slew) );
188  return Bus_SclObjDept( pObj );
189 }
190 void Abc_NtkComputeFanoutInfo( Abc_Obj_t * pObj, float Slew )
191 {
192  Abc_Obj_t * pFanout;
193  int i;
194  Abc_ObjForEachFanout( pObj, pFanout, i )
195  if ( !Abc_ObjIsCo(pFanout) )
196  {
197  int iFanin = Abc_NodeFindFanin(pFanout, pObj);
198  Bus_SclObjSetETime( pFanout, Abc_NtkComputeEdgeDept(pFanout, iFanin, Slew) );
199  Bus_SclObjSetCin( pFanout, SC_CellPinCap( Abc_SclObjCell(pFanout), iFanin ) );
200  }
201 }
203 {
204  Abc_Obj_t * pFanout;
205  float Load;
206  int i;
207  assert( Bus_SclObjLoad(pObj) == 0 );
208  Load = Abc_SclFindWireLoad( p->vWireCaps, Abc_ObjFanoutNum(pObj) );
209  Abc_ObjForEachFanout( pObj, pFanout, i )
210  Load += Bus_SclObjCin( pFanout );
211  Bus_SclObjSetLoad( pObj, Load );
212  return Load;
213 }
215 {
216  Abc_Obj_t * pFanout;
217  float Load;
218  int i;
219  Load = Abc_SclFindWireLoad( p->vWireCaps, Vec_PtrSize(vFanouts) );
220  Vec_PtrForEachEntry( Abc_Obj_t *, vFanouts, pFanout, i )
221  Load += Bus_SclObjCin( pFanout );
222  return Load;
223 }
225 {
226  Abc_Obj_t * pFanout;
227  int i;
228  printf( "Obj %6d fanouts (%d):\n", Abc_ObjId(pObj), Abc_ObjFanoutNum(pObj) );
229  Abc_ObjForEachFanout( pObj, pFanout, i )
230  {
231  printf( "%3d : time = %7.2f ps load = %7.2f ff ", i, Bus_SclObjETime(pFanout), Bus_SclObjCin(pFanout) );
232  printf( "%s\n", Abc_ObjFaninPhase( pFanout, Abc_NodeFindFanin(pFanout, pObj) ) ? "*" : " " );
233  }
234  printf( "\n" );
235 }
237 {
238  Abc_Obj_t * pFanout;
239  int i;
240  printf( "Fanout profile (%d):\n", Vec_PtrSize(vFanouts) );
241  Vec_PtrForEachEntry( Abc_Obj_t *, vFanouts, pFanout, i )
242  {
243  printf( "%3d : time = %7.2f ps load = %7.2f ff ", i, Bus_SclObjETime(pFanout), Bus_SclObjCin(pFanout) );
244  if ( pObj->pNtk->vPhases )
245  printf( "%s", (pObj && Abc_ObjFanoutNum(pObj) == Vec_PtrSize(vFanouts) && Abc_ObjFaninPhase( pFanout, Abc_NodeFindFanin(pFanout, pObj) )) ? "*" : " " );
246  printf( "\n" );
247  }
248  printf( "\n" );
249 }
250 
251 /**Function*************************************************************
252 
253  Synopsis [Compare two fanouts by their departure times.]
254 
255  Description []
256 
257  SideEffects []
258 
259  SeeAlso []
260 
261 ***********************************************************************/
263 {
264  float Espilon = 0;//10; // 10 ps
265  if ( Bus_SclObjETime(*pp1) < Bus_SclObjETime(*pp2) - Espilon )
266  return -1;
267  if ( Bus_SclObjETime(*pp1) > Bus_SclObjETime(*pp2) + Espilon )
268  return 1;
269  if ( Bus_SclObjCin(*pp1) > Bus_SclObjCin(*pp2) )
270  return -1;
271  if ( Bus_SclObjCin(*pp1) < Bus_SclObjCin(*pp2) )
272  return 1;
273  return -1;
274 }
275 void Bus_SclInsertFanout( Vec_Ptr_t * vFanouts, Abc_Obj_t * pObj )
276 {
277  Abc_Obj_t * pCur;
278  int i, k;
279  // compact array
280  for ( i = k = 0; i < Vec_PtrSize(vFanouts); i++ )
281  if ( Vec_PtrEntry(vFanouts, i) != NULL )
282  Vec_PtrWriteEntry( vFanouts, k++, Vec_PtrEntry(vFanouts, i) );
283  Vec_PtrShrink( vFanouts, k );
284  // insert new entry
285  Vec_PtrPush( vFanouts, pObj );
286  for ( i = Vec_PtrSize(vFanouts) - 1; i > 0; i-- )
287  {
288  pCur = (Abc_Obj_t *)Vec_PtrEntry(vFanouts, i-1);
289  pObj = (Abc_Obj_t *)Vec_PtrEntry(vFanouts, i);
290  if ( Bus_SclCompareFanouts( &pCur, &pObj ) == -1 )
291  break;
292  ABC_SWAP( void *, Vec_PtrArray(vFanouts)[i-1], Vec_PtrArray(vFanouts)[i] );
293  }
294 }
296 {
297  Abc_Obj_t * pObj, * pNext;
298  int i;
299  for ( i = 0; i < Vec_PtrSize(vFanouts) - 1; i++ )
300  {
301  pObj = (Abc_Obj_t *)Vec_PtrEntry(vFanouts, i);
302  pNext = (Abc_Obj_t *)Vec_PtrEntry(vFanouts, i+1);
303  if ( Bus_SclCompareFanouts( &pObj, &pNext ) != -1 )
304  {
305  printf( "Fanouts %d and %d are out of order.\n", i, i+1 );
306  Abc_NtkPrintFanoutProfileVec( NULL, vFanouts );
307  return;
308  }
309  }
310 }
311 
312 /**Function*************************************************************
313 
314  Synopsis []
315 
316  Description []
317 
318  SideEffects []
319 
320  SeeAlso []
321 
322 ***********************************************************************/
324 {
325  SC_Cell * pCell = Abc_SclObjCell(pObj);
326  printf( "%s%7d : ", (Abc_ObjFaninNum(pObj) == 0) ? " Inv" : "Node", Abc_ObjId(pObj) );
327  printf( "%d/%2d ", Abc_ObjFaninNum(pObj) ? Abc_ObjFaninNum(pObj) : 1, Abc_ObjFanoutNum(pObj) );
328  printf( "%12s ", pCell->pName );
329  printf( "(%2d/%2d) ", pCell->Order, pCell->nGates );
330  printf( "gain =%5d ", (int)(100.0 * Bus_SclObjLoad(pObj) / SC_CellPinCapAve(pCell)) );
331  printf( "dept =%7.0f ps ", Bus_SclObjDept(pObj) );
332  printf( "\n" );
333 }
334 Abc_Obj_t * Abc_SclAddOneInv( Bus_Man_t * p, Abc_Obj_t * pObj, Vec_Ptr_t * vFanouts, float Gain )
335 {
336  SC_Cell * pCellNew;
337  Abc_Obj_t * pFanout, * pInv;
338  float Target = SC_CellPinCap(p->pInv, 0) * Gain;
339  float LoadWirePrev, LoadWireThis, LoadNew, Load = 0;
340  int Limit = Abc_MinInt( p->pPars->nDegree, Vec_PtrSize(vFanouts) );
341  int i, iStop;
342  Bus_SclCheckSortedFanout( vFanouts );
343  Vec_PtrForEachEntryStop( Abc_Obj_t *, vFanouts, pFanout, iStop, Limit )
344  {
345  LoadWirePrev = Abc_SclFindWireLoad( p->vWireCaps, iStop );
346  LoadWireThis = Abc_SclFindWireLoad( p->vWireCaps, iStop+1 );
347  Load += Bus_SclObjCin( pFanout ) - LoadWirePrev + LoadWireThis;
348  if ( Load > Target )
349  {
350  iStop++;
351  break;
352  }
353  }
354  // create inverter
355  if ( p->pPars->fAddBufs )
356  pInv = Abc_NtkCreateNodeBuf( p->pNtk, NULL );
357  else
358  pInv = Abc_NtkCreateNodeInv( p->pNtk, NULL );
359  assert( (int)Abc_ObjId(pInv) == Vec_FltSize(p->vCins) );
360  Vec_FltPush( p->vCins, 0 );
361  Vec_FltPush( p->vETimes, 0 );
362  Vec_FltPush( p->vLoads, 0 );
363  Vec_FltPush( p->vDepts, 0 );
364  Limit = Abc_MinInt( Abc_MaxInt(iStop, 2), Vec_PtrSize(vFanouts) );
365  Vec_PtrForEachEntryStop( Abc_Obj_t *, vFanouts, pFanout, i, Limit )
366  {
367  Vec_PtrWriteEntry( vFanouts, i, NULL );
368  if ( Abc_ObjFaninNum(pFanout) == 0 )
369  Abc_ObjAddFanin( pFanout, pInv );
370  else
371  Abc_ObjPatchFanin( pFanout, pObj, pInv );
372  }
373  // set the gate
374  pCellNew = Abc_SclFindSmallestGate( p->pInv, Load / Gain );
375  Vec_IntSetEntry( p->pNtk->vGates, Abc_ObjId(pInv), pCellNew->Id );
376  // set departure and load
377  Abc_NtkComputeNodeDeparture( pInv, p->pPars->Slew );
378  LoadNew = Abc_NtkComputeNodeLoad( p, pInv );
379  assert( LoadNew - Load < 1 && Load - LoadNew < 1 );
380  // set fanout info for the inverter
381  Bus_SclObjSetCin( pInv, SC_CellPinCap(pCellNew, 0) );
382  Bus_SclObjSetETime( pInv, Abc_NtkComputeEdgeDept(pInv, 0, p->pPars->Slew) );
383  // update phases
384  if ( p->pNtk->vPhases && Abc_SclIsInv(pInv) )
386  return pInv;
387 }
388 void Abc_SclBufSize( Bus_Man_t * p, float Gain )
389 {
390  SC_Cell * pCell, * pCellNew;
391  Abc_Obj_t * pObj, * pFanout;
392  abctime clk = Abc_Clock();
393  int i, k, nObjsOld = Abc_NtkObjNumMax(p->pNtk);
394  float GainGate, GainInv, Load, LoadNew, Cin, DeptMax = 0;
395  GainGate = p->pPars->fAddBufs ? pow( Gain, 2.0 ) : Gain;
396  GainInv = p->pPars->fAddBufs ? pow( Gain, 2.0 ) : Gain;
397  Abc_NtkForEachObjReverse( p->pNtk, pObj, i )
398  {
399  if ( !((Abc_ObjIsNode(pObj) && Abc_ObjFaninNum(pObj) > 0) || (Abc_ObjIsCi(pObj) && p->pPiDrive)) )
400  continue;
401  if ( 2 * nObjsOld < Abc_NtkObjNumMax(p->pNtk) )
402  {
403  printf( "Buffering could not be completed because the gain value (%d) is too low.\n", p->pPars->GainRatio );
404  break;
405  }
406  // compute load
407  Abc_NtkComputeFanoutInfo( pObj, p->pPars->Slew );
408  Load = Abc_NtkComputeNodeLoad( p, pObj );
409  // consider the gate
410  if ( Abc_ObjIsCi(pObj) )
411  {
412  pCell = p->pPiDrive;
413  Cin = SC_CellPinCapAve( pCell );
414  }
415  else
416  {
417  pCell = Abc_SclObjCell( pObj );
418  Cin = SC_CellPinCapAve( pCell->pAve );
419 // Cin = SC_CellPinCapAve( pCell->pRepr->pNext );
420  }
421  // consider upsizing the gate
422  if ( !p->pPars->fSizeOnly && (Abc_ObjFanoutNum(pObj) > p->pPars->nDegree || Load > GainGate * Cin) )
423  {
424  // add one or more inverters
425 // Abc_NtkPrintFanoutProfile( pObj );
426  Abc_NodeCollectFanouts( pObj, p->vFanouts );
427  Vec_PtrSort( p->vFanouts, (int(*)(void))Bus_SclCompareFanouts );
428  do
429  {
430  Abc_Obj_t * pInv;
431  if ( p->pPars->fVeryVerbose )//|| Vec_PtrSize(p->vFanouts) == Abc_ObjFanoutNum(pObj) )
433  pInv = Abc_SclAddOneInv( p, pObj, p->vFanouts, GainInv );
434  if ( p->pPars->fVeryVerbose )
435  Abc_SclOneNodePrint( p, pInv );
436  Bus_SclInsertFanout( p->vFanouts, pInv );
437  Load = Abc_NtkComputeFanoutLoad( p, p->vFanouts );
438  }
439  while ( Vec_PtrSize(p->vFanouts) > p->pPars->nDegree || (Vec_PtrSize(p->vFanouts) > 1 && Load > GainGate * Cin) );
440  // update node fanouts
441  Vec_PtrForEachEntry( Abc_Obj_t *, p->vFanouts, pFanout, k )
442  if ( Abc_ObjFaninNum(pFanout) == 0 )
443  Abc_ObjAddFanin( pFanout, pObj );
444  Bus_SclObjSetLoad( pObj, 0 );
445  LoadNew = Abc_NtkComputeNodeLoad( p, pObj );
446  assert( LoadNew - Load < 1 && Load - LoadNew < 1 );
447  }
448  if ( Abc_ObjIsCi(pObj) )
449  continue;
450  Abc_NtkComputeNodeDeparture( pObj, p->pPars->Slew );
451  // create cell
452  pCellNew = Abc_SclFindSmallestGate( pCell, Load / GainGate );
453  Abc_SclObjSetCell( pObj, pCellNew );
454  if ( p->pPars->fVeryVerbose )
455  Abc_SclOneNodePrint( p, pObj );
456  assert( p->pPars->fSizeOnly || Abc_ObjFanoutNum(pObj) <= p->pPars->nDegree );
457  }
458  // compute departure time of the PI
459  if ( i < 0 ) // finished buffering
460  Abc_NtkForEachCi( p->pNtk, pObj, i )
461  {
462  float DeptCur = Abc_NtkComputeNodeDeparture(pObj, p->pPars->Slew);
463  if ( p->pPiDrive )
464  {
465  float Load = Bus_SclObjLoad( pObj );
466  SC_Pair ArrOut, SlewOut, LoadIn = { Load, Load };
467  Scl_LibHandleInputDriver( p->pPiDrive, &LoadIn, &ArrOut, &SlewOut );
468  DeptCur += 0.5 * ArrOut.fall + 0.5 * ArrOut.rise;
469  }
470  DeptMax = Abc_MaxFloat( DeptMax, DeptCur );
471  }
472  if ( p->pPars->fVerbose )
473  {
474  printf( "WireLoads = %d Degree = %d Target slew =%4d ps Gain2 =%5d Buf = %6d Delay =%7.0f ps ",
475  p->pPars->fUseWireLoads, p->pPars->nDegree, p->pPars->Slew, p->pPars->GainRatio,
476  Abc_NtkObjNumMax(p->pNtk) - nObjsOld, DeptMax );
477  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
478  }
479 }
481 {
482  Abc_Ntk_t * pNtkNew;
483  Bus_Man_t * p;
484  if ( !Abc_SclCheckNtk( pNtk, 0 ) )
485  return NULL;
486  Abc_SclReportDupFanins( pNtk );
487  Abc_SclMioGates2SclGates( pLib, pNtk );
488  p = Bus_ManStart( pNtk, pLib, pPars );
490  Abc_SclBufSize( p, 0.01 * pPars->GainRatio );
491  Bus_ManStop( p );
492  Abc_SclSclGates2MioGates( pLib, pNtk );
493  if ( pNtk->vPhases )
494  Vec_IntFillExtra( pNtk->vPhases, Abc_NtkObjNumMax(pNtk), 0 );
495  pNtkNew = Abc_NtkDupDfs( pNtk );
496  return pNtkNew;
497 }
498 
499 ////////////////////////////////////////////////////////////////////////
500 /// END OF FILE ///
501 ////////////////////////////////////////////////////////////////////////
502 
503 
505 
ABC_DLL float Abc_FrameReadMaxLoad()
Definition: mainFrame.c:98
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
SC_Cell * pRepr
Definition: sclLib.h:196
static void Bus_SclObjSetCin(Abc_Obj_t *p, float cap)
Definition: sclBufSize.c:55
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
int nGates
Definition: sclLib.h:199
ABC_DLL char * Abc_FrameReadDrivingCell()
Definition: mainFrame.c:97
void Abc_NtkPrintFanoutProfile(Abc_Obj_t *pObj)
Definition: sclBufSize.c:224
Vec_Flt_t * vWireCaps
Definition: sclBufSize.c:43
int Abc_SclIsInv(Abc_Obj_t *pObj)
Definition: sclBuffer.c:116
static float Bus_SclObjCin(Abc_Obj_t *p)
Definition: sclBufSize.c:54
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
SC_Cell * pInv
Definition: sclBufSize.c:41
static void Vec_FltWriteEntry(Vec_Flt_t *p, int i, float Entry)
Definition: vecFlt.h:364
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static float * Vec_FltEntryP(Vec_Flt_t *p, int i)
Definition: vecFlt.h:347
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntFillExtra(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:376
int Abc_SclCheckNtk(Abc_Ntk_t *p, int fVerbose)
Definition: sclBuffer.c:286
int fAddBufs
Definition: sclLib.h:96
int Order
Definition: sclLib.h:198
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
void Bus_SclCheckSortedFanout(Vec_Ptr_t *vFanouts)
Definition: sclBufSize.c:295
float Abc_SclFindWireLoad(Vec_Flt_t *vWireCaps, int nFans)
Definition: sclLoad.c:94
ABC_DLL int Abc_NodeFindFanin(Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
Definition: abcUtil.c:758
static void Abc_SclObjSetCell(Abc_Obj_t *p, SC_Cell *pCell)
Definition: sclSize.h:111
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
void Bus_ManReadInOutLoads(Bus_Man_t *p)
Definition: sclBufSize.c:133
Abc_Obj_t * Abc_SclAddOneInv(Bus_Man_t *p, Abc_Obj_t *pObj, Vec_Ptr_t *vFanouts, float Gain)
Definition: sclBufSize.c:334
static void Vec_PtrSort(Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
Definition: vecPtr.h:851
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static void Vec_IntSetEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:418
static Vec_Flt_t * Vec_FltAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecFlt.h:78
void * pBSMan
Definition: abc.h:205
float Abc_NtkComputeFanoutLoad(Bus_Man_t *p, Vec_Ptr_t *vFanouts)
Definition: sclBufSize.c:214
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static float SC_CellPinCapAve(SC_Cell *p)
Definition: sclLib.h:244
static abctime Abc_Clock()
Definition: abc_global.h:279
static float Abc_NtkComputeEdgeDept(Abc_Obj_t *pFanout, int iFanin, float Slew)
Definition: sclBufSize.c:170
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static float Bus_SclObjETime(Abc_Obj_t *p)
Definition: sclBufSize.c:56
typedefABC_NAMESPACE_IMPL_START struct Bus_Man_t_ Bus_Man_t
DECLARATIONS ///.
Definition: sclBufSize.c:32
void Abc_NtkComputeFanoutInfo(Abc_Obj_t *pObj, float Slew)
Definition: sclBufSize.c:190
static void Vec_FltFill(Vec_Flt_t *p, int nSize, float Entry)
Definition: vecFlt.h:450
static float Bus_SclObjDept(Abc_Obj_t *p)
Definition: sclBufSize.c:60
static void Vec_FltFreeP(Vec_Flt_t **p)
Definition: vecFlt.h:235
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
static void Vec_FltPush(Vec_Flt_t *p, float Entry)
Definition: vecFlt.h:528
#define ABC_SWAP(Type, a, b)
Definition: abc_global.h:218
void Bus_ManStop(Bus_Man_t *p)
Definition: sclBufSize.c:111
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_NAMESPACE_IMPL_START Vec_Flt_t * Abc_SclFindWireCaps(SC_WireLoad *pWL, int nFanoutMax)
DECLARATIONS ///.
Definition: sclLoad.c:45
void Abc_SclReportDupFanins(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: sclBuffer.c:90
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition: abcFanio.c:172
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static float Abc_SclGetTotalArea(Abc_Ntk_t *pNtk)
Definition: sclSize.h:446
SC_WireLoad * Abc_SclFindWireLoadModel(SC_Lib *p, float Area)
Definition: sclLibUtil.c:247
static int Abc_MinInt(int a, int b)
Definition: abc_global.h:239
Abc_Ntk_t * Abc_SclBufferingPerform(Abc_Ntk_t *pNtk, SC_Lib *pLib, SC_BusPars *pPars)
Definition: sclBufSize.c:480
int fUseWireLoads
Definition: sclLib.h:98
void Abc_SclMioGates2SclGates(SC_Lib *pLib, Abc_Ntk_t *p)
DECLARATIONS ///.
Definition: sclUtil.c:47
float Abc_NtkComputeNodeDeparture(Abc_Obj_t *pObj, float Slew)
Definition: sclBufSize.c:180
void Abc_SclOneNodePrint(Bus_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBufSize.c:323
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeInv(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition: abcObj.c:662
float rise
Definition: sclLib.h:65
Vec_Flt_t * vDepts
Definition: sclBufSize.c:48
Vec_Ptr_t * vFanouts
Definition: sclBufSize.c:49
float fall
Definition: sclLib.h:66
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeBuf(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition: abcObj.c:692
SC_Cell * pAve
Definition: sclLib.h:197
static void Bus_SclObjUpdateDept(Abc_Obj_t *p, float time)
Definition: sclBufSize.c:61
int Id
Definition: sclLib.h:184
SC_Cell * Abc_SclFindSmallestGate(SC_Cell *p, float CinMin)
Definition: sclLibUtil.c:208
Vec_Int_t * vPhases
Definition: abc.h:208
char * pName
Definition: sclLib.h:183
static SC_Cell * SC_LibCell(SC_Lib *p, int i)
Definition: sclLib.h:240
void Abc_SclSclGates2MioGates(SC_Lib *pLib, Abc_Ntk_t *p)
Definition: sclUtil.c:73
ABC_DLL Abc_Ntk_t * Abc_NtkDupDfs(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:476
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
void Bus_SclInsertFanout(Vec_Ptr_t *vFanouts, Abc_Obj_t *pObj)
Definition: sclBufSize.c:275
static float Bus_SclObjLoad(Abc_Obj_t *p)
Definition: sclBufSize.c:58
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
Vec_Int_t vFanouts
Definition: abc.h:144
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
void Abc_NtkPrintFanoutProfileVec(Abc_Obj_t *pObj, Vec_Ptr_t *vFanouts)
Definition: sclBufSize.c:236
void Abc_SclBufSize(Bus_Man_t *p, float Gain)
Definition: sclBufSize.c:388
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define Vec_PtrForEachEntryStop(Type, vVec, pEntry, i, Stop)
Definition: vecPtr.h:59
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
SC_Cell * Abc_SclFindInvertor(SC_Lib *p, int fFindBuff)
Definition: sclLibUtil.c:197
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
int GainRatio
Definition: sclLib.h:92
static float SC_CellPinCap(SC_Cell *p, int i)
Definition: sclLib.h:243
int Abc_SclCellFind(SC_Lib *p, char *pName)
Definition: sclLibUtil.c:79
SC_WireLoad * Abc_SclFetchWireLoadModel(SC_Lib *p, char *pName)
Definition: sclLibUtil.c:230
#define ABC_FREE(obj)
Definition: abc_global.h:232
int Bus_SclCompareFanouts(Abc_Obj_t **pp1, Abc_Obj_t **pp2)
Definition: sclBufSize.c:262
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static void Bus_SclObjSetLoad(Abc_Obj_t *p, float cap)
Definition: sclBufSize.c:59
typedefABC_NAMESPACE_HEADER_START struct Vec_Flt_t_ Vec_Flt_t
INCLUDES ///.
Definition: vecFlt.h:42
static void Vec_PtrFreeP(Vec_Ptr_t **p)
Definition: vecPtr.h:240
SC_BusPars * pPars
Definition: sclBufSize.c:36
static Bus_Man_t * Bus_SclObjMan(Abc_Obj_t *p)
Definition: sclBufSize.c:53
Vec_Flt_t * vETimes
Definition: sclBufSize.c:46
#define assert(ex)
Definition: util_old.h:213
SC_Cell * pPrev
Definition: sclLib.h:195
static void Bus_SclObjSetETime(Abc_Obj_t *p, float time)
Definition: sclBufSize.c:57
static float Vec_FltEntry(Vec_Flt_t *p, int i)
Definition: vecFlt.h:342
ABC_DLL int Abc_NtkGetFanoutMax(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:464
static int Abc_ObjFaninPhase(Abc_Obj_t *p, int i)
Definition: abc.h:392
Vec_Flt_t * vLoads
Definition: sclBufSize.c:47
#define Abc_NtkForEachObjReverse(pNtk, pNode, i)
Definition: abc.h:449
static float Scl_LibPinArrivalEstimate(SC_Cell *pCell, int iPin, float Slew, float Load)
Definition: sclLib.h:578
ABC_DLL void Abc_NodeCollectFanouts(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcUtil.c:1607
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Bus_Man_t * Bus_ManStart(Abc_Ntk_t *pNtk, SC_Lib *pLib, SC_BusPars *pPars)
FUNCTION DEFINITIONS ///.
Definition: sclBufSize.c:78
ABC_INT64_T abctime
Definition: abc_global.h:278
static int Vec_FltSize(Vec_Flt_t *p)
Definition: vecFlt.h:294
static void Vec_PtrShrink(Vec_Ptr_t *p, int nSizeNew)
Definition: vecPtr.h:528
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
Vec_Flt_t * vCins
Definition: sclBufSize.c:45
float Abc_NtkComputeNodeLoad(Bus_Man_t *p, Abc_Obj_t *pObj)
Definition: sclBufSize.c:202
SC_Cell * pPiDrive
Definition: sclBufSize.c:38
char * pWLoadUsed
Definition: abc.h:209
SC_WireLoad * pWLoadUsed
Definition: sclBufSize.c:42
static void ** Vec_PtrArray(Vec_Ptr_t *p)
Definition: vecPtr.h:279
void Abc_NodeInvUpdateFanPolarity(Abc_Obj_t *pObj)
Definition: sclBuffer.c:320
SC_Lib * pLib
Definition: sclBufSize.c:40
Abc_Ntk_t * pNtk
Definition: sclBufSize.c:37
static SC_Cell * Abc_SclObjCell(Abc_Obj_t *p)
Definition: sclSize.h:110
static void Scl_LibHandleInputDriver(SC_Cell *pCell, SC_Pair *pLoadIn, SC_Pair *pArrOut, SC_Pair *pSlewOut)
Definition: sclLib.h:591