abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
sclSize.h File Reference
#include "base/abc/abc.h"
#include "misc/vec/vecQue.h"
#include "misc/vec/vecWec.h"
#include "sclLib.h"

Go to the source code of this file.

Data Structures

struct  SC_Man_
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct SC_Man_ 
SC_Man
 INCLUDES ///. More...
 

Functions

static SC_LibAbc_SclObjLib (Abc_Obj_t *p)
 GLOBAL VARIABLES ///. More...
 
static int Abc_SclObjCellId (Abc_Obj_t *p)
 
static SC_CellAbc_SclObjCell (Abc_Obj_t *p)
 
static void Abc_SclObjSetCell (Abc_Obj_t *p, SC_Cell *pCell)
 
static SC_PairAbc_SclObjLoad (SC_Man *p, Abc_Obj_t *pObj)
 
static SC_PairAbc_SclObjDept (SC_Man *p, Abc_Obj_t *pObj)
 
static SC_PairAbc_SclObjTime (SC_Man *p, Abc_Obj_t *pObj)
 
static SC_PairAbc_SclObjSlew (SC_Man *p, Abc_Obj_t *pObj)
 
static double Abc_SclObjLoadMax (SC_Man *p, Abc_Obj_t *pObj)
 
static float Abc_SclObjLoadAve (SC_Man *p, Abc_Obj_t *pObj)
 
static double Abc_SclObjTimeOne (SC_Man *p, Abc_Obj_t *pObj, int fRise)
 
static float Abc_SclObjTimeMax (SC_Man *p, Abc_Obj_t *pObj)
 
static double Abc_SclObjSlewMax (SC_Man *p, Abc_Obj_t *pObj)
 
static float Abc_SclObjGetSlackR (SC_Man *p, Abc_Obj_t *pObj, float D)
 
static float Abc_SclObjGetSlackF (SC_Man *p, Abc_Obj_t *pObj, float D)
 
static float Abc_SclObjGetSlack (SC_Man *p, Abc_Obj_t *pObj, float D)
 
static double Abc_SclObjSlackMax (SC_Man *p, Abc_Obj_t *pObj, float D)
 
static void Abc_SclObjDupFanin (SC_Man *p, Abc_Obj_t *pObj)
 
static float Abc_SclObjInDrive (SC_Man *p, Abc_Obj_t *pObj)
 
static void Abc_SclObjSetInDrive (SC_Man *p, Abc_Obj_t *pObj, float c)
 
static SC_ManAbc_SclManAlloc (SC_Lib *pLib, Abc_Ntk_t *pNtk)
 FUNCTION DEFINITIONS ///. More...
 
static void Abc_SclManFree (SC_Man *p)
 
static void Abc_SclManCleanTime (SC_Man *p)
 
static void Abc_SclLoadStore (SC_Man *p, Abc_Obj_t *pObj)
 
static void Abc_SclLoadRestore (SC_Man *p, Abc_Obj_t *pObj)
 
static void Abc_SclLoadStore3 (SC_Man *p, Abc_Obj_t *pObj)
 
static void Abc_SclLoadRestore3 (SC_Man *p, Abc_Obj_t *pObj)
 
static void Abc_SclConeStore (SC_Man *p, Vec_Int_t *vCone)
 
static void Abc_SclConeRestore (SC_Man *p, Vec_Int_t *vCone)
 
static void Abc_SclEvalStore (SC_Man *p, Vec_Int_t *vCone)
 
static float Abc_SclEvalPerform (SC_Man *p, Vec_Int_t *vCone)
 
static float Abc_SclEvalPerformLegal (SC_Man *p, Vec_Int_t *vCone, float D)
 
static void Abc_SclConeClean (SC_Man *p, Vec_Int_t *vCone)
 
static int Abc_SclGetBufInvCount (Abc_Ntk_t *pNtk)
 
static float Abc_SclGetAverageSize (Abc_Ntk_t *pNtk)
 
static float Abc_SclGetTotalArea (Abc_Ntk_t *pNtk)
 
static float Abc_SclGetMaxDelay (SC_Man *p)
 
static float Abc_SclGetMaxDelayNodeFanins (SC_Man *p, Abc_Obj_t *pNode)
 
static float Abc_SclReadMaxDelay (SC_Man *p)
 
static SC_CellAbc_SclObjResiable (SC_Man *p, Abc_Obj_t *pObj, int fUpsize)
 
static void Abc_SclDumpStats (SC_Man *p, char *pFileName, abctime Time)
 
Abc_Ntk_tAbc_SclBufferingPerform (Abc_Ntk_t *pNtk, SC_Lib *pLib, SC_BusPars *pPars)
 
int Abc_SclIsInv (Abc_Obj_t *pObj)
 
void Abc_NodeInvUpdateFanPolarity (Abc_Obj_t *pObj)
 
void Abc_NodeInvUpdateObjFanoutPolarity (Abc_Obj_t *pObj, Abc_Obj_t *pFanout)
 
void Abc_SclReportDupFanins (Abc_Ntk_t *pNtk)
 FUNCTION DEFINITIONS ///. More...
 
Abc_Ntk_tAbc_SclUnBufferPerform (Abc_Ntk_t *pNtk, int fVerbose)
 
Abc_Ntk_tAbc_SclUnBufferPhase (Abc_Ntk_t *pNtk, int fVerbose)
 
Abc_Ntk_tAbc_SclBufferPhase (Abc_Ntk_t *pNtk, int fVerbose)
 
int Abc_SclCheckNtk (Abc_Ntk_t *p, int fVerbose)
 
Abc_Ntk_tAbc_SclPerformBuffering (Abc_Ntk_t *p, int DegreeR, int Degree, int fUseInvs, int fVerbose)
 
Abc_Ntk_tAbc_SclBufPerform (Abc_Ntk_t *pNtk, int FanMin, int FanMax, int fBufPis, int fSkipDup, int fVerbose)
 
void Abc_SclDnsizePerform (SC_Lib *pLib, Abc_Ntk_t *pNtk, SC_SizePars *pPars)
 
Vec_Flt_tAbc_SclFindWireCaps (SC_WireLoad *pWL, int nFanoutMax)
 DECLARATIONS ///. More...
 
float Abc_SclFindWireLoad (Vec_Flt_t *vWireCaps, int nFans)
 
void Abc_SclAddWireLoad (SC_Man *p, Abc_Obj_t *pObj, int fSubtr)
 
void Abc_SclComputeLoad (SC_Man *p)
 
void Abc_SclUpdateLoad (SC_Man *p, Abc_Obj_t *pObj, SC_Cell *pOld, SC_Cell *pNew)
 
void Abc_SclUpdateLoadSplit (SC_Man *p, Abc_Obj_t *pBuffer, Abc_Obj_t *pFanout)
 
Abc_Obj_tAbc_SclFindCriticalCo (SC_Man *p, int *pfRise)
 DECLARATIONS ///. More...
 
Abc_Obj_tAbc_SclFindMostCriticalFanin (SC_Man *p, int *pfRise, Abc_Obj_t *pNode)
 
void Abc_SclTimeNtkPrint (SC_Man *p, int fShowAll, int fPrintPath)
 
SC_ManAbc_SclManStart (SC_Lib *pLib, Abc_Ntk_t *pNtk, int fUseWireLoads, int fDept, float DUser, int nTreeCRatio)
 
void Abc_SclTimeCone (SC_Man *p, Vec_Int_t *vCone)
 
void Abc_SclTimeNtkRecompute (SC_Man *p, float *pArea, float *pDelay, int fReverse, float DUser)
 
int Abc_SclTimeIncUpdate (SC_Man *p)
 
void Abc_SclTimeIncInsert (SC_Man *p, Abc_Obj_t *pObj)
 
void Abc_SclTimeIncUpdateLevel (Abc_Obj_t *pObj)
 
void Abc_SclTimePerform (SC_Lib *pLib, Abc_Ntk_t *pNtk, int nTreeCRatio, int fUseWireLoads, int fShowAll, int fPrintPath, int fDumpStats)
 
void Abc_SclPrintBuffers (SC_Lib *pLib, Abc_Ntk_t *pNtk, int fVerbose)
 
int Abc_SclCountNearCriticalNodes (SC_Man *p)
 
void Abc_SclUpsizePerform (SC_Lib *pLib, Abc_Ntk_t *pNtk, SC_SizePars *pPars)
 
void Abc_SclMioGates2SclGates (SC_Lib *pLib, Abc_Ntk_t *p)
 DECLARATIONS ///. More...
 
void Abc_SclSclGates2MioGates (SC_Lib *pLib, Abc_Ntk_t *p)
 
void Abc_SclPrintGateSizes (SC_Lib *pLib, Abc_Ntk_t *p)
 
void Abc_SclMinsizePerform (SC_Lib *pLib, Abc_Ntk_t *p, int fUseMax, int fVerbose)
 
int Abc_SclCountMinSize (SC_Lib *pLib, Abc_Ntk_t *p, int fUseMax)
 
Vec_Int_tAbc_SclExtractBarBufs (Abc_Ntk_t *pNtk)
 
void Abc_SclInsertBarBufs (Abc_Ntk_t *pNtk, Vec_Int_t *vBufs)
 

Typedef Documentation

typedef typedefABC_NAMESPACE_HEADER_START struct SC_Man_ SC_Man

INCLUDES ///.

CFile****************************************************************

FileName [sclSize.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Standard-cell library representation.]

Synopsis [Timing/gate-sizing manager.]

Author [Alan Mishchenko, Niklas Een]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - August 24, 2012.]

Revision [

Id:
sclSize.h,v 1.0 2012/08/24 00:00:00 alanmi Exp

]PARAMETERS ///STRUCTURE DEFINITIONS ///

Definition at line 44 of file sclSize.h.

Function Documentation

void Abc_NodeInvUpdateFanPolarity ( Abc_Obj_t pObj)

Function*************************************************************

Synopsis [Performs buffering of the mapped network (old code).]

Description []

SideEffects []

SeeAlso []

Definition at line 320 of file sclBuffer.c.

321 {
322  Abc_Obj_t * pFanout;
323  int i;
324  assert( Abc_ObjFaninNum(pObj) == 0 || Abc_SclObjIsBufInv(pObj) );
325  Abc_ObjForEachFanout( pObj, pFanout, i )
326  {
327  assert( Abc_ObjFaninNum(pFanout) > 0 );
328  if ( Abc_SclObjIsBufInv(pFanout) )
329  Abc_NodeInvUpdateFanPolarity( pFanout );
330  else
331  Abc_ObjFaninFlipPhase( pFanout, Abc_NodeFindFanin(pFanout, pObj) );
332  }
333 }
ABC_DLL int Abc_NodeFindFanin(Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
Definition: abcUtil.c:758
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
static int Abc_SclObjIsBufInv(Abc_Obj_t *pObj)
Definition: sclBuffer.c:112
#define assert(ex)
Definition: util_old.h:213
static void Abc_ObjFaninFlipPhase(Abc_Obj_t *p, int i)
Definition: abc.h:393
void Abc_NodeInvUpdateFanPolarity(Abc_Obj_t *pObj)
Definition: sclBuffer.c:320
void Abc_NodeInvUpdateObjFanoutPolarity ( Abc_Obj_t pObj,
Abc_Obj_t pFanout 
)

Definition at line 334 of file sclBuffer.c.

335 {
336  if ( Abc_SclObjIsBufInv(pFanout) )
337  Abc_NodeInvUpdateFanPolarity( pFanout );
338  else
339  Abc_ObjFaninFlipPhase( pFanout, Abc_NodeFindFanin(pFanout, pObj) );
340 }
ABC_DLL int Abc_NodeFindFanin(Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
Definition: abcUtil.c:758
static int Abc_SclObjIsBufInv(Abc_Obj_t *pObj)
Definition: sclBuffer.c:112
static void Abc_ObjFaninFlipPhase(Abc_Obj_t *p, int i)
Definition: abc.h:393
void Abc_NodeInvUpdateFanPolarity(Abc_Obj_t *pObj)
Definition: sclBuffer.c:320
void Abc_SclAddWireLoad ( SC_Man p,
Abc_Obj_t pObj,
int  fSubtr 
)

Definition at line 100 of file sclLoad.c.

101 {
102  float Load = Abc_SclFindWireLoad( p->vWireCaps, Abc_ObjFanoutNum(pObj) );
103  Abc_SclObjLoad(p, pObj)->rise += fSubtr ? -Load : Load;
104  Abc_SclObjLoad(p, pObj)->fall += fSubtr ? -Load : Load;
105 }
static SC_Pair * Abc_SclObjLoad(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:113
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
float Abc_SclFindWireLoad(Vec_Flt_t *vWireCaps, int nFans)
Definition: sclLoad.c:94
float rise
Definition: sclLib.h:65
float fall
Definition: sclLib.h:66
Abc_Ntk_t* Abc_SclBufferingPerform ( Abc_Ntk_t pNtk,
SC_Lib pLib,
SC_BusPars pPars 
)

Definition at line 480 of file sclBufSize.c.

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 }
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
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
void Bus_ManReadInOutLoads(Bus_Man_t *p)
Definition: sclBufSize.c:133
typedefABC_NAMESPACE_IMPL_START struct Bus_Man_t_ Bus_Man_t
DECLARATIONS ///.
Definition: sclBufSize.c:32
void Bus_ManStop(Bus_Man_t *p)
Definition: sclBufSize.c:111
void Abc_SclReportDupFanins(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: sclBuffer.c:90
void Abc_SclMioGates2SclGates(SC_Lib *pLib, Abc_Ntk_t *p)
DECLARATIONS ///.
Definition: sclUtil.c:47
Vec_Int_t * vPhases
Definition: abc.h:208
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
void Abc_SclBufSize(Bus_Man_t *p, float Gain)
Definition: sclBufSize.c:388
int GainRatio
Definition: sclLib.h:92
Bus_Man_t * Bus_ManStart(Abc_Ntk_t *pNtk, SC_Lib *pLib, SC_BusPars *pPars)
FUNCTION DEFINITIONS ///.
Definition: sclBufSize.c:78
Abc_Ntk_t* Abc_SclBufferPhase ( Abc_Ntk_t pNtk,
int  fVerbose 
)

Definition at line 198 of file sclBuffer.c.

199 {
200  Abc_Ntk_t * pNtkNew;
201  Vec_Int_t * vInvs;
202  Abc_Obj_t * pObj, * pFanin, * pFaninNew;
203  int nNodesOld = Abc_NtkObjNumMax(pNtk);
204  int i, k, Counter = 0, Counter2 = 0, Total = 0;
205  assert( pNtk->vPhases != NULL );
206  vInvs = Vec_IntStart( Abc_NtkObjNumMax(pNtk) );
207  Abc_NtkForEachNodeCo( pNtk, pObj, i )
208  {
209  if ( i >= nNodesOld )
210  break;
211  Abc_ObjForEachFanin( pObj, pFanin, k )
212  {
213  Total++;
214  if ( !Abc_ObjFaninPhase(pObj, k) )
215  continue;
216  if ( Vec_IntEntry(vInvs, Abc_ObjId(pFanin)) == 0 || Abc_ObjIsCi(pFanin) ) // allow PIs to have high fanout - to be fixed later
217  {
218  pFaninNew = Abc_NtkCreateNodeInv( pNtk, pFanin );
219  Vec_IntWriteEntry( vInvs, Abc_ObjId(pFanin), Abc_ObjId(pFaninNew) );
220  Counter++;
221  }
222  pFaninNew = Abc_NtkObj( pNtk, Vec_IntEntry(vInvs, Abc_ObjId(pFanin)) );
223  Abc_ObjPatchFanin( pObj, pFanin, pFaninNew );
224  Counter2++;
225  }
226  }
227  if ( fVerbose )
228  printf( "Added %d inverters (%.2f %% fanins) (%.2f %% compl fanins).\n",
229  Counter, 100.0 * Counter / Total, 100.0 * Counter2 / Total );
230  Vec_IntFree( vInvs );
231  Vec_IntFillExtra( pNtk->vPhases, Abc_NtkObjNumMax(pNtk), 0 );
232  // duplicate network in topo order
233  vInvs = pNtk->vPhases;
234  pNtk->vPhases = NULL;
235  pNtkNew = Abc_NtkDupDfs( pNtk );
236  pNtk->vPhases = vInvs;
237  return pNtkNew;
238 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static void Vec_IntFillExtra(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:376
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition: abcFanio.c:172
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeInv(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition: abcObj.c:662
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Vec_Int_t * vPhases
Definition: abc.h:208
static int Counter
ABC_DLL Abc_Ntk_t * Abc_NtkDupDfs(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:476
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
#define Abc_NtkForEachNodeCo(pNtk, pNode, i)
Definition: abc.h:491
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjFaninPhase(Abc_Obj_t *p, int i)
Definition: abc.h:392
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Abc_Ntk_t* Abc_SclBufPerform ( Abc_Ntk_t pNtk,
int  FanMin,
int  FanMax,
int  fBufPis,
int  fSkipDup,
int  fVerbose 
)

Definition at line 984 of file sclBuffer.c.

985 {
986  Abc_Ntk_t * pNew;
987  Buf_Man_t * p = Buf_ManStart( pNtk, FanMin, FanMax, fBufPis );
988  int i, Limit = ABC_INFINITY;
989  Abc_NtkLevel( pNtk );
990 // if ( Abc_NtkNodeNum(pNtk) < 1000 )
991 // fSkipDup = 1;
992  for ( i = 0; i < Limit && Vec_QueSize(p->vQue); i++ )
993  Abc_BufPerformOne( p, Vec_QuePop(p->vQue), fSkipDup, fVerbose );
994  Buf_ManStop( p );
995 // Abc_BufReplaceBufsByInvs( pNtk );
996  // duplicate network in topo order
997  pNew = Abc_NtkDupDfs( pNtk );
998  Abc_SclCheckNtk( pNew, fVerbose );
999  return pNew;
1000 }
Buf_Man_t * Buf_ManStart(Abc_Ntk_t *pNtk, int FanMin, int FanMax, int fBufPis)
Definition: sclBuffer.c:669
void Abc_BufPerformOne(Buf_Man_t *p, int iPivot, int fSkipDup, int fVerbose)
Definition: sclBuffer.c:867
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Abc_SclCheckNtk(Abc_Ntk_t *p, int fVerbose)
Definition: sclBuffer.c:286
static int Vec_QuePop(Vec_Que_t *p)
Definition: vecQue.h:234
static int Vec_QueSize(Vec_Que_t *p)
Definition: vecQue.h:134
void Buf_ManStop(Buf_Man_t *p)
Definition: sclBuffer.c:723
Vec_Que_t * vQue
Definition: sclBuffer.c:47
ABC_DLL Abc_Ntk_t * Abc_NtkDupDfs(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:476
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1265
int Abc_SclCheckNtk ( Abc_Ntk_t p,
int  fVerbose 
)

Function*************************************************************

Synopsis [Make sure the network is in topo order without dangling nodes.]

Description [Returns 1 iff the network is fine.]

SideEffects []

SeeAlso []

Definition at line 286 of file sclBuffer.c.

287 {
288  Abc_Obj_t * pObj, * pFanin;
289  int i, k, fFlag = 1;
291  Abc_NtkForEachCi( p, pObj, i )
292  Abc_NodeSetTravIdCurrent( pObj );
293  Abc_NtkForEachNode( p, pObj, i )
294  {
295  Abc_ObjForEachFanin( pObj, pFanin, k )
296  if ( !Abc_NodeIsTravIdCurrent( pFanin ) )
297  printf( "obj %d and its fanin %d are not in the topo order\n", Abc_ObjId(pObj), Abc_ObjId(pFanin) ), fFlag = 0;
298  Abc_NodeSetTravIdCurrent( pObj );
299  if ( Abc_ObjFanoutNum(pObj) == 0 )
300  printf( "node %d has no fanout\n", Abc_ObjId(pObj) ), fFlag = 0;
301  if ( !fFlag )
302  break;
303  }
304  if ( fFlag && fVerbose )
305  printf( "The network is in topo order and no dangling nodes.\n" );
306  return fFlag;
307 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
ConcreteCell * obj
Definition: place_test.c:26
if(last==0)
Definition: sparse_int.h:34
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
void Abc_SclComputeLoad ( SC_Man p)

Definition at line 106 of file sclLoad.c.

107 {
108  Abc_Obj_t * pObj, * pFanin;
109  int i, k;
110  // clear load storage
111  Abc_NtkForEachObj( p->pNtk, pObj, i )
112  {
113  SC_Pair * pLoad = Abc_SclObjLoad( p, pObj );
114  if ( !Abc_ObjIsPo(pObj) )
115  pLoad->rise = pLoad->fall = 0.0;
116  }
117  // add cell load
118  Abc_NtkForEachNode1( p->pNtk, pObj, i )
119  {
120  SC_Cell * pCell = Abc_SclObjCell( pObj );
121  Abc_ObjForEachFanin( pObj, pFanin, k )
122  {
123  SC_Pair * pLoad = Abc_SclObjLoad( p, pFanin );
124  SC_Pin * pPin = SC_CellPin( pCell, k );
125  pLoad->rise += pPin->rise_cap;
126  pLoad->fall += pPin->fall_cap;
127  }
128  }
129  // add PO load
130  Abc_NtkForEachCo( p->pNtk, pObj, i )
131  {
132  SC_Pair * pLoadPo = Abc_SclObjLoad( p, pObj );
133  SC_Pair * pLoad = Abc_SclObjLoad( p, Abc_ObjFanin0(pObj) );
134  pLoad->rise += pLoadPo->rise;
135  pLoad->fall += pLoadPo->fall;
136  }
137  // add wire load
138  if ( p->pWLoadUsed != NULL )
139  {
140  if ( p->vWireCaps == NULL )
141  p->vWireCaps = Abc_SclFindWireCaps( p->pWLoadUsed, Abc_NtkGetFanoutMax(p->pNtk) );
142  Abc_NtkForEachNode1( p->pNtk, pObj, i )
143  Abc_SclAddWireLoad( p, pObj, 0 );
144  Abc_NtkForEachPi( p->pNtk, pObj, i )
145  Abc_SclAddWireLoad( p, pObj, 0 );
146  }
147  // check input loads
148  if ( p->vInDrive != NULL )
149  {
150  Abc_NtkForEachPi( p->pNtk, pObj, i )
151  {
152  SC_Pair * pLoad = Abc_SclObjLoad( p, pObj );
153  if ( Abc_SclObjInDrive(p, pObj) != 0 && (pLoad->rise > Abc_SclObjInDrive(p, pObj) || pLoad->fall > Abc_SclObjInDrive(p, pObj)) )
154  printf( "Maximum input drive strength is exceeded at primary input %d.\n", i );
155  }
156  }
157 /*
158  // transfer load from barbufs
159  Abc_NtkForEachBarBuf( p->pNtk, pObj, i )
160  {
161  SC_Pair * pLoad = Abc_SclObjLoad( p, pObj );
162  SC_Pair * pLoadF = Abc_SclObjLoad( p, Abc_ObjFanin(pObj, 0) );
163  SC_PairAdd( pLoadF, pLoad );
164  }
165 */
166  // calculate average load
167 // if ( p->EstLoadMax )
168  {
169  double TotalLoad = 0;
170  int nObjs = 0;
171  Abc_NtkForEachNode1( p->pNtk, pObj, i )
172  {
173  SC_Pair * pLoad = Abc_SclObjLoad( p, pObj );
174  TotalLoad += 0.5 * pLoad->fall + 0.5 * pLoad->rise;
175  nObjs++;
176  }
177  Abc_NtkForEachPi( p->pNtk, pObj, i )
178  {
179  SC_Pair * pLoad = Abc_SclObjLoad( p, pObj );
180  TotalLoad += 0.5 * pLoad->fall + 0.5 * pLoad->rise;
181  nObjs++;
182  }
183  p->EstLoadAve = (float)(TotalLoad / nObjs);
184 // printf( "Average load = %.2f\n", p->EstLoadAve );
185  }
186 }
#define Abc_NtkForEachNode1(pNtk, pNode, i)
Definition: abc.h:467
static SC_Pair * Abc_SclObjLoad(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:113
static Llb_Mgr_t * p
Definition: llb3Image.c:950
float fall_cap
Definition: sclLib.h:173
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static float Abc_SclObjInDrive(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:128
ABC_NAMESPACE_IMPL_START Vec_Flt_t * Abc_SclFindWireCaps(SC_WireLoad *pWL, int nFanoutMax)
DECLARATIONS ///.
Definition: sclLoad.c:45
float rise
Definition: sclLib.h:65
float fall
Definition: sclLib.h:66
if(last==0)
Definition: sparse_int.h:34
static SC_Pin * SC_CellPin(SC_Cell *p, int i)
Definition: sclLib.h:241
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
void Abc_SclAddWireLoad(SC_Man *p, Abc_Obj_t *pObj, int fSubtr)
Definition: sclLoad.c:100
static int Abc_ObjIsPo(Abc_Obj_t *pObj)
Definition: abc.h:348
ABC_DLL int Abc_NtkGetFanoutMax(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:464
float rise_cap
Definition: sclLib.h:172
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
static SC_Cell * Abc_SclObjCell(Abc_Obj_t *p)
Definition: sclSize.h:110
static void Abc_SclConeClean ( SC_Man p,
Vec_Int_t vCone 
)
inlinestatic

Definition at line 406 of file sclSize.h.

407 {
408  SC_Pair Zero = { 0.0, 0.0 };
409  Abc_Obj_t * pObj;
410  int i;
411  Abc_NtkForEachObjVec( vCone, p->pNtk, pObj, i )
412  {
413  *Abc_SclObjTime(p, pObj) = Zero;
414  *Abc_SclObjSlew(p, pObj) = Zero;
415  }
416 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static SC_Pair * Abc_SclObjTime(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:115
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
Definition: abc.h:452
static SC_Pair * Abc_SclObjSlew(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:116
static void Abc_SclConeRestore ( SC_Man p,
Vec_Int_t vCone 
)
inlinestatic

Definition at line 352 of file sclSize.h.

353 {
354  Abc_Obj_t * pObj;
355  int i, k = 0;
356  Abc_NtkForEachObjVec( vCone, p->pNtk, pObj, i )
357  {
358  Abc_SclObjTime(p, pObj)->rise = Vec_FltEntry(p->vTimes2, k++);
359  Abc_SclObjTime(p, pObj)->fall = Vec_FltEntry(p->vTimes2, k++);
360  Abc_SclObjSlew(p, pObj)->rise = Vec_FltEntry(p->vTimes2, k++);
361  Abc_SclObjSlew(p, pObj)->fall = Vec_FltEntry(p->vTimes2, k++);
362  }
363  assert( Vec_FltSize(p->vTimes2) == k );
364 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static SC_Pair * Abc_SclObjTime(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:115
float rise
Definition: sclLib.h:65
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
Definition: abc.h:452
float fall
Definition: sclLib.h:66
static SC_Pair * Abc_SclObjSlew(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:116
#define assert(ex)
Definition: util_old.h:213
static float Vec_FltEntry(Vec_Flt_t *p, int i)
Definition: vecFlt.h:342
static int Vec_FltSize(Vec_Flt_t *p)
Definition: vecFlt.h:294
static void Abc_SclConeStore ( SC_Man p,
Vec_Int_t vCone 
)
inlinestatic

Definition at line 339 of file sclSize.h.

340 {
341  Abc_Obj_t * pObj;
342  int i;
343  Vec_FltClear( p->vTimes2 );
344  Abc_NtkForEachObjVec( vCone, p->pNtk, pObj, i )
345  {
346  Vec_FltPush( p->vTimes2, Abc_SclObjTime(p, pObj)->rise );
347  Vec_FltPush( p->vTimes2, Abc_SclObjTime(p, pObj)->fall );
348  Vec_FltPush( p->vTimes2, Abc_SclObjSlew(p, pObj)->rise );
349  Vec_FltPush( p->vTimes2, Abc_SclObjSlew(p, pObj)->fall );
350  }
351 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_FltPush(Vec_Flt_t *p, float Entry)
Definition: vecFlt.h:528
static void Vec_FltClear(Vec_Flt_t *p)
Definition: vecFlt.h:512
static SC_Pair * Abc_SclObjTime(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:115
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
Definition: abc.h:452
static SC_Pair * Abc_SclObjSlew(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:116
int Abc_SclCountMinSize ( SC_Lib pLib,
Abc_Ntk_t p,
int  fUseMax 
)

Definition at line 203 of file sclUtil.c.

204 {
205  Vec_Int_t * vMinCells;
206  Abc_Obj_t * pObj;
207  int i, gateId, Counter = 0;
208  vMinCells = Abc_SclFindMinAreas( pLib, fUseMax );
209  Abc_NtkForEachNode1( p, pObj, i )
210  {
211  gateId = Vec_IntEntry( p->vGates, i );
212  Counter += ( gateId == Vec_IntEntry(vMinCells, gateId) );
213  }
214  Vec_IntFree( vMinCells );
215  return Counter;
216 }
#define Abc_NtkForEachNode1(pNtk, pNode, i)
Definition: abc.h:467
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Int_t * Abc_SclFindMinAreas(SC_Lib *pLib, int fUseMax)
Definition: sclUtil.c:170
Vec_Int_t * vGates
Definition: abc.h:207
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Counter
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
int Abc_SclCountNearCriticalNodes ( SC_Man p)

Definition at line 187 of file sclUpsize.c.

188 {
189  int RetValue;
190  Vec_Int_t * vPathPos, * vPathNodes;
191  vPathPos = Abc_SclFindCriticalCoWindow( p, 5 );
192  vPathNodes = Abc_SclFindCriticalNodeWindow( p, vPathPos, 5, 0 );
193  RetValue = Vec_IntSize(vPathNodes);
194  Abc_SclUnmarkCriticalNodeWindow( p, vPathNodes );
195  Abc_SclUnmarkCriticalNodeWindow( p, vPathPos );
196  Vec_IntFree( vPathPos );
197  Vec_IntFree( vPathNodes );
198  return RetValue;
199 }
Vec_Int_t * Abc_SclFindCriticalNodeWindow(SC_Man *p, Vec_Int_t *vPathCos, int Window, int fDept)
Definition: sclUpsize.c:159
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Int_t * Abc_SclFindCriticalCoWindow(SC_Man *p, int Window)
Definition: sclUpsize.c:98
void Abc_SclUnmarkCriticalNodeWindow(SC_Man *p, Vec_Int_t *vPath)
Definition: sclUpsize.c:180
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
void Abc_SclDnsizePerform ( SC_Lib pLib,
Abc_Ntk_t pNtk,
SC_SizePars pPars 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 242 of file sclDnsize.c.

243 {
244  SC_Man * p;
245  Abc_Obj_t * pObj;
246  Vec_Int_t * vNodes, * vEvals, * vTryLater;
247  abctime clk, nRuntimeLimit = pPars->TimeOut ? pPars->TimeOut * CLOCKS_PER_SEC + Abc_Clock() : 0;
248  int i, k;
249 
250  if ( pPars->fVerbose )
251  {
252  printf( "Parameters: " );
253  printf( "Iters =%5d. ", pPars->nIters );
254  printf( "UseDept =%2d. ", pPars->fUseDept );
255  printf( "UseWL =%2d. ", pPars->fUseWireLoads );
256  printf( "Target =%5d ps. ", pPars->DelayUser );
257  printf( "DelayGap =%3d ps. ", pPars->DelayGap );
258  printf( "Timeout =%4d sec", pPars->TimeOut );
259  printf( "\n" );
260  }
261 
262  // prepare the manager; collect init stats
263  p = Abc_SclManStart( pLib, pNtk, pPars->fUseWireLoads, pPars->fUseDept, pPars->DelayUser, pPars->BuffTreeEst );
264  p->timeTotal = Abc_Clock();
265  assert( p->vGatesBest == NULL );
266  p->vGatesBest = Vec_IntDup( p->pNtk->vGates );
267 
268  // perform upsizing
269  vNodes = Vec_IntAlloc( 1000 );
270  vEvals = Vec_IntAlloc( 1000 );
271  vTryLater = Vec_IntAlloc( 1000 );
272  for ( i = 0; i < pPars->nIters; i++ )
273  {
274  int nRounds = 0;
275  int nAttemptAll = 0, nOverlapAll = 0, nChangesAll = 0;
276  Abc_NtkCollectNodesByArea( p, pNtk );
277  while ( Vec_QueSize(p->vNodeByGain) > 0 )
278  {
279  int nAttempt = 0, nOverlap = 0, nChanges = 0;
280  Vec_IntClear( vTryLater );
281  Abc_NtkIncrementTravId( pNtk );
282  while ( Vec_QueSize(p->vNodeByGain) > 0 )
283  {
284  clk = Abc_Clock();
285  pObj = Abc_NtkObj( p->pNtk, Vec_QuePop(p->vNodeByGain) );
286  Abc_SclFindWindow( pObj, &vNodes, &vEvals );
287  p->timeCone += Abc_Clock() - clk;
288  if ( Abc_SclCheckOverlap( p->pNtk, vNodes ) )
289  nOverlap++, Vec_IntPush( vTryLater, Abc_ObjId(pObj) );
290  else
291  nChanges += Abc_SclCheckImprovement( p, pObj, vNodes, vEvals, pPars->Notches, pPars->DelayGap );
292  nAttempt++;
293  }
294  Abc_NtkForEachObjVec( vTryLater, pNtk, pObj, k )
295  Vec_QuePush( p->vNodeByGain, Abc_ObjId(pObj) );
296 
297  clk = Abc_Clock();
298  if ( Vec_IntSize(p->vChanged) )
300  else
301  Abc_SclTimeNtkRecompute( p, &p->SumArea, &p->MaxDelay, pPars->fUseDept, pPars->DelayUser );
302  p->timeTime += Abc_Clock() - clk;
303 
304  p->MaxDelay = Abc_SclReadMaxDelay( p );
305  if ( pPars->fUseDept && pPars->DelayUser > 0 && p->MaxDelay < pPars->DelayUser )
306  p->MaxDelay = pPars->DelayUser;
307  Abc_SclDnsizePrint( p, nRounds++, nAttempt, nOverlap, nChanges, pPars->fVeryVerbose );
308  nAttemptAll += nAttempt; nOverlapAll += nOverlap; nChangesAll += nChanges;
309  if ( nRuntimeLimit && Abc_Clock() > nRuntimeLimit )
310  break;
311  }
312  // recompute
313 // Abc_SclTimeNtkRecompute( p, &p->SumArea, &p->MaxDelay, pPars->fUseDept, pPars->DelayUser );
314  if ( pPars->fVerbose )
315  Abc_SclDnsizePrint( p, -1, nAttemptAll, nOverlapAll, nChangesAll, 1 );
316  if ( nRuntimeLimit && Abc_Clock() > nRuntimeLimit )
317  break;
318  if ( nAttemptAll == 0 )
319  break;
320  }
321  Vec_IntFree( vNodes );
322  Vec_IntFree( vEvals );
323  Vec_IntFree( vTryLater );
324  if ( !pPars->fVerbose )
325  printf( " \r" );
326 
327  // report runtime
328  p->timeTotal = Abc_Clock() - p->timeTotal;
329  if ( pPars->fVerbose )
330  {
331  p->timeOther = p->timeTotal - p->timeCone - p->timeSize - p->timeTime;
332  ABC_PRTP( "Runtime: Critical path", p->timeCone, p->timeTotal );
333  ABC_PRTP( "Runtime: Sizing eval ", p->timeSize, p->timeTotal );
334  ABC_PRTP( "Runtime: Timing update", p->timeTime, p->timeTotal );
335  ABC_PRTP( "Runtime: Other ", p->timeOther, p->timeTotal );
336  ABC_PRTP( "Runtime: TOTAL ", p->timeTotal, p->timeTotal );
337  }
338  if ( pPars->fDumpStats )
339  Abc_SclDumpStats( p, "stats2.txt", p->timeTotal );
340  if ( nRuntimeLimit && Abc_Clock() > nRuntimeLimit )
341  printf( "Gate sizing timed out at %d seconds.\n", pPars->TimeOut );
342 
343  // save the result and quit
344  Abc_SclSclGates2MioGates( pLib, pNtk ); // updates gate pointers
345  Abc_SclManFree( p );
346 // Abc_NtkCleanMarkAB( pNtk );
347 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static float Abc_SclReadMaxDelay(SC_Man *p)
Definition: sclSize.h:474
void Abc_SclTimeNtkRecompute(SC_Man *p, float *pArea, float *pDelay, int fReverse, float DUser)
Definition: sclSize.c:400
ABC_NAMESPACE_IMPL_START void Abc_SclFindWindow(Abc_Obj_t *pPivot, Vec_Int_t **pvNodes, Vec_Int_t **pvEvals)
DECLARATIONS ///.
Definition: sclDnsize.c:45
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int DelayGap
Definition: sclLib.h:78
int TimeOut
Definition: sclLib.h:79
static int Vec_QuePop(Vec_Que_t *p)
Definition: vecQue.h:234
typedefABC_NAMESPACE_HEADER_START struct SC_Man_ SC_Man
INCLUDES ///.
Definition: sclSize.h:44
static abctime Abc_Clock()
Definition: abc_global.h:279
void Abc_NtkCollectNodesByArea(SC_Man *p, Abc_Ntk_t *pNtk)
Definition: sclDnsize.c:177
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
int fVerbose
Definition: sclLib.h:85
int Abc_SclTimeIncUpdate(SC_Man *p)
Definition: sclSize.c:540
#define ABC_PRTP(a, t, T)
Definition: abc_global.h:223
static int Vec_QueSize(Vec_Que_t *p)
Definition: vecQue.h:134
int fUseWireLoads
Definition: sclLib.h:84
static void Abc_SclManFree(SC_Man *p)
Definition: sclSize.h:192
static void Abc_SclDumpStats(SC_Man *p, char *pFileName, abctime Time)
Definition: sclSize.h:510
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
Definition: abc.h:452
int Abc_SclCheckOverlap(Abc_Ntk_t *pNtk, Vec_Int_t *vNodes)
Definition: sclDnsize.c:190
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
void Abc_SclDnsizePrint(SC_Man *p, int Iter, int nAttempts, int nOverlaps, int nChanges, int fVerbose)
Definition: sclDnsize.c:211
int DelayUser
Definition: sclLib.h:77
void Abc_SclSclGates2MioGates(SC_Lib *pLib, Abc_Ntk_t *p)
Definition: sclUtil.c:73
int Notches
Definition: sclLib.h:76
int fUseDept
Definition: sclLib.h:82
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
int nIters
Definition: sclLib.h:72
#define assert(ex)
Definition: util_old.h:213
int Abc_SclCheckImprovement(SC_Man *p, Abc_Obj_t *pObj, Vec_Int_t *vNodes, Vec_Int_t *vEvals, int Notches, int DelayGap)
Definition: sclDnsize.c:102
int BuffTreeEst
Definition: sclLib.h:80
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
int fDumpStats
Definition: sclLib.h:83
static void Vec_QuePush(Vec_Que_t *p, int v)
Definition: vecQue.h:221
SC_Man * Abc_SclManStart(SC_Lib *pLib, Abc_Ntk_t *pNtk, int fUseWireLoads, int fDept, float DUser, int nTreeCRatio)
Definition: sclSize.c:633
static void Abc_SclDumpStats ( SC_Man p,
char *  pFileName,
abctime  Time 
)
inlinestatic

Function*************************************************************

Synopsis [Dumps timing results into a file.]

Description []

SideEffects []

SeeAlso []

Definition at line 510 of file sclSize.h.

511 {
512  static char FileNameOld[1000] = {0};
513  static int nNodesOld, nAreaOld, nDelayOld;
514  static abctime clk = 0;
515  FILE * pTable;
516  pTable = fopen( pFileName, "a+" );
517  if ( strcmp( FileNameOld, p->pNtk->pName ) )
518  {
519  sprintf( FileNameOld, "%s", p->pNtk->pName );
520  fprintf( pTable, "\n" );
521  fprintf( pTable, "%s ", Extra_FileNameWithoutPath(p->pNtk->pName) );
522  fprintf( pTable, "%d ", Abc_NtkPiNum(p->pNtk) );
523  fprintf( pTable, "%d ", Abc_NtkPoNum(p->pNtk) );
524  fprintf( pTable, "%d ", (nNodesOld = Abc_NtkNodeNum(p->pNtk)) );
525  fprintf( pTable, "%d ", (nAreaOld = (int)p->SumArea) );
526  fprintf( pTable, "%d ", (nDelayOld = (int)p->ReportDelay) );
527  clk = Abc_Clock();
528  }
529  else
530  {
531  fprintf( pTable, " " );
532  fprintf( pTable, "%.1f ", 100.0 * Abc_NtkNodeNum(p->pNtk) / nNodesOld );
533  fprintf( pTable, "%.1f ", 100.0 * (int)p->SumArea / nAreaOld );
534  fprintf( pTable, "%.1f ", 100.0 * (int)p->ReportDelay / nDelayOld );
535  fprintf( pTable, "%.2f", 1.0*(Abc_Clock() - clk)/CLOCKS_PER_SEC );
536  }
537  fclose( pTable );
538 }
char * Extra_FileNameWithoutPath(char *FileName)
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static abctime Abc_Clock()
Definition: abc_global.h:279
int strcmp()
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
char * sprintf()
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
ABC_INT64_T abctime
Definition: abc_global.h:278
static float Abc_SclEvalPerform ( SC_Man p,
Vec_Int_t vCone 
)
inlinestatic

Definition at line 376 of file sclSize.h.

377 {
378  Abc_Obj_t * pObj;
379  float Diff, Multi = 1.5, Eval = 0;
380  int i, k = 0;
381  Abc_NtkForEachObjVec( vCone, p->pNtk, pObj, i )
382  {
383  Diff = (Vec_FltEntry(p->vTimes3, k++) - Abc_SclObjTime(p, pObj)->rise);
384  Diff += (Vec_FltEntry(p->vTimes3, k++) - Abc_SclObjTime(p, pObj)->fall);
385  Eval += 0.5 * (Diff > 0 ? Diff : Multi * Diff);
386  }
387  assert( Vec_FltSize(p->vTimes3) == k );
388  return Eval / Vec_IntSize(vCone);
389 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static SC_Pair * Abc_SclObjTime(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:115
float rise
Definition: sclLib.h:65
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
Definition: abc.h:452
float fall
Definition: sclLib.h:66
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
static float Vec_FltEntry(Vec_Flt_t *p, int i)
Definition: vecFlt.h:342
static int Vec_FltSize(Vec_Flt_t *p)
Definition: vecFlt.h:294
static float Abc_SclEvalPerformLegal ( SC_Man p,
Vec_Int_t vCone,
float  D 
)
inlinestatic

Definition at line 390 of file sclSize.h.

391 {
392  Abc_Obj_t * pObj;
393  float Rise, Fall, Multi = 1.0, Eval = 0;
394  int i, k = 0;
395  Abc_NtkForEachObjVec( vCone, p->pNtk, pObj, i )
396  {
397  Rise = Vec_FltEntry(p->vTimes3, k++) - Abc_SclObjTime(p, pObj)->rise;
398  Fall = Vec_FltEntry(p->vTimes3, k++) - Abc_SclObjTime(p, pObj)->fall;
399  if ( Rise + Multi * Abc_SclObjGetSlackR(p, pObj, D) < 0 || Fall + Multi * Abc_SclObjGetSlackF(p, pObj, D) < 0 )
400  return -1;
401  Eval += 0.5 * Rise + 0.5 * Fall;
402  }
403  assert( Vec_FltSize(p->vTimes3) == k );
404  return Eval / Vec_IntSize(vCone);
405 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static SC_Pair * Abc_SclObjTime(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:115
float rise
Definition: sclLib.h:65
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
Definition: abc.h:452
float fall
Definition: sclLib.h:66
static float Abc_SclObjGetSlackR(SC_Man *p, Abc_Obj_t *pObj, float D)
Definition: sclSize.h:123
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static float Abc_SclObjGetSlackF(SC_Man *p, Abc_Obj_t *pObj, float D)
Definition: sclSize.h:124
#define assert(ex)
Definition: util_old.h:213
static float Vec_FltEntry(Vec_Flt_t *p, int i)
Definition: vecFlt.h:342
static int Vec_FltSize(Vec_Flt_t *p)
Definition: vecFlt.h:294
static void Abc_SclEvalStore ( SC_Man p,
Vec_Int_t vCone 
)
inlinestatic

Definition at line 365 of file sclSize.h.

366 {
367  Abc_Obj_t * pObj;
368  int i;
369  Vec_FltClear( p->vTimes3 );
370  Abc_NtkForEachObjVec( vCone, p->pNtk, pObj, i )
371  {
372  Vec_FltPush( p->vTimes3, Abc_SclObjTime(p, pObj)->rise );
373  Vec_FltPush( p->vTimes3, Abc_SclObjTime(p, pObj)->fall );
374  }
375 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_FltPush(Vec_Flt_t *p, float Entry)
Definition: vecFlt.h:528
static void Vec_FltClear(Vec_Flt_t *p)
Definition: vecFlt.h:512
static SC_Pair * Abc_SclObjTime(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:115
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
Definition: abc.h:452
Vec_Int_t* Abc_SclExtractBarBufs ( Abc_Ntk_t pNtk)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 267 of file sclUtil.c.

268 {
269  Vec_Int_t * vBufs;
270  Mio_Gate_t * pBuffer;
271  Abc_Obj_t * pObj; int i;
272  pBuffer = Mio_LibraryReadBuf( (Mio_Library_t *)pNtk->pManFunc );
273  if ( pBuffer == NULL )
274  {
275  printf( "Cannot find buffer in the current library. Quitting.\n" );
276  return NULL;
277  }
278  vBufs = Vec_IntAlloc( 100 );
279  Abc_NtkForEachBarBuf( pNtk, pObj, i )
280  {
281  assert( pObj->pData == NULL );
282  pObj->pData = pBuffer;
283  Vec_IntPush( vBufs, i );
284  }
285  return vBufs;
286 }
Mio_Gate_t * Mio_LibraryReadBuf(Mio_Library_t *pLib)
Definition: mioApi.c:47
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void * pManFunc
Definition: abc.h:191
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define Abc_NtkForEachBarBuf(pNtk, pNode, i)
Definition: abc.h:479
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
Abc_Obj_t* Abc_SclFindCriticalCo ( SC_Man p,
int *  pfRise 
)

DECLARATIONS ///.

CFile****************************************************************

FileName [sclSize.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Standard-cell library representation.]

Synopsis [Core timing analysis used in gate-sizing.]

Author [Alan Mishchenko, Niklas Een]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - August 24, 2012.]

Revision [

Id:
sclSize.c,v 1.0 2012/08/24 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Finding most critical objects.]

Description []

SideEffects []

SeeAlso []

Definition at line 52 of file sclSize.c.

53 {
54  Abc_Obj_t * pObj, * pPivot = NULL;
55  float fMaxArr = 0;
56  int i;
57  assert( Abc_NtkPoNum(p->pNtk) > 0 );
58  Abc_NtkForEachCo( p->pNtk, pObj, i )
59  {
60  SC_Pair * pArr = Abc_SclObjTime( p, pObj );
61  if ( fMaxArr < pArr->rise ) fMaxArr = pArr->rise, *pfRise = 1, pPivot = pObj;
62  if ( fMaxArr < pArr->fall ) fMaxArr = pArr->fall, *pfRise = 0, pPivot = pObj;
63  }
64  if ( fMaxArr == 0 )
65  pPivot = Abc_NtkPo(p->pNtk, 0);
66  assert( pPivot != NULL );
67  return pPivot;
68 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static SC_Pair * Abc_SclObjTime(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:115
float rise
Definition: sclLib.h:65
float fall
Definition: sclLib.h:66
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
#define assert(ex)
Definition: util_old.h:213
Abc_Obj_t* Abc_SclFindMostCriticalFanin ( SC_Man p,
int *  pfRise,
Abc_Obj_t pNode 
)

Definition at line 84 of file sclSize.c.

85 {
86  Abc_Obj_t * pFanin, * pPivot = NULL;
87  float fMinSlack = ABC_INFINITY;
88  SC_Pair * pArr;
89  int i;
90  *pfRise = 0;
91  // find min-slack node
92  Abc_ObjForEachFanin( pNode, pFanin, i )
93  if ( fMinSlack > Abc_SclObjGetSlack( p, pFanin, p->MaxDelay0 ) )
94  {
95  fMinSlack = Abc_SclObjGetSlack( p, pFanin, p->MaxDelay0 );
96  pPivot = pFanin;
97  }
98  if ( pPivot == NULL )
99  return NULL;
100  // find its leading phase
101  pArr = Abc_SclObjTime( p, pPivot );
102  *pfRise = (pArr->rise >= pArr->fall);
103  return pPivot;
104 }
static float Abc_SclObjGetSlack(SC_Man *p, Abc_Obj_t *pObj, float D)
Definition: sclSize.h:125
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static SC_Pair * Abc_SclObjTime(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:115
float rise
Definition: sclLib.h:65
float fall
Definition: sclLib.h:66
if(last==0)
Definition: sparse_int.h:34
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
Vec_Flt_t* Abc_SclFindWireCaps ( SC_WireLoad pWL,
int  nFanoutMax 
)

DECLARATIONS ///.

CFile****************************************************************

FileName [sclLoad.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Standard-cell library representation.]

Synopsis [Wire/gate load computations.]

Author [Alan Mishchenko, Niklas Een]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - August 24, 2012.]

Revision [

Id:
sclLoad.c,v 1.0 2012/08/24 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Returns estimated wire capacitances for each fanout count.]

Description []

SideEffects []`

SeeAlso []

Definition at line 45 of file sclLoad.c.

46 {
47  Vec_Flt_t * vCaps = NULL;
48  float EntryPrev, EntryCur, Slope;
49  int i, iPrev, k, Entry, EntryMax;
50  assert( pWL != NULL );
51  // find the biggest fanout count
52  EntryMax = 0;
53  Vec_IntForEachEntry( pWL->vFanout, Entry, i )
54  EntryMax = Abc_MaxInt( EntryMax, Entry );
55  // create the array
56  vCaps = Vec_FltStart( Abc_MaxInt(nFanoutMax, EntryMax) + 1 );
57  Vec_IntForEachEntry( pWL->vFanout, Entry, i )
58  Vec_FltWriteEntry( vCaps, Entry, Vec_FltEntry(pWL->vLen, i) * pWL->cap );
59  // interpolate between the values
60  assert( Vec_FltEntry(vCaps, 1) != 0 );
61  iPrev = 1;
62  EntryPrev = Vec_FltEntry(vCaps, 1);
63  Vec_FltForEachEntryStart( vCaps, EntryCur, i, 2 )
64  {
65  if ( EntryCur == 0 )
66  continue;
67  Slope = (EntryCur - EntryPrev) / (i - iPrev);
68  for ( k = iPrev + 1; k < i; k++ )
69  Vec_FltWriteEntry( vCaps, k, EntryPrev + Slope * (k - iPrev) );
70  EntryPrev = EntryCur;
71  iPrev = i;
72  }
73  // extrapolate after the largest value
74  Slope = pWL->cap * pWL->slope;
75  for ( k = iPrev + 1; k < i; k++ )
76  Vec_FltWriteEntry( vCaps, k, EntryPrev + Slope * (k - iPrev) );
77  // show
78 // Vec_FltForEachEntry( vCaps, EntryCur, i )
79 // printf( "%3d : %f\n", i, EntryCur );
80  return vCaps;
81 }
static void Vec_FltWriteEntry(Vec_Flt_t *p, int i, float Entry)
Definition: vecFlt.h:364
float slope
Definition: sclLib.h:121
#define Vec_FltForEachEntryStart(vVec, Entry, i, Start)
Definition: vecFlt.h:56
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static Vec_Flt_t * Vec_FltStart(int nSize)
Definition: vecFlt.h:101
float cap
Definition: sclLib.h:120
Vec_Int_t * vFanout
Definition: sclLib.h:122
typedefABC_NAMESPACE_HEADER_START struct Vec_Flt_t_ Vec_Flt_t
INCLUDES ///.
Definition: vecFlt.h:42
#define assert(ex)
Definition: util_old.h:213
static float Vec_FltEntry(Vec_Flt_t *p, int i)
Definition: vecFlt.h:342
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
float Abc_SclFindWireLoad ( Vec_Flt_t vWireCaps,
int  nFans 
)

Function*************************************************************

Synopsis [Computes load for all nodes in the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 94 of file sclLoad.c.

95 {
96  if ( vWireCaps == NULL )
97  return 0;
98  return Vec_FltEntry( vWireCaps, Abc_MinInt(nFans, Vec_FltSize(vWireCaps)-1) );
99 }
static int Abc_MinInt(int a, int b)
Definition: abc_global.h:239
static float Vec_FltEntry(Vec_Flt_t *p, int i)
Definition: vecFlt.h:342
static int Vec_FltSize(Vec_Flt_t *p)
Definition: vecFlt.h:294
static float Abc_SclGetAverageSize ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 437 of file sclSize.h.

438 {
439  Abc_Obj_t * pObj;
440  double Total = 0;
441  int i, Count = 0;
442  Abc_NtkForEachNode1( pNtk, pObj, i )
443  Count++, Total += 100.0*Abc_SclObjCell(pObj)->Order/Abc_SclObjCell(pObj)->nGates;
444  return (float)(Total / Count);
445 }
#define Abc_NtkForEachNode1(pNtk, pNode, i)
Definition: abc.h:467
static SC_Cell * Abc_SclObjCell(Abc_Obj_t *p)
Definition: sclSize.h:110
static int Abc_SclGetBufInvCount ( Abc_Ntk_t pNtk)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 429 of file sclSize.h.

430 {
431  Abc_Obj_t * pObj;
432  int i, Count = 0;
433  Abc_NtkForEachNode( pNtk, pObj, i )
434  Count += (Abc_ObjFaninNum(pObj) == 1);
435  return Count;
436 }
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static float Abc_SclGetMaxDelay ( SC_Man p)
inlinestatic

Definition at line 455 of file sclSize.h.

456 {
457  float fMaxArr = 0;
458  Abc_Obj_t * pObj;
459  int i;
460  Abc_NtkForEachCo( p->pNtk, pObj, i )
461  fMaxArr = Abc_MaxFloat( fMaxArr, Abc_SclObjTimeMax(p, pObj) );
462  return fMaxArr;
463 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
static float Abc_SclObjTimeMax(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:121
static float Abc_SclGetMaxDelayNodeFanins ( SC_Man p,
Abc_Obj_t pNode 
)
inlinestatic

Definition at line 464 of file sclSize.h.

465 {
466  float fMaxArr = 0;
467  Abc_Obj_t * pObj;
468  int i;
469  assert( Abc_ObjIsNode(pNode) );
470  Abc_ObjForEachFanin( pNode, pObj, i )
471  fMaxArr = Abc_MaxFloat( fMaxArr, Abc_SclObjTimeMax(p, pObj) );
472  return fMaxArr;
473 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
#define assert(ex)
Definition: util_old.h:213
static float Abc_SclObjTimeMax(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:121
static float Abc_SclGetTotalArea ( Abc_Ntk_t pNtk)
inlinestatic

Definition at line 446 of file sclSize.h.

447 {
448  double Area = 0;
449  Abc_Obj_t * pObj;
450  int i;
451  Abc_NtkForEachNode1( pNtk, pObj, i )
452  Area += Abc_SclObjCell(pObj)->area;
453  return Area;
454 }
#define Abc_NtkForEachNode1(pNtk, pNode, i)
Definition: abc.h:467
static SC_Cell * Abc_SclObjCell(Abc_Obj_t *p)
Definition: sclSize.h:110
void Abc_SclInsertBarBufs ( Abc_Ntk_t pNtk,
Vec_Int_t vBufs 
)

Definition at line 287 of file sclUtil.c.

288 {
289  Abc_Obj_t * pObj; int i;
290  Abc_NtkForEachObjVec( vBufs, pNtk, pObj, i )
291  pObj->pData = NULL;
292 }
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
Definition: abc.h:452
int Abc_SclIsInv ( Abc_Obj_t pObj)

Definition at line 116 of file sclBuffer.c.

117 {
118  assert( Abc_ObjIsNode(pObj) );
119  return Mio_GateReadTruth((Mio_Gate_t *)pObj->pData) == ABC_CONST(0x5555555555555555);
120 }
word Mio_GateReadTruth(Mio_Gate_t *pGate)
Definition: mioApi.c:154
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
#define ABC_CONST(number)
PARAMETERS ///.
Definition: abc_global.h:206
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
static void Abc_SclLoadRestore ( SC_Man p,
Abc_Obj_t pObj 
)
inlinestatic

Definition at line 301 of file sclSize.h.

302 {
303  Abc_Obj_t * pFanin;
304  int i, k = 0;
305  Abc_ObjForEachFanin( pObj, pFanin, i )
306  {
307  Abc_SclObjLoad(p, pFanin)->rise = Vec_FltEntry(p->vLoads2, k++);
308  Abc_SclObjLoad(p, pFanin)->fall = Vec_FltEntry(p->vLoads2, k++);
309  }
310  assert( Vec_FltSize(p->vLoads2) == k );
311 }
static SC_Pair * Abc_SclObjLoad(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:113
static Llb_Mgr_t * p
Definition: llb3Image.c:950
float rise
Definition: sclLib.h:65
float fall
Definition: sclLib.h:66
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
#define assert(ex)
Definition: util_old.h:213
static float Vec_FltEntry(Vec_Flt_t *p, int i)
Definition: vecFlt.h:342
static int Vec_FltSize(Vec_Flt_t *p)
Definition: vecFlt.h:294
static void Abc_SclLoadRestore3 ( SC_Man p,
Abc_Obj_t pObj 
)
inlinestatic

Definition at line 326 of file sclSize.h.

327 {
328  Abc_Obj_t * pFanin;
329  int i, k = 0;
330  Abc_SclObjLoad(p, pObj)->rise = Vec_FltEntry(p->vLoads3, k++);
331  Abc_SclObjLoad(p, pObj)->fall = Vec_FltEntry(p->vLoads3, k++);
332  Abc_ObjForEachFanin( pObj, pFanin, i )
333  {
334  Abc_SclObjLoad(p, pFanin)->rise = Vec_FltEntry(p->vLoads3, k++);
335  Abc_SclObjLoad(p, pFanin)->fall = Vec_FltEntry(p->vLoads3, k++);
336  }
337  assert( Vec_FltSize(p->vLoads3) == k );
338 }
static SC_Pair * Abc_SclObjLoad(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:113
static Llb_Mgr_t * p
Definition: llb3Image.c:950
float rise
Definition: sclLib.h:65
float fall
Definition: sclLib.h:66
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
#define assert(ex)
Definition: util_old.h:213
static float Vec_FltEntry(Vec_Flt_t *p, int i)
Definition: vecFlt.h:342
static int Vec_FltSize(Vec_Flt_t *p)
Definition: vecFlt.h:294
static void Abc_SclLoadStore ( SC_Man p,
Abc_Obj_t pObj 
)
inlinestatic

Function*************************************************************

Synopsis [Stores/retrivies information for the logic cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 290 of file sclSize.h.

291 {
292  Abc_Obj_t * pFanin;
293  int i;
294  Vec_FltClear( p->vLoads2 );
295  Abc_ObjForEachFanin( pObj, pFanin, i )
296  {
297  Vec_FltPush( p->vLoads2, Abc_SclObjLoad(p, pFanin)->rise );
298  Vec_FltPush( p->vLoads2, Abc_SclObjLoad(p, pFanin)->fall );
299  }
300 }
static SC_Pair * Abc_SclObjLoad(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:113
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_FltPush(Vec_Flt_t *p, float Entry)
Definition: vecFlt.h:528
static void Vec_FltClear(Vec_Flt_t *p)
Definition: vecFlt.h:512
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static void Abc_SclLoadStore3 ( SC_Man p,
Abc_Obj_t pObj 
)
inlinestatic

Definition at line 313 of file sclSize.h.

314 {
315  Abc_Obj_t * pFanin;
316  int i;
317  Vec_FltClear( p->vLoads3 );
318  Vec_FltPush( p->vLoads3, Abc_SclObjLoad(p, pObj)->rise );
319  Vec_FltPush( p->vLoads3, Abc_SclObjLoad(p, pObj)->fall );
320  Abc_ObjForEachFanin( pObj, pFanin, i )
321  {
322  Vec_FltPush( p->vLoads3, Abc_SclObjLoad(p, pFanin)->rise );
323  Vec_FltPush( p->vLoads3, Abc_SclObjLoad(p, pFanin)->fall );
324  }
325 }
static SC_Pair * Abc_SclObjLoad(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:113
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_FltPush(Vec_Flt_t *p, float Entry)
Definition: vecFlt.h:528
static void Vec_FltClear(Vec_Flt_t *p)
Definition: vecFlt.h:512
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static SC_Man* Abc_SclManAlloc ( SC_Lib pLib,
Abc_Ntk_t pNtk 
)
inlinestatic

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Constructor/destructor of STA manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 147 of file sclSize.h.

148 {
149  SC_Man * p;
150  Abc_Obj_t * pObj;
151  int i;
152  assert( pLib->unit_time == 12 );
153  assert( pLib->unit_cap_snd == 15 );
154  assert( Abc_NtkHasMapping(pNtk) );
155  p = ABC_CALLOC( SC_Man, 1 );
156  p->pLib = pLib;
157  p->pNtk = pNtk;
158  p->nObjs = Abc_NtkObjNumMax(pNtk);
159  p->pLoads = ABC_CALLOC( SC_Pair, p->nObjs );
160  p->pDepts = ABC_CALLOC( SC_Pair, p->nObjs );
161  p->pTimes = ABC_CALLOC( SC_Pair, p->nObjs );
162  p->pSlews = ABC_CALLOC( SC_Pair, p->nObjs );
163  p->vBestFans = Vec_IntStart( p->nObjs );
164  p->vTimesOut = Vec_FltStart( Abc_NtkCoNum(pNtk) );
165  p->vQue = Vec_QueAlloc( Abc_NtkCoNum(pNtk) );
166  Vec_QueSetPriority( p->vQue, Vec_FltArrayP(p->vTimesOut) );
167  for ( i = 0; i < Abc_NtkCoNum(pNtk); i++ )
168  Vec_QuePush( p->vQue, i );
169  p->vUpdates = Vec_IntAlloc( 1000 );
170  p->vUpdates2 = Vec_IntAlloc( 1000 );
171  p->vLoads2 = Vec_FltAlloc( 1000 );
172  p->vLoads3 = Vec_FltAlloc( 1000 );
173  p->vTimes2 = Vec_FltAlloc( 1000 );
174  p->vTimes3 = Vec_FltAlloc( 1000 );
175  // intermediate data
176  p->vNode2Gain = Vec_FltStart( p->nObjs );
177  p->vNode2Gate = Vec_IntStart( p->nObjs );
178  p->vNodeByGain = Vec_QueAlloc( p->nObjs );
179  Vec_QueSetPriority( p->vNodeByGain, Vec_FltArrayP(p->vNode2Gain) );
180  p->vNodeIter = Vec_IntStartFull( p->nObjs );
181  p->vLevels = Vec_WecStart( 2 * Abc_NtkLevel(pNtk) + 1 );
182  p->vChanged = Vec_IntAlloc( 100 );
183  Abc_NtkForEachCo( pNtk, pObj, i )
184  pObj->Level = Abc_ObjFanin0(pObj)->Level + 1;
185  // set CI/CO ids
186  Abc_NtkForEachCi( pNtk, pObj, i )
187  pObj->iData = i;
188  Abc_NtkForEachCo( pNtk, pObj, i )
189  pObj->iData = i;
190  return p;
191 }
int unit_time
Definition: sclLib.h:209
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Vec_Wec_t * Vec_WecStart(int nSize)
Definition: vecWec.h:98
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
static Vec_Flt_t * Vec_FltAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecFlt.h:78
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
typedefABC_NAMESPACE_HEADER_START struct SC_Man_ SC_Man
INCLUDES ///.
Definition: sclSize.h:44
static Vec_Int_t * Vec_IntStartFull(int nSize)
Definition: vecInt.h:119
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
int nObjs
Definition: abc.h:172
static Vec_Flt_t * Vec_FltStart(int nSize)
Definition: vecFlt.h:101
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
int unit_cap_snd
Definition: sclLib.h:211
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static float ** Vec_FltArrayP(Vec_Flt_t *p)
Definition: vecFlt.h:278
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1265
static Vec_Que_t * Vec_QueAlloc(int nCap)
MACRO DEFINITIONS ///.
Definition: vecQue.h:71
static void Vec_QuePush(Vec_Que_t *p, int v)
Definition: vecQue.h:221
static void Vec_QueSetPriority(Vec_Que_t *p, float **pCosts)
Definition: vecQue.h:95
static void Abc_SclManCleanTime ( SC_Man p)
inlinestatic

Definition at line 256 of file sclSize.h.

257 {
258  memset( p->pTimes, 0, sizeof(SC_Pair) * p->nObjs );
259  memset( p->pSlews, 0, sizeof(SC_Pair) * p->nObjs );
260  memset( p->pDepts, 0, sizeof(SC_Pair) * p->nObjs );
261 /*
262  if ( p->pPiDrive != NULL )
263  {
264  SC_Pair * pSlew, * pTime, * pLoad;
265  Abc_Obj_t * pObj;
266  int i;
267  Abc_NtkForEachPi( p->pNtk, pObj, i )
268  {
269  pLoad = Abc_SclObjLoad( p, pObj );
270  pTime = Abc_SclObjTime( p, pObj );
271  pSlew = Abc_SclObjSlew( p, pObj );
272  Scl_LibHandleInputDriver( p->pPiDrive, pLoad, pTime, pSlew );
273  }
274  }
275 */
276 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Abc_SclManFree ( SC_Man p)
inlinestatic

Definition at line 192 of file sclSize.h.

193 {
194  Abc_Obj_t * pObj;
195  int i;
196  // set CI/CO ids
197  Abc_NtkForEachCi( p->pNtk, pObj, i )
198  pObj->iData = 0;
199  Abc_NtkForEachCo( p->pNtk, pObj, i )
200  pObj->iData = 0;
201  // other
202  p->pNtk->pSCLib = NULL;
203  Vec_IntFreeP( &p->pNtk->vGates );
204  Vec_IntFreeP( &p->vNodeIter );
205  Vec_QueFreeP( &p->vNodeByGain );
206  Vec_FltFreeP( &p->vNode2Gain );
207  Vec_IntFreeP( &p->vNode2Gate );
208  // intermediate data
209  Vec_FltFreeP( &p->vLoads2 );
210  Vec_FltFreeP( &p->vLoads3 );
211  Vec_FltFreeP( &p->vTimes2 );
212  Vec_FltFreeP( &p->vTimes3 );
213  Vec_IntFreeP( &p->vUpdates );
214  Vec_IntFreeP( &p->vUpdates2 );
215  Vec_IntFreeP( &p->vGatesBest );
216  Vec_WecFreeP( &p->vLevels );
217  Vec_IntFreeP( &p->vChanged );
218 // Vec_QuePrint( p->vQue );
219  Vec_QueCheck( p->vQue );
220  Vec_QueFreeP( &p->vQue );
221  Vec_FltFreeP( &p->vTimesOut );
222  Vec_IntFreeP( &p->vBestFans );
223  Vec_FltFreeP( &p->vInDrive );
224  Vec_FltFreeP( &p->vWireCaps );
225  ABC_FREE( p->pLoads );
226  ABC_FREE( p->pDepts );
227  ABC_FREE( p->pTimes );
228  ABC_FREE( p->pSlews );
229  ABC_FREE( p );
230 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_QueCheck(Vec_Que_t *p)
Definition: vecQue.h:289
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static void Vec_FltFreeP(Vec_Flt_t **p)
Definition: vecFlt.h:235
static void Vec_QueFreeP(Vec_Que_t **p)
Definition: vecQue.h:89
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_WecFreeP(Vec_Wec_t **p)
Definition: vecWec.h:350
SC_Man* Abc_SclManStart ( SC_Lib pLib,
Abc_Ntk_t pNtk,
int  fUseWireLoads,
int  fDept,
float  DUser,
int  nTreeCRatio 
)

Function*************************************************************

Synopsis [Prepare timing manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 633 of file sclSize.c.

634 {
635  SC_Man * p = Abc_SclManAlloc( pLib, pNtk );
636  if ( nTreeCRatio )
637  {
638  p->EstLoadMax = 0.01 * nTreeCRatio; // max ratio of Cout/Cave when the estimation is used
639  p->EstLinear = 100; // linear coefficient
640  }
641  Abc_SclMioGates2SclGates( pLib, pNtk );
642  Abc_SclManReadSlewAndLoad( p, pNtk );
643  if ( fUseWireLoads )
644  {
645  if ( pNtk->pWLoadUsed == NULL )
646  {
647  p->pWLoadUsed = Abc_SclFindWireLoadModel( pLib, Abc_SclGetTotalArea(p->pNtk) );
648  if ( p->pWLoadUsed )
649  pNtk->pWLoadUsed = Abc_UtilStrsav( p->pWLoadUsed->pName );
650  }
651  else
652  p->pWLoadUsed = Abc_SclFetchWireLoadModel( pLib, pNtk->pWLoadUsed );
653  }
654  Abc_SclTimeNtkRecompute( p, &p->SumArea0, &p->MaxDelay0, fDept, DUser );
655  p->SumArea = p->SumArea0;
656  p->MaxDelay = p->MaxDelay0;
657  return p;
658 }
void Abc_SclTimeNtkRecompute(SC_Man *p, float *pArea, float *pDelay, int fReverse, float DUser)
Definition: sclSize.c:400
static SC_Man * Abc_SclManAlloc(SC_Lib *pLib, Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: sclSize.h:147
void Abc_SclManReadSlewAndLoad(SC_Man *p, Abc_Ntk_t *pNtk)
Definition: sclSize.c:594
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_HEADER_START struct SC_Man_ SC_Man
INCLUDES ///.
Definition: sclSize.h:44
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
void Abc_SclMioGates2SclGates(SC_Lib *pLib, Abc_Ntk_t *p)
DECLARATIONS ///.
Definition: sclUtil.c:47
SC_WireLoad * Abc_SclFetchWireLoadModel(SC_Lib *p, char *pName)
Definition: sclLibUtil.c:230
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
char * pWLoadUsed
Definition: abc.h:209
void Abc_SclMinsizePerform ( SC_Lib pLib,
Abc_Ntk_t p,
int  fUseMax,
int  fVerbose 
)

Definition at line 185 of file sclUtil.c.

186 {
187  Vec_Int_t * vMinCells;
188  Abc_Obj_t * pObj;
189  int i, gateId;
190  vMinCells = Abc_SclFindMinAreas( pLib, fUseMax );
191  Abc_SclMioGates2SclGates( pLib, p );
192  Abc_NtkForEachNode1( p, pObj, i )
193  {
194  gateId = Vec_IntEntry( p->vGates, i );
195  assert( gateId >= 0 && gateId < Vec_PtrSize(pLib->vCells) );
196  gateId = Vec_IntEntry( vMinCells, gateId );
197  assert( gateId >= 0 && gateId < Vec_PtrSize(pLib->vCells) );
198  Vec_IntWriteEntry( p->vGates, i, gateId );
199  }
200  Abc_SclSclGates2MioGates( pLib, p );
201  Vec_IntFree( vMinCells );
202 }
#define Abc_NtkForEachNode1(pNtk, pNode, i)
Definition: abc.h:467
void Abc_SclSclGates2MioGates(SC_Lib *pLib, Abc_Ntk_t *p)
Definition: sclUtil.c:73
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Int_t * Abc_SclFindMinAreas(SC_Lib *pLib, int fUseMax)
Definition: sclUtil.c:170
Vec_Int_t * vGates
Definition: abc.h:207
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
ABC_NAMESPACE_IMPL_START void Abc_SclMioGates2SclGates(SC_Lib *pLib, Abc_Ntk_t *p)
DECLARATIONS ///.
Definition: sclUtil.c:47
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Vec_Ptr_t * vCells
Definition: sclLib.h:215
void Abc_SclMioGates2SclGates ( SC_Lib pLib,
Abc_Ntk_t p 
)

DECLARATIONS ///.

CFile****************************************************************

FileName [sclUtil.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Standard-cell library representation.]

Synopsis [Various utilities.]

Author [Alan Mishchenko, Niklas Een]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - August 24, 2012.]

Revision [

Id:
sclUtil.c,v 1.0 2012/08/24 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Converts pNode->pData gates into array of SC_Lit gate IDs and back.]

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file sclUtil.c.

48 {
49  Abc_Obj_t * pObj;
50  int i, gateId, bufferId;
51  // find buffer
52  if ( Mio_LibraryReadBuf((Mio_Library_t *)p->pManFunc) == NULL )
53  {
54  printf( "Cannot find buffer in the current library. Quitting.\n" );
55  return;
56  }
58  assert( bufferId >= 0 );
59  // remap cells
60  assert( p->vGates == NULL );
62  Abc_NtkForEachNode1( p, pObj, i )
63  {
64  if ( Abc_ObjIsBarBuf(pObj) )
65  gateId = bufferId;
66  else
67  gateId = Abc_SclCellFind( pLib, Mio_GateReadName((Mio_Gate_t *)pObj->pData) );
68  assert( gateId >= 0 );
69  Vec_IntWriteEntry( p->vGates, i, gateId );
70  }
71  p->pSCLib = pLib;
72 }
Mio_Gate_t * Mio_LibraryReadBuf(Mio_Library_t *pLib)
Definition: mioApi.c:47
#define Abc_NtkForEachNode1(pNtk, pNode, i)
Definition: abc.h:467
void * pSCLib
Definition: abc.h:206
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static int Abc_ObjIsBarBuf(Abc_Obj_t *pObj)
Definition: abc.h:360
Vec_Int_t * vGates
Definition: abc.h:207
static Vec_Int_t * Vec_IntStartFull(int nSize)
Definition: vecInt.h:119
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
void * pManFunc
Definition: abc.h:191
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
int Abc_SclCellFind(SC_Lib *p, char *pName)
Definition: sclLibUtil.c:79
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
char * Mio_GateReadName(Mio_Gate_t *pGate)
Definition: mioApi.c:143
static SC_Cell* Abc_SclObjCell ( Abc_Obj_t p)
inlinestatic

Definition at line 110 of file sclSize.h.

110 { int c = Abc_SclObjCellId(p); return c == -1 ? NULL:SC_LibCell(Abc_SclObjLib(p), c); }
static SC_Lib * Abc_SclObjLib(Abc_Obj_t *p)
GLOBAL VARIABLES ///.
Definition: sclSize.h:108
static int Abc_SclObjCellId(Abc_Obj_t *p)
Definition: sclSize.h:109
static SC_Cell * SC_LibCell(SC_Lib *p, int i)
Definition: sclLib.h:240
static int Abc_SclObjCellId ( Abc_Obj_t p)
inlinestatic

Definition at line 109 of file sclSize.h.

109 { return Vec_IntEntry( p->pNtk->vGates, Abc_ObjId(p) ); }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
Vec_Int_t * vGates
Definition: abc.h:207
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Abc_Ntk_t * pNtk
Definition: abc.h:130
static SC_Pair* Abc_SclObjDept ( SC_Man p,
Abc_Obj_t pObj 
)
inlinestatic

Definition at line 114 of file sclSize.h.

114 { return p->pDepts + Abc_ObjId(pObj); }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Abc_SclObjDupFanin ( SC_Man p,
Abc_Obj_t pObj 
)
inlinestatic

Definition at line 127 of file sclSize.h.

127 { assert( Abc_ObjIsCo(pObj) ); *Abc_SclObjTime(p, pObj) = *Abc_SclObjTime(p, Abc_ObjFanin0(pObj)); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
static SC_Pair * Abc_SclObjTime(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:115
#define assert(ex)
Definition: util_old.h:213
static float Abc_SclObjGetSlack ( SC_Man p,
Abc_Obj_t pObj,
float  D 
)
inlinestatic

Definition at line 125 of file sclSize.h.

125 { return D - Abc_MaxFloat(Abc_SclObjTime(p, pObj)->rise + Abc_SclObjDept(p, pObj)->rise, Abc_SclObjTime(p, pObj)->fall + Abc_SclObjDept(p, pObj)->fall); }
static SC_Pair * Abc_SclObjDept(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:114
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
static SC_Pair * Abc_SclObjTime(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:115
static float Abc_SclObjGetSlackF ( SC_Man p,
Abc_Obj_t pObj,
float  D 
)
inlinestatic

Definition at line 124 of file sclSize.h.

124 { return D - (Abc_SclObjTime(p, pObj)->fall + Abc_SclObjDept(p, pObj)->fall); }
static SC_Pair * Abc_SclObjDept(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:114
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static SC_Pair * Abc_SclObjTime(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:115
float fall
Definition: sclLib.h:66
static float Abc_SclObjGetSlackR ( SC_Man p,
Abc_Obj_t pObj,
float  D 
)
inlinestatic

Definition at line 123 of file sclSize.h.

123 { return D - (Abc_SclObjTime(p, pObj)->rise + Abc_SclObjDept(p, pObj)->rise); }
static SC_Pair * Abc_SclObjDept(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:114
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static SC_Pair * Abc_SclObjTime(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:115
float rise
Definition: sclLib.h:65
static float Abc_SclObjInDrive ( SC_Man p,
Abc_Obj_t pObj 
)
inlinestatic

Definition at line 128 of file sclSize.h.

128 { return Vec_FltEntry( p->vInDrive, pObj->iData ); }
int iData
Definition: abc.h:146
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static float Vec_FltEntry(Vec_Flt_t *p, int i)
Definition: vecFlt.h:342
static SC_Lib* Abc_SclObjLib ( Abc_Obj_t p)
inlinestatic

GLOBAL VARIABLES ///.

MACRO DEFINITIONS ///

Definition at line 108 of file sclSize.h.

108 { return (SC_Lib *)p->pNtk->pSCLib; }
void * pSCLib
Definition: abc.h:206
Abc_Ntk_t * pNtk
Definition: abc.h:130
static SC_Pair* Abc_SclObjLoad ( SC_Man p,
Abc_Obj_t pObj 
)
inlinestatic

Definition at line 113 of file sclSize.h.

113 { return p->pLoads + Abc_ObjId(pObj); }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static float Abc_SclObjLoadAve ( SC_Man p,
Abc_Obj_t pObj 
)
inlinestatic

Definition at line 119 of file sclSize.h.

119 { return 0.5 * Abc_SclObjLoad(p, pObj)->rise + 0.5 * Abc_SclObjLoad(p, pObj)->fall; }
static SC_Pair * Abc_SclObjLoad(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:113
static Llb_Mgr_t * p
Definition: llb3Image.c:950
float rise
Definition: sclLib.h:65
float fall
Definition: sclLib.h:66
static double Abc_SclObjLoadMax ( SC_Man p,
Abc_Obj_t pObj 
)
inlinestatic

Definition at line 118 of file sclSize.h.

118 { return Abc_MaxFloat(Abc_SclObjLoad(p, pObj)->rise, Abc_SclObjLoad(p, pObj)->fall); }
static SC_Pair * Abc_SclObjLoad(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:113
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
static SC_Cell* Abc_SclObjResiable ( SC_Man p,
Abc_Obj_t pObj,
int  fUpsize 
)
inlinestatic

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 490 of file sclSize.h.

491 {
492  SC_Cell * pOld = Abc_SclObjCell(pObj);
493  if ( fUpsize )
494  return pOld->pNext->Order > pOld->Order ? pOld->pNext : NULL;
495  else
496  return pOld->pPrev->Order < pOld->Order ? pOld->pPrev : NULL;
497 }
int Order
Definition: sclLib.h:198
SC_Cell * pPrev
Definition: sclLib.h:195
SC_Cell * pNext
Definition: sclLib.h:194
static SC_Cell * Abc_SclObjCell(Abc_Obj_t *p)
Definition: sclSize.h:110
static void Abc_SclObjSetCell ( Abc_Obj_t p,
SC_Cell pCell 
)
inlinestatic

Definition at line 111 of file sclSize.h.

111 { Vec_IntWriteEntry( p->pNtk->vGates, Abc_ObjId(p), pCell->Id ); }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
Vec_Int_t * vGates
Definition: abc.h:207
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
int Id
Definition: sclLib.h:184
Abc_Ntk_t * pNtk
Definition: abc.h:130
static void Abc_SclObjSetInDrive ( SC_Man p,
Abc_Obj_t pObj,
float  c 
)
inlinestatic

Definition at line 129 of file sclSize.h.

129 { Vec_FltWriteEntry( p->vInDrive, pObj->iData, c ); }
static void Vec_FltWriteEntry(Vec_Flt_t *p, int i, float Entry)
Definition: vecFlt.h:364
int iData
Definition: abc.h:146
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static double Abc_SclObjSlackMax ( SC_Man p,
Abc_Obj_t pObj,
float  D 
)
inlinestatic

Definition at line 126 of file sclSize.h.

126 { return Abc_SclObjGetSlack(p, pObj, D); }
static float Abc_SclObjGetSlack(SC_Man *p, Abc_Obj_t *pObj, float D)
Definition: sclSize.h:125
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static SC_Pair* Abc_SclObjSlew ( SC_Man p,
Abc_Obj_t pObj 
)
inlinestatic

Definition at line 116 of file sclSize.h.

116 { return p->pSlews + Abc_ObjId(pObj); }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static double Abc_SclObjSlewMax ( SC_Man p,
Abc_Obj_t pObj 
)
inlinestatic

Definition at line 122 of file sclSize.h.

122 { return Abc_MaxFloat(Abc_SclObjSlew(p, pObj)->rise, Abc_SclObjSlew(p, pObj)->fall); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
static SC_Pair * Abc_SclObjSlew(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:116
static SC_Pair* Abc_SclObjTime ( SC_Man p,
Abc_Obj_t pObj 
)
inlinestatic

Definition at line 115 of file sclSize.h.

115 { return p->pTimes + Abc_ObjId(pObj); }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static float Abc_SclObjTimeMax ( SC_Man p,
Abc_Obj_t pObj 
)
inlinestatic

Definition at line 121 of file sclSize.h.

121 { return Abc_MaxFloat(Abc_SclObjTime(p, pObj)->rise, Abc_SclObjTime(p, pObj)->fall); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
static SC_Pair * Abc_SclObjTime(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:115
static double Abc_SclObjTimeOne ( SC_Man p,
Abc_Obj_t pObj,
int  fRise 
)
inlinestatic

Definition at line 120 of file sclSize.h.

120 { return fRise ? Abc_SclObjTime(p, pObj)->rise : Abc_SclObjTime(p, pObj)->fall; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static SC_Pair * Abc_SclObjTime(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:115
float rise
Definition: sclLib.h:65
float fall
Definition: sclLib.h:66
Abc_Ntk_t* Abc_SclPerformBuffering ( Abc_Ntk_t p,
int  DegreeR,
int  Degree,
int  fUseInvs,
int  fVerbose 
)

Definition at line 457 of file sclBuffer.c.

458 {
459  Vec_Int_t * vCiLevs;
460  Abc_Ntk_t * pNew;
461  Abc_Obj_t * pObj;
462  int i;
464  if ( fUseInvs )
465  {
466  printf( "Warning!!! Using inverters instead of buffers.\n" );
467  if ( p->vPhases == NULL )
468  printf( "The phases are not given. The result will not verify.\n" );
469  }
470  // remember CI levels
471  vCiLevs = Vec_IntAlloc( Abc_NtkCiNum(p) );
472  Abc_NtkForEachCi( p, pObj, i )
473  Vec_IntPush( vCiLevs, Abc_ObjLevel(pObj) );
474  // perform buffering
476  Abc_NtkForEachCi( p, pObj, i )
477  Abc_SclPerformBuffering_rec( pObj, DegreeR, Degree, fUseInvs, fVerbose );
478  // recompute logic levels
479  Abc_NtkForEachCi( p, pObj, i )
480  pObj->Level = Vec_IntEntry( vCiLevs, i );
481  Abc_NtkForEachNode( p, pObj, i )
482  Abc_ObjLevelNew( pObj );
483  Vec_IntFree( vCiLevs );
484  // if phases are present
485  if ( p->vPhases )
486  Vec_IntFillExtra( p->vPhases, Abc_NtkObjNumMax(p), 0 );
487  // duplication in topo order
488  pNew = Abc_NtkDupDfs( p );
489  Abc_SclCheckNtk( pNew, fVerbose );
490 // Abc_NtkDelete( pNew );
491  return pNew;
492 }
void Abc_SclPerformBuffering_rec(Abc_Obj_t *pObj, int DegreeR, int Degree, int fUseInvs, int fVerbose)
Definition: sclBuffer.c:417
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static void Vec_IntFillExtra(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:376
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int Abc_SclCheckNtk(Abc_Ntk_t *p, int fVerbose)
Definition: sclBuffer.c:286
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Abc_ObjLevel(Abc_Obj_t *pObj)
Definition: abc.h:330
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
Vec_Int_t * vPhases
Definition: abc.h:208
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
ABC_DLL Abc_Ntk_t * Abc_NtkDupDfs(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:476
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
ABC_DLL int Abc_ObjLevelNew(Abc_Obj_t *pObj)
Definition: abcTiming.c:1058
void Abc_SclPrintBuffers ( SC_Lib pLib,
Abc_Ntk_t pNtk,
int  fVerbose 
)

Definition at line 876 of file sclSize.c.

877 {
878  int fUseWireLoads = 0;
879  SC_Man * p;
880  assert( Abc_NtkIsMappedLogic(pNtk) );
881  p = Abc_SclManStart( pLib, pNtk, fUseWireLoads, 1, 0, 10000 );
882  Abc_SclPrintBufferTrees( p, pNtk );
883 // Abc_SclPrintFaninPairs( p, pNtk );
884  Abc_SclManFree( p );
885 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_HEADER_START struct SC_Man_ SC_Man
INCLUDES ///.
Definition: sclSize.h:44
static void Abc_SclManFree(SC_Man *p)
Definition: sclSize.h:192
static int Abc_NtkIsMappedLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:267
void Abc_SclPrintBufferTrees(SC_Man *p, Abc_Ntk_t *pNtk)
Definition: sclSize.c:860
#define assert(ex)
Definition: util_old.h:213
SC_Man * Abc_SclManStart(SC_Lib *pLib, Abc_Ntk_t *pNtk, int fUseWireLoads, int fDept, float DUser, int nTreeCRatio)
Definition: sclSize.c:633
void Abc_SclPrintGateSizes ( SC_Lib pLib,
Abc_Ntk_t p 
)

Definition at line 137 of file sclUtil.c.

138 {
139  Abc_SclMioGates2SclGates( pLib, p );
140  Abc_SclManPrintGateSizes( pLib, p, p->vGates );
141  Abc_SclSclGates2MioGates( pLib, p );
142  Vec_IntFreeP( &p->vGates );
143  p->pSCLib = NULL;
144 }
void Abc_SclSclGates2MioGates(SC_Lib *pLib, Abc_Ntk_t *p)
Definition: sclUtil.c:73
void * pSCLib
Definition: abc.h:206
Vec_Int_t * vGates
Definition: abc.h:207
ABC_NAMESPACE_IMPL_START void Abc_SclMioGates2SclGates(SC_Lib *pLib, Abc_Ntk_t *p)
DECLARATIONS ///.
Definition: sclUtil.c:47
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
void Abc_SclManPrintGateSizes(SC_Lib *pLib, Abc_Ntk_t *p, Vec_Int_t *vGates)
Definition: sclUtil.c:109
static float Abc_SclReadMaxDelay ( SC_Man p)
inlinestatic

Definition at line 474 of file sclSize.h.

475 {
476  return Abc_SclObjTimeMax( p, Abc_NtkCo(p->pNtk, Vec_QueTop(p->vQue)) );
477 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_QueTop(Vec_Que_t *p)
Definition: vecQue.h:139
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:318
static float Abc_SclObjTimeMax(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:121
void Abc_SclReportDupFanins ( Abc_Ntk_t pNtk)

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Make sure fanins of gates are not duplicated.]

Description []

SideEffects []

SeeAlso []

Definition at line 90 of file sclBuffer.c.

91 {
92  Abc_Obj_t * pObj, * pFanin, * pFanin2;
93  int i, k, k2;
94  Abc_NtkForEachNode( pNtk, pObj, i )
95  Abc_ObjForEachFanin( pObj, pFanin, k )
96  Abc_ObjForEachFanin( pObj, pFanin2, k2 )
97  if ( k != k2 && pFanin == pFanin2 )
98  printf( "Node %d has dup fanin %d.\n", i, Abc_ObjId(pFanin) );
99 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
if(last==0)
Definition: sparse_int.h:34
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
void Abc_SclSclGates2MioGates ( SC_Lib pLib,
Abc_Ntk_t p 
)

Definition at line 73 of file sclUtil.c.

74 {
75  Abc_Obj_t * pObj;
76  SC_Cell * pCell;
77  int i, Counter = 0, CounterAll = 0;
78  assert( p->vGates != NULL );
79  Abc_NtkForEachNode1( p, pObj, i )
80  {
81  pCell = Abc_SclObjCell(pObj);
82  assert( pCell->n_inputs == Abc_ObjFaninNum(pObj) );
83  if ( Abc_ObjIsBarBuf(pObj) )
84  pObj->pData = NULL;
85  else
86  pObj->pData = Mio_LibraryReadGateByName( (Mio_Library_t *)p->pManFunc, pCell->pName, NULL );
87  Counter += (pObj->pData == NULL);
88  assert( pObj->fMarkA == 0 && pObj->fMarkB == 0 );
89  CounterAll++;
90  }
91  if ( Counter )
92  printf( "Could not find %d (out of %d) gates in the current library.\n", Counter, CounterAll );
93  Vec_IntFreeP( &p->vGates );
94  p->pSCLib = NULL;
95 }
#define Abc_NtkForEachNode1(pNtk, pNode, i)
Definition: abc.h:467
Mio_Gate_t * Mio_LibraryReadGateByName(Mio_Library_t *pLib, char *pName, char *pOutName)
Definition: mioApi.c:99
void * pSCLib
Definition: abc.h:206
unsigned fMarkA
Definition: abc.h:134
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_ObjIsBarBuf(Abc_Obj_t *pObj)
Definition: abc.h:360
Vec_Int_t * vGates
Definition: abc.h:207
void * pManFunc
Definition: abc.h:191
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
char * pName
Definition: sclLib.h:183
static int Counter
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
unsigned fMarkB
Definition: abc.h:135
int n_inputs
Definition: sclLib.h:192
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
static SC_Cell * Abc_SclObjCell(Abc_Obj_t *p)
Definition: sclSize.h:110
void Abc_SclTimeCone ( SC_Man p,
Vec_Int_t vCone 
)

Definition at line 383 of file sclSize.c.

384 {
385  int fVerbose = 0;
386  Abc_Obj_t * pObj;
387  int i;
388  Abc_SclConeClean( p, vCone );
389  Abc_NtkForEachObjVec( vCone, p->pNtk, pObj, i )
390  {
391  if ( fVerbose && Abc_ObjIsNode(pObj) )
392  printf( " Updating node %d with gate %s\n", Abc_ObjId(pObj), Abc_SclObjCell(pObj)->pName );
393  if ( fVerbose && Abc_ObjIsNode(pObj) )
394  printf( " before (%6.1f ps %6.1f ps) ", Abc_SclObjTimeOne(p, pObj, 1), Abc_SclObjTimeOne(p, pObj, 0) );
395  Abc_SclTimeNode( p, pObj, 0 );
396  if ( fVerbose && Abc_ObjIsNode(pObj) )
397  printf( "after (%6.1f ps %6.1f ps)\n", Abc_SclObjTimeOne(p, pObj, 1), Abc_SclObjTimeOne(p, pObj, 0) );
398  }
399 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
void Abc_SclTimeNode(SC_Man *p, Abc_Obj_t *pObj, int fDept)
Definition: sclSize.c:308
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static double Abc_SclObjTimeOne(SC_Man *p, Abc_Obj_t *pObj, int fRise)
Definition: sclSize.h:120
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static void Abc_SclConeClean(SC_Man *p, Vec_Int_t *vCone)
Definition: sclSize.h:406
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
Definition: abc.h:452
static SC_Cell * Abc_SclObjCell(Abc_Obj_t *p)
Definition: sclSize.h:110
void Abc_SclTimeIncInsert ( SC_Man p,
Abc_Obj_t pObj 
)

Definition at line 562 of file sclSize.c.

563 {
564  Vec_IntPush( p->vChanged, Abc_ObjId(pObj) );
565 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
int Abc_SclTimeIncUpdate ( SC_Man p)

Definition at line 540 of file sclSize.c.

541 {
542  Abc_Obj_t * pObj;
543  int i, RetValue;
544  if ( Vec_IntSize(p->vChanged) == 0 )
545  return 0;
546 // Abc_SclTimeIncCheckLevel( p->pNtk );
547  Abc_NtkForEachObjVec( p->vChanged, p->pNtk, pObj, i )
548  {
549  Abc_SclTimeIncAddFanins( p, pObj );
550  if ( pObj->fMarkC )
551  continue;
552  Abc_SclTimeIncAddNode( p, pObj );
553  }
554  Vec_IntClear( p->vChanged );
558  RetValue = p->nIncUpdates;
559  p->nIncUpdates = 0;
560  return RetValue;
561 }
static void Abc_SclTimeIncAddFanins(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.c:463
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
Definition: abc.h:452
unsigned fMarkC
Definition: abc.h:136
static void Abc_SclTimeIncUpdateClean(SC_Man *p)
Definition: sclSize.c:440
static void Abc_SclTimeIncAddNode(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.c:455
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Abc_SclTimeIncUpdateDeparture(SC_Man *p)
Definition: sclSize.c:511
static void Abc_SclTimeIncUpdateArrival(SC_Man *p)
Definition: sclSize.c:480
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
void Abc_SclTimeIncUpdateLevel ( Abc_Obj_t pObj)

Definition at line 576 of file sclSize.c.

577 {
579 }
void Abc_SclTimeIncUpdateLevel_rec(Abc_Obj_t *pObj)
Definition: sclSize.c:566
void Abc_SclTimeNtkPrint ( SC_Man p,
int  fShowAll,
int  fPrintPath 
)

Definition at line 136 of file sclSize.c.

137 {
138  int fReversePath = 1;
139  int i, nLength = 0, fRise = 0;
140  Abc_Obj_t * pObj, * pPivot = Abc_SclFindCriticalCo( p, &fRise );
141  float maxDelay = Abc_SclObjTimeOne( p, pPivot, fRise );
142  p->ReportDelay = maxDelay;
143 
144 #ifdef WIN32
145  printf( "WireLoad = \"%s\" ", p->pWLoadUsed ? p->pWLoadUsed->pName : "none" );
146  SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 14 ); // yellow
147  printf( "Gates =%7d ", Abc_NtkNodeNum(p->pNtk) );
148  SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 7 ); // normal
149  printf( "(%5.1f %%) ", 100.0 * Abc_SclGetBufInvCount(p->pNtk) / Abc_NtkNodeNum(p->pNtk) );
150  SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 10 ); // green
151  printf( "Cap =%5.1f ff ", p->EstLoadAve );
152  SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 7 ); // normal
153  printf( "(%5.1f %%) ", Abc_SclGetAverageSize(p->pNtk) );
154  SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 11 ); // blue
155  printf( "Area =%12.2f ", Abc_SclGetTotalArea(p->pNtk) );
156  SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 7 ); // normal
157  printf( "(%5.1f %%) ", 100.0 * Abc_SclCountMinSize(p->pLib, p->pNtk, 0) / Abc_NtkNodeNum(p->pNtk) );
158  SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 13 ); // magenta
159  printf( "Delay =%9.2f ps ", maxDelay );
160  SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 7 ); // normal
161  printf( "(%5.1f %%) ", 100.0 * Abc_SclCountNearCriticalNodes(p) / Abc_NtkNodeNum(p->pNtk) );
162  printf( " \n" );
163 #else
164  Abc_Print( 1, "WireLoad = \"%s\" ", p->pWLoadUsed ? p->pWLoadUsed->pName : "none" );
165  Abc_Print( 1, "%sGates =%7d%s ", "\033[1;33m", Abc_NtkNodeNum(p->pNtk), "\033[0m" ); // yellow
166  Abc_Print( 1, "(%5.1f %%) ", 100.0 * Abc_SclGetBufInvCount(p->pNtk) / Abc_NtkNodeNum(p->pNtk) );
167  Abc_Print( 1, "%sCap =%5.1f ff%s ", "\033[1;32m", p->EstLoadAve, "\033[0m" ); // green
168  Abc_Print( 1, "(%5.1f %%) ", Abc_SclGetAverageSize(p->pNtk) );
169  Abc_Print( 1, "%sArea =%12.2f%s ", "\033[1;36m", Abc_SclGetTotalArea(p->pNtk), "\033[0m" ); // blue
170  Abc_Print( 1, "(%5.1f %%) ", 100.0 * Abc_SclCountMinSize(p->pLib, p->pNtk, 0) / Abc_NtkNodeNum(p->pNtk) );
171  Abc_Print( 1, "%sDelay =%9.2f ps%s ", "\033[1;35m", maxDelay, "\033[0m" ); // magenta
172  Abc_Print( 1, "(%5.1f %%) ", 100.0 * Abc_SclCountNearCriticalNodes(p) / Abc_NtkNodeNum(p->pNtk) );
173  Abc_Print( 1, " \n" );
174 #endif
175 
176  if ( fShowAll )
177  {
178 // printf( "Timing information for all nodes: \n" );
179  // find the longest cell name
180  Abc_NtkForEachNodeReverse( p->pNtk, pObj, i )
181  if ( Abc_ObjFaninNum(pObj) > 0 )
182  nLength = Abc_MaxInt( nLength, strlen(Abc_SclObjCell(pObj)->pName) );
183  // print timing
184  Abc_NtkForEachNodeReverse( p->pNtk, pObj, i )
185  if ( Abc_ObjFaninNum(pObj) > 0 )
186  Abc_SclTimeNodePrint( p, pObj, -1, nLength, maxDelay );
187  }
188  if ( fPrintPath )
189  {
190  Abc_Obj_t * pTemp, * pPrev = NULL;
191  int iStart = -1, iEnd = -1;
192  Vec_Ptr_t * vPath;
193 // printf( "Critical path: \n" );
194  // find the longest cell name
195  pObj = Abc_ObjFanin0(pPivot);
196  i = 0;
197  while ( pObj && Abc_ObjIsNode(pObj) )
198  {
199  i++;
200  nLength = Abc_MaxInt( nLength, strlen(Abc_SclObjCell(pObj)->pName) );
201  pObj = Abc_SclFindMostCriticalFanin( p, &fRise, pObj );
202  }
203 
204  // print timing
205  if ( !fReversePath )
206  {
207  // print timing
208  pObj = Abc_ObjFanin0(pPivot);
209  while ( pObj )//&& Abc_ObjIsNode(pObj) )
210  {
211  printf( "Path%3d --", i-- );
212  Abc_SclTimeNodePrint( p, pObj, fRise, nLength, maxDelay );
213  pPrev = pObj;
214  pObj = Abc_SclFindMostCriticalFanin( p, &fRise, pObj );
215  }
216  }
217  else
218  {
219  // collect path nodes
220  vPath = Vec_PtrAlloc( 100 );
221  Vec_PtrPush( vPath, pPivot );
222  pObj = Abc_ObjFanin0(pPivot);
223  while ( pObj )//&& Abc_ObjIsNode(pObj) )
224  {
225  Vec_PtrPush( vPath, pObj );
226  pPrev = pObj;
227  pObj = Abc_SclFindMostCriticalFanin( p, &fRise, pObj );
228  }
229  Vec_PtrForEachEntryReverse( Abc_Obj_t *, vPath, pObj, i )
230  {
231  printf( "Path%3d --", Vec_PtrSize(vPath)-1-i );
232  Abc_SclTimeNodePrint( p, pObj, fRise, nLength, maxDelay );
233  if ( i == 1 )
234  break;
235  }
236  Vec_PtrFree( vPath );
237  }
238  // print start-point and end-point
239  Abc_NtkForEachPi( p->pNtk, pTemp, iStart )
240  if ( pTemp == pPrev )
241  break;
242  Abc_NtkForEachPo( p->pNtk, pTemp, iEnd )
243  if ( pTemp == pPivot )
244  break;
245  printf( "Start-point = pi%0*d. End-point = po%0*d.\n",
246  Abc_Base10Log( Abc_NtkPiNum(p->pNtk) ), iStart,
247  Abc_Base10Log( Abc_NtkPoNum(p->pNtk) ), iEnd );
248  }
249 }
int Abc_SclCountNearCriticalNodes(SC_Man *p)
Definition: sclUpsize.c:187
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Abc_Obj_t * Abc_SclFindMostCriticalFanin(SC_Man *p, int *pfRise, Abc_Obj_t *pNode)
Definition: sclSize.c:84
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Vec_PtrForEachEntryReverse(Type, vVec, pEntry, i)
Definition: vecPtr.h:63
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static double Abc_SclObjTimeOne(SC_Man *p, Abc_Obj_t *pObj, int fRise)
Definition: sclSize.h:120
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 Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_SclGetBufInvCount(Abc_Ntk_t *pNtk)
Definition: sclSize.h:429
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static float Abc_SclGetTotalArea(Abc_Ntk_t *pNtk)
Definition: sclSize.h:446
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
static int Abc_Base10Log(unsigned n)
Definition: abc_global.h:252
if(last==0)
Definition: sparse_int.h:34
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static void Abc_SclTimeNodePrint(SC_Man *p, Abc_Obj_t *pObj, int fRise, int Length, float maxDelay)
Definition: sclSize.c:117
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
ABC_NAMESPACE_IMPL_START Abc_Obj_t * Abc_SclFindCriticalCo(SC_Man *p, int *pfRise)
DECLARATIONS ///.
Definition: sclSize.c:52
#define Abc_NtkForEachNodeReverse(pNtk, pNode, i)
Definition: abc.h:473
int strlen()
static float Abc_SclGetAverageSize(Abc_Ntk_t *pNtk)
Definition: sclSize.h:437
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
int Abc_SclCountMinSize(SC_Lib *pLib, Abc_Ntk_t *p, int fUseMax)
Definition: sclUtil.c:203
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static SC_Cell * Abc_SclObjCell(Abc_Obj_t *p)
Definition: sclSize.h:110
void Abc_SclTimeNtkRecompute ( SC_Man p,
float *  pArea,
float *  pDelay,
int  fReverse,
float  DUser 
)

Definition at line 400 of file sclSize.c.

401 {
402  Abc_Obj_t * pObj;
403  float D;
404  int i;
407  p->nEstNodes = 0;
408  Abc_NtkForEachCi( p->pNtk, pObj, i )
409  Abc_SclTimeNode( p, pObj, 0 );
410  Abc_NtkForEachNode1( p->pNtk, pObj, i )
411  Abc_SclTimeNode( p, pObj, 0 );
412  Abc_NtkForEachCo( p->pNtk, pObj, i )
413  Abc_SclTimeNode( p, pObj, 0 );
414  D = Abc_SclReadMaxDelay( p );
415  if ( fReverse && DUser > 0 && D < DUser )
416  D = DUser;
417  if ( pArea )
418  *pArea = Abc_SclGetTotalArea(p->pNtk);
419  if ( pDelay )
420  *pDelay = D;
421  if ( fReverse )
422  {
423  p->nEstNodes = 0;
424  Abc_NtkForEachNodeReverse1( p->pNtk, pObj, i )
425  Abc_SclTimeNode( p, pObj, 1 );
426  }
427 }
#define Abc_NtkForEachNode1(pNtk, pNode, i)
Definition: abc.h:467
static float Abc_SclReadMaxDelay(SC_Man *p)
Definition: sclSize.h:474
void Abc_SclTimeNode(SC_Man *p, Abc_Obj_t *pObj, int fDept)
Definition: sclSize.c:308
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Abc_SclComputeLoad(SC_Man *p)
Definition: sclLoad.c:106
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
#define Abc_NtkForEachNodeReverse1(pNtk, pNode, i)
Definition: abc.h:476
static float Abc_SclGetTotalArea(Abc_Ntk_t *pNtk)
Definition: sclSize.h:446
if(last==0)
Definition: sparse_int.h:34
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static void Abc_SclManCleanTime(SC_Man *p)
Definition: sclSize.h:256
void Abc_SclTimePerform ( SC_Lib pLib,
Abc_Ntk_t pNtk,
int  nTreeCRatio,
int  fUseWireLoads,
int  fShowAll,
int  fPrintPath,
int  fDumpStats 
)

Function*************************************************************

Synopsis [Printing out timing information for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 671 of file sclSize.c.

672 {
673  SC_Man * p;
674  p = Abc_SclManStart( pLib, pNtk, fUseWireLoads, 1, 0, nTreeCRatio );
675  Abc_SclTimeNtkPrint( p, fShowAll, fPrintPath );
676  if ( fDumpStats )
677  Abc_SclDumpStats( p, "stats.txt", 0 );
678  Abc_SclManFree( p );
679 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_HEADER_START struct SC_Man_ SC_Man
INCLUDES ///.
Definition: sclSize.h:44
static void Abc_SclManFree(SC_Man *p)
Definition: sclSize.h:192
static void Abc_SclDumpStats(SC_Man *p, char *pFileName, abctime Time)
Definition: sclSize.h:510
SC_Man * Abc_SclManStart(SC_Lib *pLib, Abc_Ntk_t *pNtk, int fUseWireLoads, int fDept, float DUser, int nTreeCRatio)
Definition: sclSize.c:633
void Abc_SclTimeNtkPrint(SC_Man *p, int fShowAll, int fPrintPath)
Definition: sclSize.c:136
Abc_Ntk_t* Abc_SclUnBufferPerform ( Abc_Ntk_t pNtk,
int  fVerbose 
)

Definition at line 129 of file sclBuffer.c.

130 {
131  Vec_Int_t * vLits;
132  Abc_Obj_t * pObj, * pFanin, * pFaninNew;
133  int i, k, iLit, nNodesOld = Abc_NtkObjNumMax(pNtk);
134  // assign inverters
135  vLits = Vec_IntStartFull( Abc_NtkObjNumMax(pNtk) );
136  Abc_NtkForEachNode( pNtk, pObj, i )
137  if ( Abc_SclIsInv(pObj) && !Abc_SclObjIsBufInv(Abc_ObjFanin0(pObj)) )
138  Vec_IntWriteEntry( vLits, Abc_ObjFaninId0(pObj), Abc_ObjId(pObj) );
139  // transfer fanins
140  Abc_NtkForEachNodeCo( pNtk, pObj, i )
141  {
142  if ( i >= nNodesOld )
143  break;
144  Abc_ObjForEachFanin( pObj, pFanin, k )
145  {
146  if ( !Abc_SclObjIsBufInv(pFanin) )
147  continue;
148  iLit = Abc_SclGetRealFaninLit( pFanin );
149  pFaninNew = Abc_NtkObj( pNtk, Abc_Lit2Var(iLit) );
150  if ( Abc_LitIsCompl(iLit) )
151  {
152  if ( Vec_IntEntry( vLits, Abc_Lit2Var(iLit) ) == -1 )
153  {
154  pFaninNew = Abc_NtkCreateNodeInv( pNtk, pFaninNew );
155  Vec_IntWriteEntry( vLits, Abc_Lit2Var(iLit), Abc_ObjId(pFaninNew) );
156  }
157  else
158  pFaninNew = Abc_NtkObj( pNtk, Vec_IntEntry( vLits, Abc_Lit2Var(iLit) ) );
159  assert( Abc_ObjFaninNum(pFaninNew) == 1 );
160  }
161  if ( pFanin != pFaninNew )
162  Abc_ObjPatchFanin( pObj, pFanin, pFaninNew );
163  }
164  }
165  Vec_IntFree( vLits );
166  // duplicate network in topo order
167  return Abc_NtkDupDfs( pNtk );
168 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
int Abc_SclIsInv(Abc_Obj_t *pObj)
Definition: sclBuffer.c:116
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
static Vec_Int_t * Vec_IntStartFull(int nSize)
Definition: vecInt.h:119
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_ObjFaninId0(Abc_Obj_t *pObj)
Definition: abc.h:367
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition: abcFanio.c:172
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeInv(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition: abcObj.c:662
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
ABC_DLL Abc_Ntk_t * Abc_NtkDupDfs(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:476
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
static int Abc_SclObjIsBufInv(Abc_Obj_t *pObj)
Definition: sclBuffer.c:112
#define Abc_NtkForEachNodeCo(pNtk, pNode, i)
Definition: abc.h:491
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
int Abc_SclGetRealFaninLit(Abc_Obj_t *pObj)
Definition: sclBuffer.c:121
Abc_Ntk_t* Abc_SclUnBufferPhase ( Abc_Ntk_t pNtk,
int  fVerbose 
)

Definition at line 239 of file sclBuffer.c.

240 {
241  Abc_Ntk_t * pNtkNew;
242  Abc_Obj_t * pObj, * pFanin, * pFaninNew;
243  int i, k, iLit, Counter = 0, Total = 0;
244  assert( pNtk->vPhases == NULL );
245  pNtk->vPhases = Vec_IntStart( Abc_NtkObjNumMax(pNtk) );
246  Abc_NtkForEachNodeCo( pNtk, pObj, i )
247  {
248  if ( Abc_SclObjIsBufInv(pObj) )
249  continue;
250  Abc_ObjForEachFanin( pObj, pFanin, k )
251  {
252  Total++;
253  iLit = Abc_SclGetRealFaninLit( pFanin );
254  pFaninNew = Abc_NtkObj( pNtk, Abc_Lit2Var(iLit) );
255  if ( pFaninNew == pFanin )
256  continue;
257  // skip fanins which are already fanins of the node
258  if ( Abc_NodeFindFanin( pObj, pFaninNew ) >= 0 )
259  continue;
260  Abc_ObjPatchFanin( pObj, pFanin, pFaninNew );
261  if ( Abc_LitIsCompl(iLit) )
262  Abc_ObjFaninFlipPhase( pObj, k ), Counter++;
263  }
264  }
265  if ( fVerbose )
266  printf( "Saved %d (%.2f %%) fanin phase bits. ", Counter, 100.0 * Counter / Total );
267  // duplicate network in topo order
268  pNtkNew = Abc_NtkDupDfs( pNtk );
269  if ( fVerbose )
270  printf( "Max depth = %d.\n", Abc_SclCountMaxPhases(pNtkNew) );
271  Abc_SclReportDupFanins( pNtkNew );
272  return pNtkNew;
273 }
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
ABC_DLL int Abc_NodeFindFanin(Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
Definition: abcUtil.c:758
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
void Abc_SclReportDupFanins(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: sclBuffer.c:90
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
Definition: abcFanio.c:172
int Abc_SclCountMaxPhases(Abc_Ntk_t *pNtk)
Definition: sclBuffer.c:181
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
Vec_Int_t * vPhases
Definition: abc.h:208
static int Counter
ABC_DLL Abc_Ntk_t * Abc_NtkDupDfs(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:476
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
static int Abc_SclObjIsBufInv(Abc_Obj_t *pObj)
Definition: sclBuffer.c:112
#define Abc_NtkForEachNodeCo(pNtk, pNode, i)
Definition: abc.h:491
#define assert(ex)
Definition: util_old.h:213
static void Abc_ObjFaninFlipPhase(Abc_Obj_t *p, int i)
Definition: abc.h:393
int Abc_SclGetRealFaninLit(Abc_Obj_t *pObj)
Definition: sclBuffer.c:121
void Abc_SclUpdateLoad ( SC_Man p,
Abc_Obj_t pObj,
SC_Cell pOld,
SC_Cell pNew 
)

Function*************************************************************

Synopsis [Updates load of the node's fanins.]

Description []

SideEffects []

SeeAlso []

Definition at line 199 of file sclLoad.c.

200 {
201  Abc_Obj_t * pFanin;
202  int k;
203  Abc_ObjForEachFanin( pObj, pFanin, k )
204  {
205  SC_Pair * pLoad = Abc_SclObjLoad( p, pFanin );
206  SC_Pin * pPinOld = SC_CellPin( pOld, k );
207  SC_Pin * pPinNew = SC_CellPin( pNew, k );
208  pLoad->rise += pPinNew->rise_cap - pPinOld->rise_cap;
209  pLoad->fall += pPinNew->fall_cap - pPinOld->fall_cap;
210  }
211 }
static SC_Pair * Abc_SclObjLoad(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:113
static Llb_Mgr_t * p
Definition: llb3Image.c:950
float fall_cap
Definition: sclLib.h:173
float rise
Definition: sclLib.h:65
float fall
Definition: sclLib.h:66
static SC_Pin * SC_CellPin(SC_Cell *p, int i)
Definition: sclLib.h:241
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
float rise_cap
Definition: sclLib.h:172
void Abc_SclUpdateLoadSplit ( SC_Man p,
Abc_Obj_t pBuffer,
Abc_Obj_t pFanout 
)

Definition at line 212 of file sclLoad.c.

213 {
214  SC_Pin * pPin;
215  SC_Pair * pLoad;
216  int iFanin = Abc_NodeFindFanin( pFanout, pBuffer );
217  assert( iFanin >= 0 );
218  assert( Abc_ObjFaninNum(pBuffer) == 1 );
219  pPin = SC_CellPin( Abc_SclObjCell(pFanout), iFanin );
220  // update load of the buffer
221  pLoad = Abc_SclObjLoad( p, pBuffer );
222  pLoad->rise -= pPin->rise_cap;
223  pLoad->fall -= pPin->fall_cap;
224  // update load of the fanin
225  pLoad = Abc_SclObjLoad( p, Abc_ObjFanin0(pBuffer) );
226  pLoad->rise += pPin->rise_cap;
227  pLoad->fall += pPin->fall_cap;
228 }
static SC_Pair * Abc_SclObjLoad(SC_Man *p, Abc_Obj_t *pObj)
Definition: sclSize.h:113
static Llb_Mgr_t * p
Definition: llb3Image.c:950
float fall_cap
Definition: sclLib.h:173
ABC_DLL int Abc_NodeFindFanin(Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
Definition: abcUtil.c:758
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
float rise
Definition: sclLib.h:65
float fall
Definition: sclLib.h:66
static SC_Pin * SC_CellPin(SC_Cell *p, int i)
Definition: sclLib.h:241
#define assert(ex)
Definition: util_old.h:213
float rise_cap
Definition: sclLib.h:172
static SC_Cell * Abc_SclObjCell(Abc_Obj_t *p)
Definition: sclSize.h:110
void Abc_SclUpsizePerform ( SC_Lib pLib,
Abc_Ntk_t pNtk,
SC_SizePars pPars 
)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 868 of file sclUpsize.c.

869 {
870  SC_Man * p;
871  Vec_Int_t * vPathPos = NULL; // critical POs
872  Vec_Int_t * vPathNodes = NULL; // critical nodes and PIs
873  abctime clk, nRuntimeLimit = pPars->TimeOut ? pPars->TimeOut * CLOCKS_PER_SEC + Abc_Clock() : 0;
874  int i = 0, win, nUpsizes = -1, nFramesNoChange = 0, nConeSize = 0;
875  int nAllPos, nAllNodes, nAllTfos, nAllUpsizes;
876  if ( pPars->fVerbose )
877  {
878  printf( "Parameters: " );
879  printf( "Iters =%5d. ", pPars->nIters );
880  printf( "Time win =%3d %%. ", pPars->Window );
881  printf( "Update ratio =%3d %%. ", pPars->Ratio );
882  printf( "UseDept =%2d. ", pPars->fUseDept );
883  printf( "UseWL =%2d. ", pPars->fUseWireLoads );
884  printf( "Target =%5d ps. ", pPars->DelayUser );
885  printf( "DelayGap =%3d ps. ", pPars->DelayGap );
886  printf( "Timeout =%4d sec", pPars->TimeOut );
887  printf( "\n" );
888  }
889  // increase window for larger networks
890  if ( pPars->Window == 1 )
891  pPars->Window += (Abc_NtkNodeNum(pNtk) > 40000);
892  // prepare the manager; collect init stats
893  p = Abc_SclManStart( pLib, pNtk, pPars->fUseWireLoads, pPars->fUseDept, 0, pPars->BuffTreeEst );
894  p->timeTotal = Abc_Clock();
895  assert( p->vGatesBest == NULL );
896  p->vGatesBest = Vec_IntDup( p->pNtk->vGates );
897  p->BestDelay = p->MaxDelay0;
898  // perform upsizing
899  nAllPos = nAllNodes = nAllTfos = nAllUpsizes = 0;
900  if ( p->BestDelay <= pPars->DelayUser )
901  printf( "Current delay (%.2f ps) does not exceed the target delay (%.2f ps). Upsizing is not performed.\n", p->BestDelay, (float)pPars->DelayUser );
902  else
903  for ( i = 0; i < pPars->nIters; i++ )
904  {
905  for ( win = pPars->Window + ((i % 7) == 6); win <= 100; win *= 2 )
906  {
907  // detect critical path
908  clk = Abc_Clock();
909  vPathPos = Abc_SclFindCriticalCoWindow( p, win );
910  vPathNodes = Abc_SclFindCriticalNodeWindow( p, vPathPos, win, pPars->fUseDept );
911  p->timeCone += Abc_Clock() - clk;
912 
913  // selectively upsize the nodes
914  clk = Abc_Clock();
915  if ( pPars->BypassFreq && i && (i % pPars->BypassFreq) == 0 )
916  nUpsizes = Abc_SclFindBypasses( p, vPathNodes, pPars->Ratio, pPars->Notches, i, pPars->DelayGap, pPars->fVeryVerbose );
917  else
918  nUpsizes = Abc_SclFindUpsizes( p, vPathNodes, pPars->Ratio, pPars->Notches, i, pPars->DelayGap, (pPars->BypassFreq > 0) );
919  p->timeSize += Abc_Clock() - clk;
920 
921  // unmark critical path
922  clk = Abc_Clock();
923  Abc_SclUnmarkCriticalNodeWindow( p, vPathNodes );
924  Abc_SclUnmarkCriticalNodeWindow( p, vPathPos );
925  p->timeCone += Abc_Clock() - clk;
926  if ( nUpsizes > 0 )
927  break;
928  Vec_IntFree( vPathPos );
929  Vec_IntFree( vPathNodes );
930  }
931  if ( nUpsizes == 0 )
932  break;
933 
934  // update timing information
935  clk = Abc_Clock();
936  if ( pPars->fUseDept )
937  {
938  if ( Vec_IntSize(p->vChanged) && !(pPars->BypassFreq && i && (i % pPars->BypassFreq) == 0) )
939  nConeSize = Abc_SclTimeIncUpdate( p );
940  else
941  Abc_SclTimeNtkRecompute( p, NULL, NULL, pPars->fUseDept, 0 );
942  }
943  else
944  {
945  Vec_Int_t * vTFO = Abc_SclFindTFO( p->pNtk, vPathNodes );
946  Abc_SclTimeCone( p, vTFO );
947  nConeSize = Vec_IntSize( vTFO );
948  Vec_IntFree( vTFO );
949  }
950  p->timeTime += Abc_Clock() - clk;
951 // Abc_SclUpsizePrintDiffs( p, pLib, pNtk );
952 
953  // save the best network
954  p->MaxDelay = Abc_SclReadMaxDelay( p );
955  if ( p->BestDelay > p->MaxDelay )
956  {
957  p->BestDelay = p->MaxDelay;
958  Abc_SclApplyUpdateToBest( p->vGatesBest, p->pNtk->vGates, p->vUpdates );
959  Vec_IntClear( p->vUpdates2 );
960  nFramesNoChange = 0;
961  }
962  else
963  nFramesNoChange++;
964 
965  // report and cleanup
966  Abc_SclUpsizePrint( p, i, win, Vec_IntSize(vPathPos), Vec_IntSize(vPathNodes), nUpsizes, nConeSize, pPars->fVeryVerbose || (pPars->fVerbose && nFramesNoChange == 0) ); //|| (i == nIters-1) );
967  nAllPos += Vec_IntSize(vPathPos);
968  nAllNodes += Vec_IntSize(vPathNodes);
969  nAllTfos += nConeSize;
970  nAllUpsizes += nUpsizes;
971  Vec_IntFree( vPathPos );
972  Vec_IntFree( vPathNodes );
973  // check timeout
974  if ( nRuntimeLimit && Abc_Clock() > nRuntimeLimit )
975  break;
976  // check no change
977  if ( nFramesNoChange > pPars->nIterNoChange )
978  break;
979  // check best delay
980  if ( p->BestDelay <= pPars->DelayUser )
981  break;
982  }
983  // update for best gates and recompute timing
984  ABC_SWAP( Vec_Int_t *, p->vGatesBest, p->pNtk->vGates );
985  if ( pPars->BypassFreq != 0 )
986  Abc_SclUndoRecentChanges( p->pNtk, p->vUpdates2 );
987  if ( pPars->BypassFreq != 0 )
988  Abc_SclUpsizeRemoveDangling( p, pNtk );
989  Abc_SclTimeNtkRecompute( p, &p->SumArea, &p->MaxDelay, 0, 0 );
990  if ( pPars->fVerbose )
991  Abc_SclUpsizePrint( p, i, pPars->Window, nAllPos/(i?i:1), nAllNodes/(i?i:1), nAllUpsizes/(i?i:1), nAllTfos/(i?i:1), 1 );
992  else
993  printf( " \r" );
994  // report runtime
995  p->timeTotal = Abc_Clock() - p->timeTotal;
996  if ( pPars->fVerbose )
997  {
998  p->timeOther = p->timeTotal - p->timeCone - p->timeSize - p->timeTime;
999  ABC_PRTP( "Runtime: Critical path", p->timeCone, p->timeTotal );
1000  ABC_PRTP( "Runtime: Sizing eval ", p->timeSize, p->timeTotal );
1001  ABC_PRTP( "Runtime: Timing update", p->timeTime, p->timeTotal );
1002  ABC_PRTP( "Runtime: Other ", p->timeOther, p->timeTotal );
1003  ABC_PRTP( "Runtime: TOTAL ", p->timeTotal, p->timeTotal );
1004  }
1005  if ( pPars->fDumpStats )
1006  Abc_SclDumpStats( p, "stats2.txt", p->timeTotal );
1007  if ( nRuntimeLimit && Abc_Clock() > nRuntimeLimit )
1008  printf( "Gate sizing timed out at %d seconds.\n", pPars->TimeOut );
1009 
1010  // save the result and quit
1011  Abc_SclSclGates2MioGates( pLib, pNtk ); // updates gate pointers
1012  Abc_SclManFree( p );
1013 // Abc_NtkCleanMarkAB( pNtk );
1014 }
static float Abc_SclReadMaxDelay(SC_Man *p)
Definition: sclSize.h:474
void Abc_SclUpsizePrint(SC_Man *p, int Iter, int win, int nPathPos, int nPathNodes, int nUpsizes, int nTFOs, int fVerbose)
Definition: sclUpsize.c:810
void Abc_SclTimeNtkRecompute(SC_Man *p, float *pArea, float *pDelay, int fReverse, float DUser)
Definition: sclSize.c:400
Vec_Int_t * Abc_SclFindCriticalNodeWindow(SC_Man *p, Vec_Int_t *vPathCos, int Window, int fDept)
Definition: sclUpsize.c:159
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int DelayGap
Definition: sclLib.h:78
int TimeOut
Definition: sclLib.h:79
void Abc_SclApplyUpdateToBest(Vec_Int_t *vGatesBest, Vec_Int_t *vGates, Vec_Int_t *vUpdate)
Definition: sclUpsize.c:709
int fVeryVerbose
Definition: sclLib.h:86
typedefABC_NAMESPACE_HEADER_START struct SC_Man_ SC_Man
INCLUDES ///.
Definition: sclSize.h:44
static abctime Abc_Clock()
Definition: abc_global.h:279
int fVerbose
Definition: sclLib.h:85
Vec_Int_t * Abc_SclFindCriticalCoWindow(SC_Man *p, int Window)
Definition: sclUpsize.c:98
#define ABC_SWAP(Type, a, b)
Definition: abc_global.h:218
void Abc_SclUpsizeRemoveDangling(SC_Man *p, Abc_Ntk_t *pNtk)
Definition: sclUpsize.c:842
int Abc_SclTimeIncUpdate(SC_Man *p)
Definition: sclSize.c:540
#define ABC_PRTP(a, t, T)
Definition: abc_global.h:223
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
int fUseWireLoads
Definition: sclLib.h:84
static void Abc_SclManFree(SC_Man *p)
Definition: sclSize.h:192
static void Abc_SclDumpStats(SC_Man *p, char *pFileName, abctime Time)
Definition: sclSize.h:510
void Abc_SclUnmarkCriticalNodeWindow(SC_Man *p, Vec_Int_t *vPath)
Definition: sclUpsize.c:180
int nIterNoChange
Definition: sclLib.h:73
void Abc_SclUndoRecentChanges(Abc_Ntk_t *pNtk, Vec_Int_t *vTrans)
Definition: sclUpsize.c:720
int Abc_SclFindUpsizes(SC_Man *p, Vec_Int_t *vPathNodes, int Ratio, int Notches, int iIter, int DelayGap, int fMoreConserf)
Definition: sclUpsize.c:596
int DelayUser
Definition: sclLib.h:77
void Abc_SclSclGates2MioGates(SC_Lib *pLib, Abc_Ntk_t *p)
Definition: sclUtil.c:73
int Notches
Definition: sclLib.h:76
void Abc_SclTimeCone(SC_Man *p, Vec_Int_t *vCone)
Definition: sclSize.c:383
int fUseDept
Definition: sclLib.h:82
int BypassFreq
Definition: sclLib.h:81
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
int Window
Definition: sclLib.h:74
Vec_Int_t * Abc_SclFindTFO(Abc_Ntk_t *p, Vec_Int_t *vPath)
Definition: sclUpsize.c:63
int nIters
Definition: sclLib.h:72
#define assert(ex)
Definition: util_old.h:213
int BuffTreeEst
Definition: sclLib.h:80
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
int Ratio
Definition: sclLib.h:75
int fDumpStats
Definition: sclLib.h:83
int Abc_SclFindBypasses(SC_Man *p, Vec_Int_t *vPathNodes, int Ratio, int Notches, int iIter, int DelayGap, int fVeryVerbose)
Definition: sclUpsize.c:336
SC_Man * Abc_SclManStart(SC_Lib *pLib, Abc_Ntk_t *pNtk, int fUseWireLoads, int fDept, float DUser, int nTreeCRatio)
Definition: sclSize.c:633