abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
abcTiming.c File Reference
#include "base/abc/abc.h"
#include "base/main/main.h"
#include "map/mio/mio.h"

Go to the source code of this file.

Data Structures

struct  Abc_ManTime_t_
 DECLARATIONS ///. More...
 

Functions

static Abc_ManTime_tAbc_ManTimeStart (Abc_Ntk_t *pNtk)
 
static void Abc_ManTimeExpand (Abc_ManTime_t *p, int nSize, int fProgressive)
 
static Abc_Time_tAbc_NodeArrival (Abc_Obj_t *pNode)
 
static Abc_Time_tAbc_NodeRequired (Abc_Obj_t *pNode)
 
Abc_Time_tAbc_NtkReadDefaultArrival (Abc_Ntk_t *pNtk)
 FUNCTION DEFINITIONS ///. More...
 
Abc_Time_tAbc_NtkReadDefaultRequired (Abc_Ntk_t *pNtk)
 
Abc_Time_tAbc_NodeReadArrival (Abc_Obj_t *pNode)
 
Abc_Time_tAbc_NodeReadRequired (Abc_Obj_t *pNode)
 
float Abc_NodeReadArrivalAve (Abc_Obj_t *pNode)
 
float Abc_NodeReadRequiredAve (Abc_Obj_t *pNode)
 
float Abc_NodeReadArrivalWorst (Abc_Obj_t *pNode)
 
float Abc_NodeReadRequiredWorst (Abc_Obj_t *pNode)
 
Abc_Time_tAbc_NtkReadDefaultInputDrive (Abc_Ntk_t *pNtk)
 
Abc_Time_tAbc_NtkReadDefaultOutputLoad (Abc_Ntk_t *pNtk)
 
Abc_Time_tAbc_NodeReadInputDrive (Abc_Ntk_t *pNtk, int iPi)
 
Abc_Time_tAbc_NodeReadOutputLoad (Abc_Ntk_t *pNtk, int iPo)
 
float Abc_NodeReadInputDriveWorst (Abc_Ntk_t *pNtk, int iPi)
 
float Abc_NodeReadOutputLoadWorst (Abc_Ntk_t *pNtk, int iPo)
 
void Abc_NtkTimeSetDefaultArrival (Abc_Ntk_t *pNtk, float Rise, float Fall)
 
void Abc_NtkTimeSetDefaultRequired (Abc_Ntk_t *pNtk, float Rise, float Fall)
 
void Abc_NtkTimeSetArrival (Abc_Ntk_t *pNtk, int ObjId, float Rise, float Fall)
 
void Abc_NtkTimeSetRequired (Abc_Ntk_t *pNtk, int ObjId, float Rise, float Fall)
 
void Abc_NtkTimeSetDefaultInputDrive (Abc_Ntk_t *pNtk, float Rise, float Fall)
 
void Abc_NtkTimeSetDefaultOutputLoad (Abc_Ntk_t *pNtk, float Rise, float Fall)
 
void Abc_NtkTimeSetInputDrive (Abc_Ntk_t *pNtk, int PiNum, float Rise, float Fall)
 
void Abc_NtkTimeSetOutputLoad (Abc_Ntk_t *pNtk, int PoNum, float Rise, float Fall)
 
void Abc_NtkTimeInitialize (Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkOld)
 
void Abc_NtkTimePrepare (Abc_Ntk_t *pNtk)
 
void Abc_ManTimeStop (Abc_ManTime_t *p)
 
void Abc_ManTimeDup (Abc_Ntk_t *pNtkOld, Abc_Ntk_t *pNtkNew)
 
void Abc_NtkSetNodeLevelsArrival (Abc_Ntk_t *pNtkOld)
 
Abc_Time_tAbc_NtkGetCiArrivalTimes (Abc_Ntk_t *pNtk)
 
Abc_Time_tAbc_NtkGetCoRequiredTimes (Abc_Ntk_t *pNtk)
 
float * Abc_NtkGetCiArrivalFloats (Abc_Ntk_t *pNtk)
 
float * Abc_NtkGetCoRequiredFloats (Abc_Ntk_t *pNtk)
 
Vec_Int_tAbc_NtkDelayTraceSlackStart (Abc_Ntk_t *pNtk)
 
static float Abc_NtkDelayTraceSlack (Vec_Int_t *vSlacks, Abc_Obj_t *pObj, int iFanin)
 
static void Abc_NtkDelayTraceSetSlack (Vec_Int_t *vSlacks, Abc_Obj_t *pObj, int iFanin, float Num)
 
int Abc_NtkDelayTraceCritPath_rec (Vec_Int_t *vSlacks, Abc_Obj_t *pNode, Abc_Obj_t *pLeaf, Vec_Int_t *vBest)
 
void Abc_NtkDelayTraceCritPathCollect_rec (Vec_Int_t *vSlacks, Abc_Obj_t *pNode, Vec_Int_t *vBest, Vec_Ptr_t *vPath)
 
void Abc_NodeDelayTraceArrival (Abc_Obj_t *pNode, Vec_Int_t *vSlacks)
 
float Abc_NtkDelayTrace (Abc_Ntk_t *pNtk, Abc_Obj_t *pOut, Abc_Obj_t *pIn, int fPrint)
 
int Abc_ObjLevelNew (Abc_Obj_t *pObj)
 
int Abc_ObjReverseLevelNew (Abc_Obj_t *pObj)
 
int Abc_ObjRequiredLevel (Abc_Obj_t *pObj)
 
int Abc_ObjReverseLevel (Abc_Obj_t *pObj)
 
void Abc_ObjSetReverseLevel (Abc_Obj_t *pObj, int LevelR)
 
void Abc_NtkStartReverseLevels (Abc_Ntk_t *pNtk, int nMaxLevelIncrease)
 
void Abc_NtkStopReverseLevels (Abc_Ntk_t *pNtk)
 
void Abc_NtkUpdateLevel (Abc_Obj_t *pObjNew, Vec_Vec_t *vLevels)
 
void Abc_NtkUpdateReverseLevel (Abc_Obj_t *pObjNew, Vec_Vec_t *vLevels)
 
void Abc_NtkUpdate (Abc_Obj_t *pObj, Abc_Obj_t *pObjNew, Vec_Vec_t *vLevels)
 

Function Documentation

void Abc_ManTimeDup ( Abc_Ntk_t pNtkOld,
Abc_Ntk_t pNtkNew 
)

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

Synopsis [Duplicates the timing manager with the PI/PO timing info.]

Description [The PIs/POs of the new network should be allocated.]

SideEffects []

SeeAlso []

Definition at line 481 of file abcTiming.c.

482 {
483  Abc_Obj_t * pObj;
484  Abc_Time_t ** ppTimesOld, ** ppTimesNew;
485  int i;
486  if ( pNtkOld->pManTime == NULL )
487  return;
488  assert( Abc_NtkCiNum(pNtkOld) == Abc_NtkCiNum(pNtkNew) );
489  assert( Abc_NtkCoNum(pNtkOld) == Abc_NtkCoNum(pNtkNew) );
490  assert( Abc_NtkLatchNum(pNtkOld) == Abc_NtkLatchNum(pNtkNew) );
491  // create the new timing manager
492  pNtkNew->pManTime = Abc_ManTimeStart(pNtkNew);
493  Abc_ManTimeExpand( pNtkNew->pManTime, Abc_NtkObjNumMax(pNtkNew), 0 );
494  // set the default timing
495  pNtkNew->pManTime->tArrDef = pNtkOld->pManTime->tArrDef;
496  pNtkNew->pManTime->tReqDef = pNtkOld->pManTime->tReqDef;
497  // set the CI timing
498  ppTimesOld = (Abc_Time_t **)pNtkOld->pManTime->vArrs->pArray;
499  ppTimesNew = (Abc_Time_t **)pNtkNew->pManTime->vArrs->pArray;
500  Abc_NtkForEachCi( pNtkOld, pObj, i )
501  *ppTimesNew[ Abc_NtkCi(pNtkNew,i)->Id ] = *ppTimesOld[ pObj->Id ];
502  // set the CO timing
503  ppTimesOld = (Abc_Time_t **)pNtkOld->pManTime->vReqs->pArray;
504  ppTimesNew = (Abc_Time_t **)pNtkNew->pManTime->vReqs->pArray;
505  Abc_NtkForEachCo( pNtkOld, pObj, i )
506  *ppTimesNew[ Abc_NtkCo(pNtkNew,i)->Id ] = *ppTimesOld[ pObj->Id ];
507  // duplicate input drive
508  pNtkNew->pManTime->tInDriveDef = pNtkOld->pManTime->tInDriveDef;
509  pNtkNew->pManTime->tOutLoadDef = pNtkOld->pManTime->tOutLoadDef;
510  if ( pNtkOld->pManTime->tInDrive )
511  {
512  pNtkNew->pManTime->tInDrive = ABC_ALLOC( Abc_Time_t, Abc_NtkCiNum(pNtkOld) );
513  memcpy( pNtkNew->pManTime->tInDrive, pNtkOld->pManTime->tInDrive, sizeof(Abc_Time_t) * Abc_NtkCiNum(pNtkOld) );
514  }
515  if ( pNtkOld->pManTime->tOutLoad )
516  {
517  pNtkNew->pManTime->tOutLoad = ABC_ALLOC( Abc_Time_t, Abc_NtkCiNum(pNtkOld) );
518  memcpy( pNtkNew->pManTime->tOutLoad, pNtkOld->pManTime->tOutLoad, sizeof(Abc_Time_t) * Abc_NtkCoNum(pNtkOld) );
519  }
520 }
Abc_Time_t * tOutLoad
Definition: abcTiming.c:41
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
Vec_Ptr_t * vArrs
Definition: abcTiming.c:36
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
char * memcpy()
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Abc_Obj_t * Abc_NtkCi(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:317
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:318
static void Abc_ManTimeExpand(Abc_ManTime_t *p, int nSize, int fProgressive)
Definition: abcTiming.c:533
Abc_Time_t tInDriveDef
Definition: abcTiming.c:38
Abc_Time_t tArrDef
Definition: abcTiming.c:34
Abc_Time_t * tInDrive
Definition: abcTiming.c:40
Vec_Ptr_t * vReqs
Definition: abcTiming.c:37
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static Abc_ManTime_t * Abc_ManTimeStart(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:431
int Id
Definition: abc.h:132
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define assert(ex)
Definition: util_old.h:213
Abc_Time_t tOutLoadDef
Definition: abcTiming.c:39
Abc_Time_t tReqDef
Definition: abcTiming.c:35
void Abc_ManTimeExpand ( Abc_ManTime_t p,
int  nSize,
int  fProgressive 
)
static

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

Synopsis [Expends the storage for timing information.]

Description []

SideEffects []

SeeAlso []

Definition at line 533 of file abcTiming.c.

534 {
535  Vec_Ptr_t * vTimes;
536  Abc_Time_t * ppTimes, * ppTimesOld, * pTime;
537  int nSizeOld, nSizeNew, i;
538 
539  nSizeOld = p->vArrs->nSize;
540  if ( nSizeOld >= nSize )
541  return;
542  nSizeNew = fProgressive? 2 * nSize : nSize;
543  if ( nSizeNew < 100 )
544  nSizeNew = 100;
545 
546  vTimes = p->vArrs;
547  Vec_PtrGrow( vTimes, nSizeNew );
548  vTimes->nSize = nSizeNew;
549  ppTimesOld = ( nSizeOld == 0 )? NULL : (Abc_Time_t *)vTimes->pArray[0];
550  ppTimes = ABC_REALLOC( Abc_Time_t, ppTimesOld, nSizeNew );
551  for ( i = 0; i < nSizeNew; i++ )
552  vTimes->pArray[i] = ppTimes + i;
553  for ( i = nSizeOld; i < nSizeNew; i++ )
554  {
555  pTime = (Abc_Time_t *)vTimes->pArray[i];
556  pTime->Rise = -ABC_INFINITY;
557  pTime->Fall = -ABC_INFINITY;
558  }
559 
560  vTimes = p->vReqs;
561  Vec_PtrGrow( vTimes, nSizeNew );
562  vTimes->nSize = nSizeNew;
563  ppTimesOld = ( nSizeOld == 0 )? NULL : (Abc_Time_t *)vTimes->pArray[0];
564  ppTimes = ABC_REALLOC( Abc_Time_t, ppTimesOld, nSizeNew );
565  for ( i = 0; i < nSizeNew; i++ )
566  vTimes->pArray[i] = ppTimes + i;
567  for ( i = nSizeOld; i < nSizeNew; i++ )
568  {
569  pTime = (Abc_Time_t *)vTimes->pArray[i];
570  pTime->Rise = ABC_INFINITY;
571  pTime->Fall = ABC_INFINITY;
572  }
573 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
static void Vec_PtrGrow(Vec_Ptr_t *p, int nCapMin)
Definition: vecPtr.h:430
Vec_Ptr_t * vArrs
Definition: abcTiming.c:36
for(p=first;p->value< newval;p=p->next)
float Fall
Definition: abc.h:125
Vec_Ptr_t * vReqs
Definition: abcTiming.c:37
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
float Rise
Definition: abc.h:124
Abc_ManTime_t * Abc_ManTimeStart ( Abc_Ntk_t pNtk)
static

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 431 of file abcTiming.c.

432 {
433  Abc_ManTime_t * p;
434  p = ABC_ALLOC( Abc_ManTime_t, 1 );
435  memset( p, 0, sizeof(Abc_ManTime_t) );
436  p->vArrs = Vec_PtrAlloc( 0 );
437  p->vReqs = Vec_PtrAlloc( 0 );
440  Abc_ManTimeExpand( p, Abc_NtkObjNumMax(pNtk) + 1, 0 );
441  return p;
442 }
char * memset()
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Vec_Ptr_t * vArrs
Definition: abcTiming.c:36
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
DECLARATIONS ///.
Definition: abcTiming.c:32
static void Abc_ManTimeExpand(Abc_ManTime_t *p, int nSize, int fProgressive)
Definition: abcTiming.c:533
float Fall
Definition: abc.h:125
Vec_Ptr_t * vReqs
Definition: abcTiming.c:37
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
Abc_Time_t tReqDef
Definition: abcTiming.c:35
float Rise
Definition: abc.h:124
void Abc_ManTimeStop ( Abc_ManTime_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 455 of file abcTiming.c.

456 {
457  if ( p->tInDrive )
458  ABC_FREE( p->tInDrive );
459  if ( p->tOutLoad )
460  ABC_FREE( p->tOutLoad );
461  if ( Vec_PtrSize(p->vArrs) > 0 )
462  ABC_FREE( p->vArrs->pArray[0] );
463  Vec_PtrFree( p->vArrs );
464  if ( Vec_PtrSize(p->vReqs) > 0 )
465  ABC_FREE( p->vReqs->pArray[0] );
466  Vec_PtrFree( p->vReqs );
467  ABC_FREE( p );
468 }
Abc_Time_t * tOutLoad
Definition: abcTiming.c:41
Vec_Ptr_t * vArrs
Definition: abcTiming.c:36
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Abc_Time_t * tInDrive
Definition: abcTiming.c:40
Vec_Ptr_t * vReqs
Definition: abcTiming.c:37
#define ABC_FREE(obj)
Definition: abc_global.h:232
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
static Abc_Time_t* Abc_NodeArrival ( Abc_Obj_t pNode)
inlinestatic

Definition at line 49 of file abcTiming.c.

49 { return (Abc_Time_t *)pNode->pNtk->pManTime->vArrs->pArray[pNode->Id]; }
Vec_Ptr_t * vArrs
Definition: abcTiming.c:36
Abc_Ntk_t * pNtk
Definition: abc.h:130
int Id
Definition: abc.h:132
Abc_ManTime_t * pManTime
Definition: abc.h:192
void Abc_NodeDelayTraceArrival ( Abc_Obj_t pNode,
Vec_Int_t vSlacks 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 819 of file abcTiming.c.

820 {
821  Abc_Obj_t * pFanin;
822  Abc_Time_t * pTimeIn, * pTimeOut;
823  float tDelayBlockRise, tDelayBlockFall;
824  Mio_PinPhase_t PinPhase;
825  Mio_Pin_t * pPin;
826  int i;
827 
828  // start the arrival time of the node
829  pTimeOut = Abc_NodeArrival(pNode);
830  pTimeOut->Rise = pTimeOut->Fall = -ABC_INFINITY;
831  // consider the buffer
832  if ( Abc_ObjIsBarBuf(pNode) )
833  {
834  pTimeIn = Abc_NodeArrival(Abc_ObjFanin0(pNode));
835  *pTimeOut = *pTimeIn;
836  return;
837  }
838  // go through the pins of the gate
839  pPin = Mio_GateReadPins((Mio_Gate_t *)pNode->pData);
840  Abc_ObjForEachFanin( pNode, pFanin, i )
841  {
842  pTimeIn = Abc_NodeArrival(pFanin);
843  // get the interesting parameters of this pin
844  PinPhase = Mio_PinReadPhase(pPin);
845  tDelayBlockRise = (float)Mio_PinReadDelayBlockRise( pPin );
846  tDelayBlockFall = (float)Mio_PinReadDelayBlockFall( pPin );
847  // compute the arrival times of the positive phase
848  if ( PinPhase != MIO_PHASE_INV ) // NONINV phase is present
849  {
850  if ( pTimeOut->Rise < pTimeIn->Rise + tDelayBlockRise )
851  pTimeOut->Rise = pTimeIn->Rise + tDelayBlockRise;
852  if ( pTimeOut->Fall < pTimeIn->Fall + tDelayBlockFall )
853  pTimeOut->Fall = pTimeIn->Fall + tDelayBlockFall;
854  }
855  if ( PinPhase != MIO_PHASE_NONINV ) // INV phase is present
856  {
857  if ( pTimeOut->Rise < pTimeIn->Fall + tDelayBlockRise )
858  pTimeOut->Rise = pTimeIn->Fall + tDelayBlockRise;
859  if ( pTimeOut->Fall < pTimeIn->Rise + tDelayBlockFall )
860  pTimeOut->Fall = pTimeIn->Rise + tDelayBlockFall;
861  }
862  pPin = Mio_PinReadNext(pPin);
863  }
864 
865  // compute edge slacks
866  if ( vSlacks )
867  {
868  float Slack;
869  // go through the pins of the gate
870  pPin = Mio_GateReadPins((Mio_Gate_t *)pNode->pData);
871  Abc_ObjForEachFanin( pNode, pFanin, i )
872  {
873  pTimeIn = Abc_NodeArrival(pFanin);
874  // get the interesting parameters of this pin
875  PinPhase = Mio_PinReadPhase(pPin);
876  tDelayBlockRise = (float)Mio_PinReadDelayBlockRise( pPin );
877  tDelayBlockFall = (float)Mio_PinReadDelayBlockFall( pPin );
878  // compute the arrival times of the positive phase
879  Slack = ABC_INFINITY;
880  if ( PinPhase != MIO_PHASE_INV ) // NONINV phase is present
881  {
882 // if ( pTimeOut->Rise < pTimeIn->Rise + tDelayBlockRise )
883 // pTimeOut->Rise = pTimeIn->Rise + tDelayBlockRise;
884 // if ( pTimeOut->Fall < pTimeIn->Fall + tDelayBlockFall )
885 // pTimeOut->Fall = pTimeIn->Fall + tDelayBlockFall;
886  Slack = Abc_MinFloat( Slack, Abc_AbsFloat(pTimeIn->Rise + tDelayBlockRise - pTimeOut->Rise) );
887  Slack = Abc_MinFloat( Slack, Abc_AbsFloat(pTimeIn->Fall + tDelayBlockFall - pTimeOut->Fall) );
888  }
889  if ( PinPhase != MIO_PHASE_NONINV ) // INV phase is present
890  {
891 // if ( pTimeOut->Rise < pTimeIn->Fall + tDelayBlockRise )
892 // pTimeOut->Rise = pTimeIn->Fall + tDelayBlockRise;
893 // if ( pTimeOut->Fall < pTimeIn->Rise + tDelayBlockFall )
894 // pTimeOut->Fall = pTimeIn->Rise + tDelayBlockFall;
895  Slack = Abc_MinFloat( Slack, Abc_AbsFloat(pTimeIn->Fall + tDelayBlockRise - pTimeOut->Rise) );
896  Slack = Abc_MinFloat( Slack, Abc_AbsFloat(pTimeIn->Rise + tDelayBlockFall - pTimeOut->Fall) );
897  }
898  pPin = Mio_PinReadNext(pPin);
899  Abc_NtkDelayTraceSetSlack( vSlacks, pNode, i, Slack );
900  }
901  }
902 }
static float Abc_MinFloat(float a, float b)
Definition: abc_global.h:244
static float Abc_AbsFloat(float a)
Definition: abc_global.h:242
Mio_Pin_t * Mio_GateReadPins(Mio_Gate_t *pGate)
Definition: mioApi.c:147
double Mio_PinReadDelayBlockFall(Mio_Pin_t *pPin)
Definition: mioApi.c:176
Mio_PinPhase_t
INCLUDES ///.
Definition: mio.h:40
static int Abc_ObjIsBarBuf(Abc_Obj_t *pObj)
Definition: abc.h:360
static void Abc_NtkDelayTraceSetSlack(Vec_Int_t *vSlacks, Abc_Obj_t *pObj, int iFanin, float Num)
Definition: abcTiming.c:739
Mio_Pin_t * Mio_PinReadNext(Mio_Pin_t *pPin)
Definition: mioApi.c:179
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
float Fall
Definition: abc.h:125
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
Mio_PinPhase_t Mio_PinReadPhase(Mio_Pin_t *pPin)
Definition: mioApi.c:171
double Mio_PinReadDelayBlockRise(Mio_Pin_t *pPin)
Definition: mioApi.c:174
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
void * pData
Definition: abc.h:145
static Abc_Time_t * Abc_NodeArrival(Abc_Obj_t *pNode)
Definition: abcTiming.c:49
float Rise
Definition: abc.h:124
Abc_Time_t* Abc_NodeReadArrival ( Abc_Obj_t pNode)

Definition at line 77 of file abcTiming.c.

78 {
79  assert( pNode->pNtk->pManTime );
80  return Abc_NodeArrival(pNode);
81 }
Abc_Ntk_t * pNtk
Definition: abc.h:130
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define assert(ex)
Definition: util_old.h:213
static Abc_Time_t * Abc_NodeArrival(Abc_Obj_t *pNode)
Definition: abcTiming.c:49
float Abc_NodeReadArrivalAve ( Abc_Obj_t pNode)

Definition at line 87 of file abcTiming.c.

88 {
89  return 0.5 * Abc_NodeArrival(pNode)->Rise + 0.5 * Abc_NodeArrival(pNode)->Fall;
90 }
float Fall
Definition: abc.h:125
static Abc_Time_t * Abc_NodeArrival(Abc_Obj_t *pNode)
Definition: abcTiming.c:49
float Rise
Definition: abc.h:124
float Abc_NodeReadArrivalWorst ( Abc_Obj_t pNode)

Definition at line 95 of file abcTiming.c.

96 {
97  return Abc_MaxFloat( Abc_NodeArrival(pNode)->Rise, Abc_NodeArrival(pNode)->Fall );
98 }
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
static Abc_Time_t * Abc_NodeArrival(Abc_Obj_t *pNode)
Definition: abcTiming.c:49
Abc_Time_t* Abc_NodeReadInputDrive ( Abc_Ntk_t pNtk,
int  iPi 
)

Definition at line 125 of file abcTiming.c.

126 {
127  assert( pNtk->pManTime );
128  return pNtk->pManTime->tInDrive ? pNtk->pManTime->tInDrive + iPi : NULL;
129 }
Abc_Time_t * tInDrive
Definition: abcTiming.c:40
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define assert(ex)
Definition: util_old.h:213
float Abc_NodeReadInputDriveWorst ( Abc_Ntk_t pNtk,
int  iPi 
)

Definition at line 135 of file abcTiming.c.

136 {
137  return Abc_MaxFloat( Abc_NodeReadInputDrive(pNtk, iPi)->Rise, Abc_NodeReadInputDrive(pNtk, iPi)->Fall );
138 }
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
Abc_Time_t * Abc_NodeReadInputDrive(Abc_Ntk_t *pNtk, int iPi)
Definition: abcTiming.c:125
Abc_Time_t* Abc_NodeReadOutputLoad ( Abc_Ntk_t pNtk,
int  iPo 
)

Definition at line 130 of file abcTiming.c.

131 {
132  assert( pNtk->pManTime );
133  return pNtk->pManTime->tOutLoad ? pNtk->pManTime->tOutLoad + iPo : NULL;
134 }
Abc_Time_t * tOutLoad
Definition: abcTiming.c:41
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define assert(ex)
Definition: util_old.h:213
float Abc_NodeReadOutputLoadWorst ( Abc_Ntk_t pNtk,
int  iPo 
)

Definition at line 139 of file abcTiming.c.

140 {
141  return Abc_MaxFloat( Abc_NodeReadOutputLoad(pNtk, iPo)->Rise, Abc_NodeReadOutputLoad(pNtk, iPo)->Fall );
142 }
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
Abc_Time_t * Abc_NodeReadOutputLoad(Abc_Ntk_t *pNtk, int iPo)
Definition: abcTiming.c:130
Abc_Time_t* Abc_NodeReadRequired ( Abc_Obj_t pNode)

Definition at line 82 of file abcTiming.c.

83 {
84  assert( pNode->pNtk->pManTime );
85  return Abc_NodeRequired(pNode);
86 }
Abc_Ntk_t * pNtk
Definition: abc.h:130
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define assert(ex)
Definition: util_old.h:213
static Abc_Time_t * Abc_NodeRequired(Abc_Obj_t *pNode)
Definition: abcTiming.c:50
float Abc_NodeReadRequiredAve ( Abc_Obj_t pNode)

Definition at line 91 of file abcTiming.c.

92 {
93  return 0.5 * Abc_NodeReadRequired(pNode)->Rise + 0.5 * Abc_NodeReadRequired(pNode)->Fall;
94 }
Abc_Time_t * Abc_NodeReadRequired(Abc_Obj_t *pNode)
Definition: abcTiming.c:82
float Fall
Definition: abc.h:125
float Rise
Definition: abc.h:124
float Abc_NodeReadRequiredWorst ( Abc_Obj_t pNode)

Definition at line 99 of file abcTiming.c.

100 {
101  return Abc_MaxFloat( Abc_NodeReadRequired(pNode)->Rise, Abc_NodeReadRequired(pNode)->Fall );
102 }
Abc_Time_t * Abc_NodeReadRequired(Abc_Obj_t *pNode)
Definition: abcTiming.c:82
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
static Abc_Time_t* Abc_NodeRequired ( Abc_Obj_t pNode)
inlinestatic

Definition at line 50 of file abcTiming.c.

50 { return (Abc_Time_t *)pNode->pNtk->pManTime->vReqs->pArray[pNode->Id]; }
Abc_Ntk_t * pNtk
Definition: abc.h:130
Vec_Ptr_t * vReqs
Definition: abcTiming.c:37
int Id
Definition: abc.h:132
Abc_ManTime_t * pManTime
Definition: abc.h:192
float Abc_NtkDelayTrace ( Abc_Ntk_t pNtk,
Abc_Obj_t pOut,
Abc_Obj_t pIn,
int  fPrint 
)

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

Synopsis [Performs delay-trace of the network. If input (pIn) or output (pOut) are given, finds the most-timing-critical path between them and prints it to the standard output. If input and/or output are not given, finds the most-critical path in the network and prints it.]

Description []

SideEffects []

SeeAlso []

Definition at line 919 of file abcTiming.c.

920 {
921  Vec_Int_t * vSlacks = NULL;
922  Abc_Obj_t * pNode, * pDriver;
923  Vec_Ptr_t * vNodes;
924  Abc_Time_t * pTime;
925  float tArrivalMax;
926  int i;
927 
928  assert( Abc_NtkIsMappedLogic(pNtk) );
929  assert( pOut == NULL || Abc_ObjIsCo(pOut) );
930  assert( pIn == NULL || Abc_ObjIsCi(pIn) );
931 
932  // create slacks (need slacks if printing is requested even if pIn/pOut are not given)
933  if ( pOut || pIn || fPrint )
934  vSlacks = Abc_NtkDelayTraceSlackStart( pNtk );
935 
936  // compute the timing
937  Abc_NtkTimePrepare( pNtk );
938  vNodes = Abc_NtkDfs( pNtk, 1 );
939  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
940  Abc_NodeDelayTraceArrival( pNode, vSlacks );
941  Vec_PtrFree( vNodes );
942 
943  // get the latest arrival times
944  tArrivalMax = -ABC_INFINITY;
945  Abc_NtkForEachCo( pNtk, pNode, i )
946  {
947  pDriver = Abc_ObjFanin0(pNode);
948  pTime = Abc_NodeArrival(pDriver);
949  if ( tArrivalMax < Abc_MaxFloat(pTime->Fall, pTime->Rise) )
950  tArrivalMax = Abc_MaxFloat(pTime->Fall, pTime->Rise);
951  }
952 
953  // determine the output to print
954  if ( fPrint && pOut == NULL )
955  {
956  Abc_NtkForEachCo( pNtk, pNode, i )
957  {
958  pDriver = Abc_ObjFanin0(pNode);
959  pTime = Abc_NodeArrival(pDriver);
960  if ( tArrivalMax == Abc_MaxFloat(pTime->Fall, pTime->Rise) )
961  pOut = pNode;
962  }
963  assert( pOut != NULL );
964  }
965 
966  if ( fPrint )
967  {
968  Vec_Ptr_t * vPath = Vec_PtrAlloc( 100 );
969  Vec_Int_t * vBest = Vec_IntStartFull( Abc_NtkObjNumMax(pNtk) );
970  // traverse to determine the critical path
971  Abc_NtkIncrementTravId( pNtk );
972  if ( !Abc_NtkDelayTraceCritPath_rec( vSlacks, Abc_ObjFanin0(pOut), pIn, vBest ) )
973  {
974  if ( pIn == NULL )
975  printf( "The logic cone of PO \"%s\" has no primary inputs.\n", Abc_ObjName(pOut) );
976  else
977  printf( "There is no combinational path between PI \"%s\" and PO \"%s\".\n", Abc_ObjName(pIn), Abc_ObjName(pOut) );
978  }
979  else
980  {
981  float Slack = 0.0, SlackAdd;
982  int k, iFanin, Length = 0;
983  Abc_Obj_t * pFanin;
984  // check the additional slack
986  // collect the critical path
987  Abc_NtkDelayTraceCritPathCollect_rec( vSlacks, Abc_ObjFanin0(pOut), vBest, vPath );
988  if ( pIn == NULL )
989  pIn = (Abc_Obj_t *)Vec_PtrEntry( vPath, 0 );
990  // find the longest gate name
991  Vec_PtrForEachEntry( Abc_Obj_t *, vPath, pNode, i )
992  if ( Abc_ObjIsNode(pNode) )
993  Length = Abc_MaxInt( Length, strlen(Mio_GateReadName((Mio_Gate_t *)pNode->pData)) );
994  // print critical path
995  Abc_NtkLevel( pNtk );
996  printf( "Critical path from PI \"%s\" to PO \"%s\":\n", Abc_ObjName(pIn), Abc_ObjName(pOut) );
997  Vec_PtrForEachEntry( Abc_Obj_t *, vPath, pNode, i )
998  {
999  printf( "Level %3d : ", Abc_ObjLevel(pNode) );
1000  if ( Abc_ObjIsCi(pNode) )
1001  {
1002  printf( "Primary input \"%s\". ", Abc_ObjName(pNode) );
1003  printf( "Arrival time =%6.1f. ", Abc_NodeReadArrivalWorst(pNode) );
1004  printf( "\n" );
1005  continue;
1006  }
1007  if ( Abc_ObjIsCo(pNode) )
1008  {
1009  printf( "Primary output \"%s\". ", Abc_ObjName(pNode) );
1010  printf( "Arrival =%6.1f. ", Abc_NodeReadArrivalWorst(pNode) );
1011  }
1012  else
1013  {
1014  assert( Abc_ObjIsNode(pNode) );
1015  iFanin = Abc_NodeFindFanin( pNode, (Abc_Obj_t *)Vec_PtrEntry(vPath,i-1) );
1016  Slack = Abc_NtkDelayTraceSlack(vSlacks, pNode, iFanin);
1017  printf( "%10s/", Abc_ObjName(pNode) );
1018  printf( "%-4s", Mio_GateReadPinName((Mio_Gate_t *)pNode->pData, iFanin) );
1019  printf( " (%s)", Mio_GateReadName((Mio_Gate_t *)pNode->pData) );
1020  for ( k = strlen(Mio_GateReadName((Mio_Gate_t *)pNode->pData)); k < Length; k++ )
1021  printf( " " );
1022  printf( " " );
1023  printf( "Arrival =%6.1f. ", Abc_NodeReadArrivalWorst(pNode) );
1024  printf( "I/O times: (" );
1025  Abc_ObjForEachFanin( pNode, pFanin, k )
1026  printf( "%s%.1f", (k? ", ":""), Abc_NodeReadArrivalWorst(pFanin) );
1027 // printf( " -> %.1f)", Abc_NodeReadArrival(pNode)->Worst + Slack + SlackAdd );
1028  printf( " -> %.1f)", Abc_NodeReadArrivalWorst(pNode) );
1029  }
1030  printf( "\n" );
1031  }
1032  printf( "Level %3d : ", Abc_ObjLevel(Abc_ObjFanin0(pOut)) + 1 );
1033  printf( "Primary output \"%s\". ", Abc_ObjName(pOut) );
1034  printf( "Required time = %6.1f. ", Abc_NodeReadRequiredWorst(pOut) );
1035  printf( "Path slack = %6.1f.\n", SlackAdd );
1036  }
1037  Vec_PtrFree( vPath );
1038  Vec_IntFree( vBest );
1039  }
1040 
1041  Vec_IntFreeP( &vSlacks );
1042  return tArrivalMax;
1043 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
static float Abc_NtkDelayTraceSlack(Vec_Int_t *vSlacks, Abc_Obj_t *pObj, int iFanin)
Definition: abcTiming.c:735
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
ABC_DLL int Abc_NodeFindFanin(Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
Definition: abcUtil.c:758
char * Mio_GateReadPinName(Mio_Gate_t *pGate, int iPin)
Definition: mioApi.c:192
void Abc_NtkDelayTraceCritPathCollect_rec(Vec_Int_t *vSlacks, Abc_Obj_t *pNode, Vec_Int_t *vBest, Vec_Ptr_t *vPath)
Definition: abcTiming.c:796
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition: abcDfs.c:81
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
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 float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
float Abc_NodeReadArrivalWorst(Abc_Obj_t *pNode)
Definition: abcTiming.c:95
static int Abc_ObjLevel(Abc_Obj_t *pObj)
Definition: abc.h:330
float Abc_NodeReadRequiredWorst(Abc_Obj_t *pNode)
Definition: abcTiming.c:99
if(last==0)
Definition: sparse_int.h:34
int Abc_NtkDelayTraceCritPath_rec(Vec_Int_t *vSlacks, Abc_Obj_t *pNode, Abc_Obj_t *pLeaf, Vec_Int_t *vBest)
Definition: abcTiming.c:755
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
void Abc_NodeDelayTraceArrival(Abc_Obj_t *pNode, Vec_Int_t *vSlacks)
Definition: abcTiming.c:819
Vec_Int_t * Abc_NtkDelayTraceSlackStart(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:707
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
float Fall
Definition: abc.h:125
static int Abc_NtkIsMappedLogic(Abc_Ntk_t *pNtk)
Definition: abc.h:267
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
void Abc_NtkTimePrepare(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:377
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
#define assert(ex)
Definition: util_old.h:213
int strlen()
static Abc_Time_t * Abc_NodeArrival(Abc_Obj_t *pNode)
Definition: abcTiming.c:49
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1265
char * Mio_GateReadName(Mio_Gate_t *pGate)
Definition: mioApi.c:143
float Rise
Definition: abc.h:124
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
int Abc_NtkDelayTraceCritPath_rec ( Vec_Int_t vSlacks,
Abc_Obj_t pNode,
Abc_Obj_t pLeaf,
Vec_Int_t vBest 
)

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

Synopsis [Find most-critical path (the path with smallest slacks).]

Description []

SideEffects []

SeeAlso []

Definition at line 755 of file abcTiming.c.

756 {
757  Abc_Obj_t * pFanin, * pFaninBest = NULL;
758  float SlackMin = ABC_INFINITY;
759  int i;
760  // check primary inputs
761  if ( Abc_ObjIsCi(pNode) )
762  return (pLeaf == NULL || pLeaf == pNode);
763  assert( Abc_ObjIsNode(pNode) );
764  // check visited
765  if ( Abc_NodeIsTravIdCurrent( pNode ) )
766  return Vec_IntEntry(vBest, Abc_ObjId(pNode)) >= 0;
767  Abc_NodeSetTravIdCurrent( pNode );
768  // check the node
769  assert( Abc_ObjIsNode(pNode) );
770  Abc_ObjForEachFanin( pNode, pFanin, i )
771  {
772  if ( !Abc_NtkDelayTraceCritPath_rec( vSlacks, pFanin, pLeaf, vBest ) )
773  continue;
774  if ( pFaninBest == NULL || SlackMin > Abc_NtkDelayTraceSlack(vSlacks, pNode, i) )
775  {
776  pFaninBest = pFanin;
777  SlackMin = Abc_NtkDelayTraceSlack(vSlacks, pNode, i);
778  }
779  }
780  if ( pFaninBest != NULL )
781  Vec_IntWriteEntry( vBest, Abc_ObjId(pNode), Abc_NodeFindFanin(pNode, pFaninBest) );
782  return (pFaninBest != NULL);
783 }
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 float Abc_NtkDelayTraceSlack(Vec_Int_t *vSlacks, Abc_Obj_t *pObj, int iFanin)
Definition: abcTiming.c:735
ABC_DLL int Abc_NodeFindFanin(Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
Definition: abcUtil.c:758
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
int Abc_NtkDelayTraceCritPath_rec(Vec_Int_t *vSlacks, Abc_Obj_t *pNode, Abc_Obj_t *pLeaf, Vec_Int_t *vBest)
Definition: abcTiming.c:755
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
#define assert(ex)
Definition: util_old.h:213
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
void Abc_NtkDelayTraceCritPathCollect_rec ( Vec_Int_t vSlacks,
Abc_Obj_t pNode,
Vec_Int_t vBest,
Vec_Ptr_t vPath 
)

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

Synopsis [Find most-critical path (the path with smallest slacks).]

Description []

SideEffects []

SeeAlso []

Definition at line 796 of file abcTiming.c.

797 {
798  assert( Abc_ObjIsCi(pNode) || Abc_ObjIsNode(pNode) );
799  if ( Abc_ObjIsNode(pNode) )
800  {
801  int iFanin = Vec_IntEntry( vBest, Abc_ObjId(pNode) );
802  assert( iFanin >= 0 );
803  Abc_NtkDelayTraceCritPathCollect_rec( vSlacks, Abc_ObjFanin(pNode, iFanin), vBest, vPath );
804  }
805  Vec_PtrPush( vPath, pNode );
806 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
void Abc_NtkDelayTraceCritPathCollect_rec(Vec_Int_t *vSlacks, Abc_Obj_t *pNode, Vec_Int_t *vBest, Vec_Ptr_t *vPath)
Definition: abcTiming.c:796
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_ObjFanin(Abc_Obj_t *pObj, int i)
Definition: abc.h:372
static void Abc_NtkDelayTraceSetSlack ( Vec_Int_t vSlacks,
Abc_Obj_t pObj,
int  iFanin,
float  Num 
)
inlinestatic

Definition at line 739 of file abcTiming.c.

740 {
741  Vec_IntWriteEntry( vSlacks, Vec_IntEntry(vSlacks, Abc_ObjId(pObj)) + iFanin, Abc_Float2Int(Num) );
742 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Abc_Float2Int(float Val)
Definition: abc_global.h:249
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static float Abc_NtkDelayTraceSlack ( Vec_Int_t vSlacks,
Abc_Obj_t pObj,
int  iFanin 
)
inlinestatic

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

Synopsis [Read/write edge slacks.]

Description []

SideEffects []

SeeAlso []

Definition at line 735 of file abcTiming.c.

736 {
737  return Abc_Int2Float( Vec_IntEntry( vSlacks, Vec_IntEntry(vSlacks, Abc_ObjId(pObj)) + iFanin ) );
738 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static float Abc_Int2Float(int Num)
Definition: abc_global.h:250
Vec_Int_t* Abc_NtkDelayTraceSlackStart ( Abc_Ntk_t pNtk)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 707 of file abcTiming.c.

708 {
709  Vec_Int_t * vSlacks;
710  Abc_Obj_t * pObj;
711  int i, k;
712  vSlacks = Vec_IntAlloc( Abc_NtkObjNumMax(pNtk) + Abc_NtkGetTotalFanins(pNtk) );
713  Vec_IntFill( vSlacks, Abc_NtkObjNumMax(pNtk), -1 );
714  Abc_NtkForEachNode( pNtk, pObj, i )
715  {
716  Vec_IntWriteEntry( vSlacks, i, Vec_IntSize(vSlacks) );
717  for ( k = 0; k < Abc_ObjFaninNum(pObj); k++ )
718  Vec_IntPush( vSlacks, -1 );
719  }
720 // assert( Abc_MaxInt(16, Vec_IntSize(vSlacks)) == Vec_IntCap(vSlacks) );
721  return vSlacks;
722 }
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
ABC_DLL int Abc_NtkGetTotalFanins(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:487
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
float* Abc_NtkGetCiArrivalFloats ( Abc_Ntk_t pNtk)

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

Synopsis [Sets the CI node levels according to the arrival info.]

Description []

SideEffects []

SeeAlso []

Definition at line 658 of file abcTiming.c.

659 {
660  float * p;
661  Abc_Obj_t * pNode;
662  int i;
663  p = ABC_CALLOC( float, Abc_NtkCiNum(pNtk) );
664  if ( pNtk->pManTime == NULL )
665  return p;
666  Abc_NtkForEachCi( pNtk, pNode, i )
667  if ( Abc_NodeReadArrivalWorst(pNode) != 0 )
668  break;
669  if ( i == Abc_NtkCiNum(pNtk) )
670  return NULL;
671  // set the PI arrival times
672  Abc_NtkForEachCi( pNtk, pNode, i )
673  p[i] = Abc_NodeReadArrivalWorst(pNode);
674  return p;
675 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
float Abc_NodeReadArrivalWorst(Abc_Obj_t *pNode)
Definition: abcTiming.c:95
if(last==0)
Definition: sparse_int.h:34
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
Abc_Time_t* Abc_NtkGetCiArrivalTimes ( Abc_Ntk_t pNtk)

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

Synopsis [Sets the CI node levels according to the arrival info.]

Description []

SideEffects []

SeeAlso []

Definition at line 619 of file abcTiming.c.

620 {
621  Abc_Time_t * p;
622  Abc_Obj_t * pNode;
623  int i;
624  p = ABC_CALLOC( Abc_Time_t, Abc_NtkCiNum(pNtk) );
625  if ( pNtk->pManTime == NULL )
626  return p;
627  // set the PI arrival times
628  Abc_NtkForEachCi( pNtk, pNode, i )
629  p[i] = *Abc_NodeArrival(pNode);
630  return p;
631 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static Abc_Time_t * Abc_NodeArrival(Abc_Obj_t *pNode)
Definition: abcTiming.c:49
float* Abc_NtkGetCoRequiredFloats ( Abc_Ntk_t pNtk)

Definition at line 676 of file abcTiming.c.

677 {
678  float * p;
679  Abc_Obj_t * pNode;
680  int i;
681  if ( pNtk->pManTime == NULL )
682  return NULL;
683  Abc_NtkForEachCo( pNtk, pNode, i )
685  break;
686  if ( i == Abc_NtkCoNum(pNtk) )
687  return NULL;
688  // set the PO required times
689  p = ABC_CALLOC( float, Abc_NtkCoNum(pNtk) );
690  Abc_NtkForEachCo( pNtk, pNode, i )
691  p[i] = Abc_NodeReadRequiredWorst(pNode);
692  return p;
693 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
float Abc_NodeReadRequiredWorst(Abc_Obj_t *pNode)
Definition: abcTiming.c:99
if(last==0)
Definition: sparse_int.h:34
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
Abc_Time_t* Abc_NtkGetCoRequiredTimes ( Abc_Ntk_t pNtk)

Definition at line 632 of file abcTiming.c.

633 {
634  Abc_Time_t * p;
635  Abc_Obj_t * pNode;
636  int i;
637  p = ABC_CALLOC( Abc_Time_t, Abc_NtkCoNum(pNtk) );
638  if ( pNtk->pManTime == NULL )
639  return p;
640  // set the PO required times
641  Abc_NtkForEachCo( pNtk, pNode, i )
642  p[i] = *Abc_NodeRequired(pNode);
643  return p;
644 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static Abc_Time_t * Abc_NodeRequired(Abc_Obj_t *pNode)
Definition: abcTiming.c:50
Abc_Time_t* Abc_NtkReadDefaultArrival ( Abc_Ntk_t pNtk)

FUNCTION DEFINITIONS ///.

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

Synopsis [Reads the arrival.required time of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 67 of file abcTiming.c.

68 {
69  assert( pNtk->pManTime );
70  return &pNtk->pManTime->tArrDef;
71 }
Abc_Time_t tArrDef
Definition: abcTiming.c:34
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define assert(ex)
Definition: util_old.h:213
Abc_Time_t* Abc_NtkReadDefaultInputDrive ( Abc_Ntk_t pNtk)

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

Synopsis [Reads the input drive / output load of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 115 of file abcTiming.c.

116 {
117  assert( pNtk->pManTime );
118  return &pNtk->pManTime->tInDriveDef;
119 }
Abc_Time_t tInDriveDef
Definition: abcTiming.c:38
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define assert(ex)
Definition: util_old.h:213
Abc_Time_t* Abc_NtkReadDefaultOutputLoad ( Abc_Ntk_t pNtk)

Definition at line 120 of file abcTiming.c.

121 {
122  assert( pNtk->pManTime );
123  return &pNtk->pManTime->tOutLoadDef;
124 }
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define assert(ex)
Definition: util_old.h:213
Abc_Time_t tOutLoadDef
Definition: abcTiming.c:39
Abc_Time_t* Abc_NtkReadDefaultRequired ( Abc_Ntk_t pNtk)

Definition at line 72 of file abcTiming.c.

73 {
74  assert( pNtk->pManTime );
75  return &pNtk->pManTime->tReqDef;
76 }
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define assert(ex)
Definition: util_old.h:213
Abc_Time_t tReqDef
Definition: abcTiming.c:35
void Abc_NtkSetNodeLevelsArrival ( Abc_Ntk_t pNtkOld)

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

Synopsis [Sets the CI node levels according to the arrival info.]

Description []

SideEffects []

SeeAlso []

Definition at line 591 of file abcTiming.c.

592 {
593  Abc_Obj_t * pNodeOld, * pNodeNew;
594  float tAndDelay;
595  int i;
596  if ( pNtkOld->pManTime == NULL )
597  return;
599  return;
601  Abc_NtkForEachCi( pNtkOld, pNodeOld, i )
602  {
603  pNodeNew = pNodeOld->pCopy;
604  pNodeNew->Level = (int)(Abc_NodeReadArrivalWorst(pNodeOld) / tAndDelay);
605  }
606 }
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
float Mio_LibraryReadDelayNand2Max(Mio_Library_t *pLib)
Definition: mioApi.c:58
unsigned Level
Definition: abc.h:142
Mio_Gate_t * Mio_LibraryReadNand2(Mio_Library_t *pLib)
Definition: mioApi.c:51
Abc_Obj_t * pCopy
Definition: abc.h:148
float Abc_NodeReadArrivalWorst(Abc_Obj_t *pNode)
Definition: abcTiming.c:95
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
Abc_ManTime_t * pManTime
Definition: abc.h:192
void Abc_NtkStartReverseLevels ( Abc_Ntk_t pNtk,
int  nMaxLevelIncrease 
)

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

Synopsis [Prepares for the computation of required levels.]

Description [This procedure should be called before the required times are used. It starts internal data structures, which records the level from the COs of the network nodes in reverse topologogical order.]

SideEffects []

SeeAlso []

Definition at line 1162 of file abcTiming.c.

1163 {
1164  Vec_Ptr_t * vNodes;
1165  Abc_Obj_t * pObj;
1166  int i;
1167  // remember the maximum number of direct levels
1168  pNtk->LevelMax = Abc_NtkLevel(pNtk) + nMaxLevelIncrease;
1169  // start the reverse levels
1170  pNtk->vLevelsR = Vec_IntAlloc( 0 );
1171  Vec_IntFill( pNtk->vLevelsR, 1 + Abc_NtkObjNumMax(pNtk), 0 );
1172  // compute levels in reverse topological order
1173  vNodes = Abc_NtkDfsReverse( pNtk );
1174  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
1176  Vec_PtrFree( vNodes );
1177 }
Vec_Int_t * vLevelsR
Definition: abc.h:196
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
int LevelMax
Definition: abc.h:195
void Abc_ObjSetReverseLevel(Abc_Obj_t *pObj, int LevelR)
Definition: abcTiming.c:1141
ABC_DLL Vec_Ptr_t * Abc_NtkDfsReverse(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:190
int Abc_ObjReverseLevelNew(Abc_Obj_t *pObj)
Definition: abcTiming.c:1078
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1265
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Abc_NtkStopReverseLevels ( Abc_Ntk_t pNtk)

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

Synopsis [Cleans the data structures used to compute required levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 1190 of file abcTiming.c.

1191 {
1192  assert( pNtk->vLevelsR );
1193  Vec_IntFree( pNtk->vLevelsR );
1194  pNtk->vLevelsR = NULL;
1195  pNtk->LevelMax = 0;
1196 
1197 }
Vec_Int_t * vLevelsR
Definition: abc.h:196
int LevelMax
Definition: abc.h:195
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
void Abc_NtkTimeInitialize ( Abc_Ntk_t pNtk,
Abc_Ntk_t pNtkOld 
)

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

Synopsis [Finalizes the timing manager after setting arr/req times.]

Description []

SideEffects []

SeeAlso []

Definition at line 321 of file abcTiming.c.

322 {
323  Abc_Obj_t * pObj;
324  Abc_Time_t ** ppTimes, * pTime;
325  int i;
326  assert( pNtkOld == NULL || pNtkOld->pManTime != NULL );
327  assert( pNtkOld == NULL || Abc_NtkCiNum(pNtk) == Abc_NtkCiNum(pNtkOld) );
328  assert( pNtkOld == NULL || Abc_NtkCoNum(pNtk) == Abc_NtkCoNum(pNtkOld) );
329  if ( pNtk->pManTime == NULL )
330  return;
331  Abc_ManTimeExpand( pNtk->pManTime, Abc_NtkObjNumMax(pNtk), 0 );
332  // set global defaults
333  if ( pNtkOld )
334  {
335  pNtk->pManTime->tArrDef = pNtkOld->pManTime->tArrDef;
336  pNtk->pManTime->tReqDef = pNtkOld->pManTime->tReqDef;
337  pNtk->AndGateDelay = pNtkOld->AndGateDelay;
338  }
339  // set the default timing
340  ppTimes = (Abc_Time_t **)pNtk->pManTime->vArrs->pArray;
341  Abc_NtkForEachCi( pNtk, pObj, i )
342  {
343  pTime = ppTimes[pObj->Id];
344  if ( Abc_MaxFloat(pTime->Fall, pTime->Rise) != -ABC_INFINITY )
345  continue;
346  *pTime = pNtkOld ? *Abc_NodeReadArrival(Abc_NtkCi(pNtkOld, i)) : pNtk->pManTime->tArrDef;
347  }
348  // set the default timing
349  ppTimes = (Abc_Time_t **)pNtk->pManTime->vReqs->pArray;
350  Abc_NtkForEachCo( pNtk, pObj, i )
351  {
352  pTime = ppTimes[pObj->Id];
353  if ( Abc_MaxFloat(pTime->Fall, pTime->Rise) != ABC_INFINITY )
354  continue;
355  *pTime = pNtkOld ? *Abc_NodeReadRequired(Abc_NtkCo(pNtkOld, i)) : pNtk->pManTime->tReqDef;
356  }
357  // set the 0 arrival times for latch outputs and constant nodes
358  ppTimes = (Abc_Time_t **)pNtk->pManTime->vArrs->pArray;
359  Abc_NtkForEachLatchOutput( pNtk, pObj, i )
360  {
361  pTime = ppTimes[pObj->Id];
362  pTime->Fall = pTime->Rise = 0.0;
363  }
364 }
Abc_Time_t * Abc_NodeReadRequired(Abc_Obj_t *pNode)
Definition: abcTiming.c:82
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
float AndGateDelay
Definition: abc.h:194
#define Abc_NtkForEachLatchOutput(pNtk, pObj, i)
Definition: abc.h:503
Vec_Ptr_t * vArrs
Definition: abcTiming.c:36
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Abc_Obj_t * Abc_NtkCi(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:317
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:318
static void Abc_ManTimeExpand(Abc_ManTime_t *p, int nSize, int fProgressive)
Definition: abcTiming.c:533
Abc_Time_t tArrDef
Definition: abcTiming.c:34
float Fall
Definition: abc.h:125
Vec_Ptr_t * vReqs
Definition: abcTiming.c:37
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
int Id
Definition: abc.h:132
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
#define assert(ex)
Definition: util_old.h:213
Abc_Time_t * Abc_NodeReadArrival(Abc_Obj_t *pNode)
Definition: abcTiming.c:77
Abc_Time_t tReqDef
Definition: abcTiming.c:35
float Rise
Definition: abc.h:124
void Abc_NtkTimePrepare ( Abc_Ntk_t pNtk)

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

Synopsis [Prepares the timing manager for delay trace.]

Description []

SideEffects []

SeeAlso []

Definition at line 377 of file abcTiming.c.

378 {
379  Abc_Obj_t * pObj;
380  Abc_Time_t ** ppTimes, * pTime;
381  int i;
382  // if there is no timing manager, allocate and initialize
383  if ( pNtk->pManTime == NULL )
384  {
385  pNtk->pManTime = Abc_ManTimeStart(pNtk);
386  Abc_NtkTimeInitialize( pNtk, NULL );
387  return;
388  }
389  // if timing manager is given, expand it if necessary
390  Abc_ManTimeExpand( pNtk->pManTime, Abc_NtkObjNumMax(pNtk), 0 );
391  // clean arrivals except for PIs
392  ppTimes = (Abc_Time_t **)pNtk->pManTime->vArrs->pArray;
393  Abc_NtkForEachNode( pNtk, pObj, i )
394  {
395  pTime = ppTimes[pObj->Id];
396  pTime->Fall = pTime->Rise = -ABC_INFINITY;
397  }
398  Abc_NtkForEachCo( pNtk, pObj, i )
399  {
400  pTime = ppTimes[pObj->Id];
401  pTime->Fall = pTime->Rise = -ABC_INFINITY;
402  }
403  // clean required except for POs
404  ppTimes = (Abc_Time_t **)pNtk->pManTime->vReqs->pArray;
405  Abc_NtkForEachNode( pNtk, pObj, i )
406  {
407  pTime = ppTimes[pObj->Id];
408  pTime->Fall = pTime->Rise = ABC_INFINITY;
409  }
410  Abc_NtkForEachCi( pNtk, pObj, i )
411  {
412  pTime = ppTimes[pObj->Id];
413  pTime->Fall = pTime->Rise = ABC_INFINITY;
414  }
415 }
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
void Abc_NtkTimeInitialize(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkOld)
Definition: abcTiming.c:321
Vec_Ptr_t * vArrs
Definition: abcTiming.c:36
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static void Abc_ManTimeExpand(Abc_ManTime_t *p, int nSize, int fProgressive)
Definition: abcTiming.c:533
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
float Fall
Definition: abc.h:125
Vec_Ptr_t * vReqs
Definition: abcTiming.c:37
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static Abc_ManTime_t * Abc_ManTimeStart(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:431
int Id
Definition: abc.h:132
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
float Rise
Definition: abc.h:124
void Abc_NtkTimeSetArrival ( Abc_Ntk_t pNtk,
int  ObjId,
float  Rise,
float  Fall 
)

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

Synopsis [Sets the arrival time for an object.]

Description []

SideEffects []

SeeAlso []

Definition at line 185 of file abcTiming.c.

186 {
187  Vec_Ptr_t * vTimes;
188  Abc_Time_t * pTime;
189  if ( pNtk->pManTime == NULL )
190  pNtk->pManTime = Abc_ManTimeStart(pNtk);
191  if ( pNtk->pManTime->tArrDef.Rise == Rise && pNtk->pManTime->tArrDef.Fall == Fall )
192  return;
193  Abc_ManTimeExpand( pNtk->pManTime, ObjId + 1, 1 );
194  // set the arrival time
195  vTimes = pNtk->pManTime->vArrs;
196  pTime = (Abc_Time_t *)vTimes->pArray[ObjId];
197  pTime->Rise = Rise;
198  pTime->Fall = Fall;
199 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Vec_Ptr_t * vArrs
Definition: abcTiming.c:36
static void Abc_ManTimeExpand(Abc_ManTime_t *p, int nSize, int fProgressive)
Definition: abcTiming.c:533
Abc_Time_t tArrDef
Definition: abcTiming.c:34
float Fall
Definition: abc.h:125
static Abc_ManTime_t * Abc_ManTimeStart(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:431
Abc_ManTime_t * pManTime
Definition: abc.h:192
float Rise
Definition: abc.h:124
void Abc_NtkTimeSetDefaultArrival ( Abc_Ntk_t pNtk,
float  Rise,
float  Fall 
)

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

Synopsis [Sets the default arrival time for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 155 of file abcTiming.c.

156 {
157  if ( Rise == 0.0 && Fall == 0.0 )
158  return;
159  if ( pNtk->pManTime == NULL )
160  pNtk->pManTime = Abc_ManTimeStart(pNtk);
161  pNtk->pManTime->tArrDef.Rise = Rise;
162  pNtk->pManTime->tArrDef.Fall = Fall;
163 }
Abc_Time_t tArrDef
Definition: abcTiming.c:34
float Fall
Definition: abc.h:125
static Abc_ManTime_t * Abc_ManTimeStart(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:431
Abc_ManTime_t * pManTime
Definition: abc.h:192
float Rise
Definition: abc.h:124
void Abc_NtkTimeSetDefaultInputDrive ( Abc_Ntk_t pNtk,
float  Rise,
float  Fall 
)

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

Synopsis [Sets the default arrival time for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 227 of file abcTiming.c.

228 {
229  if ( Rise == 0.0 && Fall == 0.0 )
230  return;
231  if ( pNtk->pManTime == NULL )
232  pNtk->pManTime = Abc_ManTimeStart(pNtk);
233  pNtk->pManTime->tInDriveDef.Rise = Rise;
234  pNtk->pManTime->tInDriveDef.Fall = Fall;
235  if ( pNtk->pManTime->tInDrive != NULL )
236  {
237  int i;
238  for ( i = 0; i < Abc_NtkCiNum(pNtk); i++ )
239  if ( pNtk->pManTime->tInDrive[i].Rise == 0 && pNtk->pManTime->tInDrive[i].Fall == 0 )
240  pNtk->pManTime->tInDrive[i] = pNtk->pManTime->tInDriveDef;
241  }
242 }
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
Abc_Time_t tInDriveDef
Definition: abcTiming.c:38
Abc_Time_t * tInDrive
Definition: abcTiming.c:40
float Fall
Definition: abc.h:125
static Abc_ManTime_t * Abc_ManTimeStart(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:431
Abc_ManTime_t * pManTime
Definition: abc.h:192
float Rise
Definition: abc.h:124
void Abc_NtkTimeSetDefaultOutputLoad ( Abc_Ntk_t pNtk,
float  Rise,
float  Fall 
)

Definition at line 243 of file abcTiming.c.

244 {
245  if ( Rise == 0.0 && Fall == 0.0 )
246  return;
247  if ( pNtk->pManTime == NULL )
248  pNtk->pManTime = Abc_ManTimeStart(pNtk);
249  pNtk->pManTime->tOutLoadDef.Rise = Rise;
250  pNtk->pManTime->tOutLoadDef.Fall = Fall;
251  if ( pNtk->pManTime->tOutLoad != NULL )
252  {
253  int i;
254  for ( i = 0; i < Abc_NtkCoNum(pNtk); i++ )
255  if ( pNtk->pManTime->tOutLoad[i].Rise == 0 && pNtk->pManTime->tOutLoad[i].Fall == 0 )
256  pNtk->pManTime->tOutLoad[i] = pNtk->pManTime->tOutLoadDef;
257  }
258 }
Abc_Time_t * tOutLoad
Definition: abcTiming.c:41
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
float Fall
Definition: abc.h:125
static Abc_ManTime_t * Abc_ManTimeStart(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:431
Abc_ManTime_t * pManTime
Definition: abc.h:192
Abc_Time_t tOutLoadDef
Definition: abcTiming.c:39
float Rise
Definition: abc.h:124
void Abc_NtkTimeSetDefaultRequired ( Abc_Ntk_t pNtk,
float  Rise,
float  Fall 
)

Definition at line 164 of file abcTiming.c.

165 {
166  if ( Rise == 0.0 && Fall == 0.0 )
167  return;
168  if ( pNtk->pManTime == NULL )
169  pNtk->pManTime = Abc_ManTimeStart(pNtk);
170  pNtk->pManTime->tReqDef.Rise = Rise;
171  pNtk->pManTime->tReqDef.Fall = Fall;
172 }
float Fall
Definition: abc.h:125
static Abc_ManTime_t * Abc_ManTimeStart(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:431
Abc_ManTime_t * pManTime
Definition: abc.h:192
Abc_Time_t tReqDef
Definition: abcTiming.c:35
float Rise
Definition: abc.h:124
void Abc_NtkTimeSetInputDrive ( Abc_Ntk_t pNtk,
int  PiNum,
float  Rise,
float  Fall 
)

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

Synopsis [Sets the arrival time for an object.]

Description []

SideEffects []

SeeAlso []

Definition at line 271 of file abcTiming.c.

272 {
273  Abc_Time_t * pTime;
274  assert( PiNum >= 0 && PiNum < Abc_NtkCiNum(pNtk) );
275  if ( pNtk->pManTime == NULL )
276  pNtk->pManTime = Abc_ManTimeStart(pNtk);
277  if ( pNtk->pManTime->tInDriveDef.Rise == Rise && pNtk->pManTime->tInDriveDef.Fall == Fall )
278  return;
279  if ( pNtk->pManTime->tInDrive == NULL )
280  {
281  int i;
283  for ( i = 0; i < Abc_NtkCiNum(pNtk); i++ )
284  pNtk->pManTime->tInDrive[i] = pNtk->pManTime->tInDriveDef;
285  }
286  pTime = pNtk->pManTime->tInDrive + PiNum;
287  pTime->Rise = Rise;
288  pTime->Fall = Fall;
289 }
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
Abc_Time_t tInDriveDef
Definition: abcTiming.c:38
Abc_Time_t * tInDrive
Definition: abcTiming.c:40
float Fall
Definition: abc.h:125
static Abc_ManTime_t * Abc_ManTimeStart(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:431
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
float Rise
Definition: abc.h:124
void Abc_NtkTimeSetOutputLoad ( Abc_Ntk_t pNtk,
int  PoNum,
float  Rise,
float  Fall 
)

Definition at line 290 of file abcTiming.c.

291 {
292  Abc_Time_t * pTime;
293  assert( PoNum >= 0 && PoNum < Abc_NtkCoNum(pNtk) );
294  if ( pNtk->pManTime == NULL )
295  pNtk->pManTime = Abc_ManTimeStart(pNtk);
296  if ( pNtk->pManTime->tOutLoadDef.Rise == Rise && pNtk->pManTime->tOutLoadDef.Fall == Fall )
297  return;
298  if ( pNtk->pManTime->tOutLoad == NULL )
299  {
300  int i;
302  for ( i = 0; i < Abc_NtkCoNum(pNtk); i++ )
303  pNtk->pManTime->tOutLoad[i] = pNtk->pManTime->tOutLoadDef;
304  }
305  pTime = pNtk->pManTime->tOutLoad + PoNum;
306  pTime->Rise = Rise;
307  pTime->Fall = Fall;
308 }
Abc_Time_t * tOutLoad
Definition: abcTiming.c:41
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
float Fall
Definition: abc.h:125
static Abc_ManTime_t * Abc_ManTimeStart(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:431
Abc_ManTime_t * pManTime
Definition: abc.h:192
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
Abc_Time_t tOutLoadDef
Definition: abcTiming.c:39
float Rise
Definition: abc.h:124
void Abc_NtkTimeSetRequired ( Abc_Ntk_t pNtk,
int  ObjId,
float  Rise,
float  Fall 
)

Definition at line 200 of file abcTiming.c.

201 {
202  Vec_Ptr_t * vTimes;
203  Abc_Time_t * pTime;
204  if ( pNtk->pManTime == NULL )
205  pNtk->pManTime = Abc_ManTimeStart(pNtk);
206  if ( pNtk->pManTime->tReqDef.Rise == Rise && pNtk->pManTime->tReqDef.Fall == Fall )
207  return;
208  Abc_ManTimeExpand( pNtk->pManTime, ObjId + 1, 1 );
209  // set the required time
210  vTimes = pNtk->pManTime->vReqs;
211  pTime = (Abc_Time_t *)vTimes->pArray[ObjId];
212  pTime->Rise = Rise;
213  pTime->Fall = Fall;
214 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Abc_ManTimeExpand(Abc_ManTime_t *p, int nSize, int fProgressive)
Definition: abcTiming.c:533
float Fall
Definition: abc.h:125
Vec_Ptr_t * vReqs
Definition: abcTiming.c:37
static Abc_ManTime_t * Abc_ManTimeStart(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:431
Abc_ManTime_t * pManTime
Definition: abc.h:192
Abc_Time_t tReqDef
Definition: abcTiming.c:35
float Rise
Definition: abc.h:124
void Abc_NtkUpdate ( Abc_Obj_t pObj,
Abc_Obj_t pObjNew,
Vec_Vec_t vLevels 
)

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

Synopsis [Replaces the node and incrementally updates levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 1311 of file abcTiming.c.

1312 {
1313  // replace the old node by the new node
1314  pObjNew->Level = pObj->Level;
1315  Abc_ObjReplace( pObj, pObjNew );
1316  // update the level of the node
1317  Abc_NtkUpdateLevel( pObjNew, vLevels );
1318  Abc_ObjSetReverseLevel( pObjNew, 0 );
1319  Abc_NtkUpdateReverseLevel( pObjNew, vLevels );
1320 }
void Abc_NtkUpdateReverseLevel(Abc_Obj_t *pObjNew, Vec_Vec_t *vLevels)
Definition: abcTiming.c:1262
void Abc_ObjSetReverseLevel(Abc_Obj_t *pObj, int LevelR)
Definition: abcTiming.c:1141
unsigned Level
Definition: abc.h:142
ABC_DLL void Abc_ObjReplace(Abc_Obj_t *pObjOld, Abc_Obj_t *pObjNew)
Definition: abcFanio.c:297
void Abc_NtkUpdateLevel(Abc_Obj_t *pObjNew, Vec_Vec_t *vLevels)
Definition: abcTiming.c:1210
void Abc_NtkUpdateLevel ( Abc_Obj_t pObjNew,
Vec_Vec_t vLevels 
)

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

Synopsis [Incrementally updates level of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1210 of file abcTiming.c.

1211 {
1212  Abc_Obj_t * pFanout, * pTemp;
1213  int LevelOld, Lev, k, m;
1214 // int Counter = 0, CounterMax = 0;
1215  // check if level has changed
1216  LevelOld = Abc_ObjLevel(pObjNew);
1217  if ( LevelOld == Abc_ObjLevelNew(pObjNew) )
1218  return;
1219  // start the data structure for level update
1220  // we cannot fail to visit a node when using this structure because the
1221  // nodes are stored by their _old_ levels, which are assumed to be correct
1222  Vec_VecClear( vLevels );
1223  Vec_VecPush( vLevels, LevelOld, pObjNew );
1224  pObjNew->fMarkA = 1;
1225  // recursively update level
1226  Vec_VecForEachEntryStart( Abc_Obj_t *, vLevels, pTemp, Lev, k, LevelOld )
1227  {
1228 // Counter--;
1229  pTemp->fMarkA = 0;
1230  assert( Abc_ObjLevel(pTemp) == Lev );
1231  Abc_ObjSetLevel( pTemp, Abc_ObjLevelNew(pTemp) );
1232  // if the level did not change, no need to check the fanout levels
1233  if ( Abc_ObjLevel(pTemp) == Lev )
1234  continue;
1235  // schedule fanout for level update
1236  Abc_ObjForEachFanout( pTemp, pFanout, m )
1237  {
1238  if ( !Abc_ObjIsCo(pFanout) && !pFanout->fMarkA )
1239  {
1240  assert( Abc_ObjLevel(pFanout) >= Lev );
1241  Vec_VecPush( vLevels, Abc_ObjLevel(pFanout), pFanout );
1242 // Counter++;
1243 // CounterMax = Abc_MaxFloat( CounterMax, Counter );
1244  pFanout->fMarkA = 1;
1245  }
1246  }
1247  }
1248 // printf( "%d ", CounterMax );
1249 }
static void Vec_VecPush(Vec_Vec_t *p, int Level, void *Entry)
Definition: vecVec.h:456
unsigned fMarkA
Definition: abc.h:134
int Abc_ObjLevelNew(Abc_Obj_t *pObj)
Definition: abcTiming.c:1058
static void Abc_ObjSetLevel(Abc_Obj_t *pObj, int Level)
Definition: abc.h:341
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
static void Vec_VecClear(Vec_Vec_t *p)
Definition: vecVec.h:437
static int Abc_ObjLevel(Abc_Obj_t *pObj)
Definition: abc.h:330
#define Vec_VecForEachEntryStart(Type, vGlob, pEntry, i, k, LevelStart)
Definition: vecVec.h:92
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
#define assert(ex)
Definition: util_old.h:213
void Abc_NtkUpdateReverseLevel ( Abc_Obj_t pObjNew,
Vec_Vec_t vLevels 
)

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

Synopsis [Incrementally updates level of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1262 of file abcTiming.c.

1263 {
1264  Abc_Obj_t * pFanin, * pTemp;
1265  int LevelOld, LevFanin, Lev, k, m;
1266  // check if level has changed
1267  LevelOld = Abc_ObjReverseLevel(pObjNew);
1268  if ( LevelOld == Abc_ObjReverseLevelNew(pObjNew) )
1269  return;
1270  // start the data structure for level update
1271  // we cannot fail to visit a node when using this structure because the
1272  // nodes are stored by their _old_ levels, which are assumed to be correct
1273  Vec_VecClear( vLevels );
1274  Vec_VecPush( vLevels, LevelOld, pObjNew );
1275  pObjNew->fMarkA = 1;
1276  // recursively update level
1277  Vec_VecForEachEntryStart( Abc_Obj_t *, vLevels, pTemp, Lev, k, LevelOld )
1278  {
1279  pTemp->fMarkA = 0;
1280  LevelOld = Abc_ObjReverseLevel(pTemp);
1281  assert( LevelOld == Lev );
1283  // if the level did not change, no need to check the fanout levels
1284  if ( Abc_ObjReverseLevel(pTemp) == Lev )
1285  continue;
1286  // schedule fanins for level update
1287  Abc_ObjForEachFanin( pTemp, pFanin, m )
1288  {
1289  if ( !Abc_ObjIsCi(pFanin) && !pFanin->fMarkA )
1290  {
1291  LevFanin = Abc_ObjReverseLevel( pFanin );
1292  assert( LevFanin >= Lev );
1293  Vec_VecPush( vLevels, LevFanin, pFanin );
1294  pFanin->fMarkA = 1;
1295  }
1296  }
1297  }
1298 }
static void Vec_VecPush(Vec_Vec_t *p, int Level, void *Entry)
Definition: vecVec.h:456
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
unsigned fMarkA
Definition: abc.h:134
int Abc_ObjReverseLevel(Abc_Obj_t *pObj)
Definition: abcTiming.c:1121
void Abc_ObjSetReverseLevel(Abc_Obj_t *pObj, int LevelR)
Definition: abcTiming.c:1141
static void Vec_VecClear(Vec_Vec_t *p)
Definition: vecVec.h:437
int Abc_ObjReverseLevelNew(Abc_Obj_t *pObj)
Definition: abcTiming.c:1078
#define Vec_VecForEachEntryStart(Type, vGlob, pEntry, i, k, LevelStart)
Definition: vecVec.h:92
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
#define assert(ex)
Definition: util_old.h:213
int Abc_ObjLevelNew ( Abc_Obj_t pObj)

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

Synopsis [Computes the level of the node using its fanin levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 1058 of file abcTiming.c.

1059 {
1060  Abc_Obj_t * pFanin;
1061  int i, Level = 0;
1062  Abc_ObjForEachFanin( pObj, pFanin, i )
1063  Level = Abc_MaxFloat( Level, Abc_ObjLevel(pFanin) );
1064  return Level + (int)(Abc_ObjFaninNum(pObj) > 0);
1065 }
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
static int Abc_ObjLevel(Abc_Obj_t *pObj)
Definition: abc.h:330
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
int Abc_ObjRequiredLevel ( Abc_Obj_t pObj)

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

Synopsis [Returns required level of the node.]

Description [Converts the reverse levels of the node into its required level as follows: ReqLevel(Node) = MaxLevels(Ntk) + 1 - LevelR(Node).]

SideEffects []

SeeAlso []

Definition at line 1102 of file abcTiming.c.

1103 {
1104  Abc_Ntk_t * pNtk = pObj->pNtk;
1105  assert( pNtk->vLevelsR );
1106  return pNtk->LevelMax + 1 - Abc_ObjReverseLevel(pObj);
1107 }
Vec_Int_t * vLevelsR
Definition: abc.h:196
int Abc_ObjReverseLevel(Abc_Obj_t *pObj)
Definition: abcTiming.c:1121
int LevelMax
Definition: abc.h:195
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define assert(ex)
Definition: util_old.h:213
int Abc_ObjReverseLevel ( Abc_Obj_t pObj)

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

Synopsis [Returns the reverse level of the node.]

Description [The reverse level is the level of the node in reverse topological order, starting from the COs.]

SideEffects []

SeeAlso []

Definition at line 1121 of file abcTiming.c.

1122 {
1123  Abc_Ntk_t * pNtk = pObj->pNtk;
1124  assert( pNtk->vLevelsR );
1125  Vec_IntFillExtra( pNtk->vLevelsR, pObj->Id + 1, 0 );
1126  return Vec_IntEntry(pNtk->vLevelsR, pObj->Id);
1127 }
Vec_Int_t * vLevelsR
Definition: abc.h:196
static void Vec_IntFillExtra(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:376
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Abc_Ntk_t * pNtk
Definition: abc.h:130
int Id
Definition: abc.h:132
#define assert(ex)
Definition: util_old.h:213
int Abc_ObjReverseLevelNew ( Abc_Obj_t pObj)

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

Synopsis [Computes the reverse level of the node using its fanout levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 1078 of file abcTiming.c.

1079 {
1080  Abc_Obj_t * pFanout;
1081  int i, LevelCur, Level = 0;
1082  Abc_ObjForEachFanout( pObj, pFanout, i )
1083  {
1084  LevelCur = Abc_ObjReverseLevel( pFanout );
1085  Level = Abc_MaxFloat( Level, LevelCur );
1086  }
1087  return Level + 1;
1088 }
int Abc_ObjReverseLevel(Abc_Obj_t *pObj)
Definition: abcTiming.c:1121
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition: abc.h:526
void Abc_ObjSetReverseLevel ( Abc_Obj_t pObj,
int  LevelR 
)

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

Synopsis [Sets the reverse level of the node.]

Description [The reverse level is the level of the node in reverse topological order, starting from the COs.]

SideEffects []

SeeAlso []

Definition at line 1141 of file abcTiming.c.

1142 {
1143  Abc_Ntk_t * pNtk = pObj->pNtk;
1144  assert( pNtk->vLevelsR );
1145  Vec_IntFillExtra( pNtk->vLevelsR, pObj->Id + 1, 0 );
1146  Vec_IntWriteEntry( pNtk->vLevelsR, pObj->Id, LevelR );
1147 }
Vec_Int_t * vLevelsR
Definition: abc.h:196
static void Vec_IntFillExtra(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:376
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
Abc_Ntk_t * pNtk
Definition: abc.h:130
int Id
Definition: abc.h:132
#define assert(ex)
Definition: util_old.h:213