src/base/abci/abcTiming.c File Reference

#include "abc.h"
#include "main.h"
#include "mio.h"
Include dependency graph for abcTiming.c:

Go to the source code of this file.

Data Structures

struct  Abc_ManTime_t_

Functions

static Abc_ManTime_tAbc_ManTimeStart ()
static void Abc_ManTimeExpand (Abc_ManTime_t *p, int nSize, int fProgressive)
void Abc_NtkTimePrepare (Abc_Ntk_t *pNtk)
void Abc_NodeDelayTraceArrival (Abc_Obj_t *pNode)
static Abc_Time_tAbc_NodeArrival (Abc_Obj_t *pNode)
static Abc_Time_tAbc_NodeRequired (Abc_Obj_t *pNode)
Abc_Time_tAbc_NodeReadArrival (Abc_Obj_t *pNode)
Abc_Time_tAbc_NodeReadRequired (Abc_Obj_t *pNode)
Abc_Time_tAbc_NtkReadDefaultArrival (Abc_Ntk_t *pNtk)
Abc_Time_tAbc_NtkReadDefaultRequired (Abc_Ntk_t *pNtk)
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_NtkTimeInitialize (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)
float * Abc_NtkGetCiArrivalFloats (Abc_Ntk_t *pNtk)
float Abc_NtkDelayTrace (Abc_Ntk_t *pNtk)
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 367 of file abcTiming.c.

00368 {
00369     Abc_Obj_t * pObj;
00370     Abc_Time_t ** ppTimesOld, ** ppTimesNew;
00371     int i;
00372     if ( pNtkOld->pManTime == NULL )
00373         return;
00374     assert( Abc_NtkPiNum(pNtkOld) == Abc_NtkPiNum(pNtkNew) );
00375     assert( Abc_NtkPoNum(pNtkOld) == Abc_NtkPoNum(pNtkNew) );
00376     assert( Abc_NtkLatchNum(pNtkOld) == Abc_NtkLatchNum(pNtkNew) );
00377     // create the new timing manager
00378     pNtkNew->pManTime = Abc_ManTimeStart();
00379     Abc_ManTimeExpand( pNtkNew->pManTime, Abc_NtkObjNumMax(pNtkNew), 0 );
00380     // set the default timing
00381     pNtkNew->pManTime->tArrDef = pNtkOld->pManTime->tArrDef;
00382     pNtkNew->pManTime->tReqDef = pNtkOld->pManTime->tReqDef;
00383     // set the CI timing
00384     ppTimesOld = (Abc_Time_t **)pNtkOld->pManTime->vArrs->pArray;
00385     ppTimesNew = (Abc_Time_t **)pNtkNew->pManTime->vArrs->pArray;
00386     Abc_NtkForEachCi( pNtkOld, pObj, i )
00387         *ppTimesNew[ Abc_NtkCi(pNtkNew,i)->Id ] = *ppTimesOld[ pObj->Id ];
00388     // set the CO timing
00389     ppTimesOld = (Abc_Time_t **)pNtkOld->pManTime->vReqs->pArray;
00390     ppTimesNew = (Abc_Time_t **)pNtkNew->pManTime->vReqs->pArray;
00391     Abc_NtkForEachCo( pNtkOld, pObj, i )
00392         *ppTimesNew[ Abc_NtkCo(pNtkNew,i)->Id ] = *ppTimesOld[ pObj->Id ];
00393 }

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 406 of file abcTiming.c.

00407 {
00408     Vec_Ptr_t * vTimes;
00409     Abc_Time_t * ppTimes, * ppTimesOld, * pTime;
00410     int nSizeOld, nSizeNew, i;
00411 
00412     nSizeOld = p->vArrs->nSize;
00413     if ( nSizeOld >= nSize )
00414         return;
00415     nSizeNew = fProgressive? 2 * nSize : nSize;
00416     if ( nSizeNew < 100 )
00417         nSizeNew = 100;
00418 
00419     vTimes = p->vArrs;
00420     Vec_PtrGrow( vTimes, nSizeNew );
00421     vTimes->nSize = nSizeNew;
00422     ppTimesOld = ( nSizeOld == 0 )? NULL : vTimes->pArray[0];
00423     ppTimes = REALLOC( Abc_Time_t, ppTimesOld, nSizeNew );
00424     for ( i = 0; i < nSizeNew; i++ )
00425         vTimes->pArray[i] = ppTimes + i;
00426     for ( i = nSizeOld; i < nSizeNew; i++ )
00427     {
00428         pTime = vTimes->pArray[i];
00429         pTime->Rise  = -ABC_INFINITY;
00430         pTime->Fall  = -ABC_INFINITY;
00431         pTime->Worst = -ABC_INFINITY;    
00432     }
00433 
00434     vTimes = p->vReqs;
00435     Vec_PtrGrow( vTimes, nSizeNew );
00436     vTimes->nSize = nSizeNew;
00437     ppTimesOld = ( nSizeOld == 0 )? NULL : vTimes->pArray[0];
00438     ppTimes = REALLOC( Abc_Time_t, ppTimesOld, nSizeNew );
00439     for ( i = 0; i < nSizeNew; i++ )
00440         vTimes->pArray[i] = ppTimes + i;
00441     for ( i = nSizeOld; i < nSizeNew; i++ )
00442     {
00443         pTime = vTimes->pArray[i];
00444         pTime->Rise  = -ABC_INFINITY;
00445         pTime->Fall  = -ABC_INFINITY;
00446         pTime->Worst = -ABC_INFINITY;    
00447     }
00448 }

Abc_ManTime_t * Abc_ManTimeStart (  )  [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 320 of file abcTiming.c.

00321 {
00322     Abc_ManTime_t * p;
00323     p = ALLOC( Abc_ManTime_t, 1 );
00324     memset( p, 0, sizeof(Abc_ManTime_t) );
00325     p->vArrs = Vec_PtrAlloc( 0 );
00326     p->vReqs = Vec_PtrAlloc( 0 );
00327     return p;
00328 }

void Abc_ManTimeStop ( Abc_ManTime_t p  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 341 of file abcTiming.c.

00342 {
00343     if ( p->vArrs->nSize > 0 )
00344     {
00345         free( p->vArrs->pArray[0] );
00346         Vec_PtrFree( p->vArrs );
00347     }
00348     if ( p->vReqs->nSize > 0 )
00349     {
00350         free( p->vReqs->pArray[0] );
00351         Vec_PtrFree( p->vReqs );
00352     }
00353     free( p );
00354 }

static Abc_Time_t* Abc_NodeArrival ( Abc_Obj_t pNode  )  [inline, static]

Definition at line 45 of file abcTiming.c.

00045 {  return pNode->pNtk->pManTime->vArrs->pArray[pNode->Id];  }

void Abc_NodeDelayTraceArrival ( Abc_Obj_t pNode  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 587 of file abcTiming.c.

00588 {
00589     Abc_Obj_t * pFanin;
00590     Abc_Time_t * pTimeIn, * pTimeOut;
00591     float tDelayBlockRise, tDelayBlockFall;
00592     Mio_PinPhase_t PinPhase;
00593     Mio_Pin_t * pPin;
00594     int i;
00595 
00596     // start the arrival time of the node
00597     pTimeOut = Abc_NodeArrival(pNode);
00598     pTimeOut->Rise = pTimeOut->Fall = -ABC_INFINITY; 
00599     // go through the pins of the gate
00600     pPin = Mio_GateReadPins(pNode->pData);
00601     Abc_ObjForEachFanin( pNode, pFanin, i )
00602     {
00603         pTimeIn = Abc_NodeArrival(pFanin);
00604         // get the interesting parameters of this pin
00605         PinPhase = Mio_PinReadPhase(pPin);
00606         tDelayBlockRise = (float)Mio_PinReadDelayBlockRise( pPin );  
00607         tDelayBlockFall = (float)Mio_PinReadDelayBlockFall( pPin );  
00608         // compute the arrival times of the positive phase
00609         if ( PinPhase != MIO_PHASE_INV )  // NONINV phase is present
00610         {
00611             if ( pTimeOut->Rise < pTimeIn->Rise + tDelayBlockRise )
00612                 pTimeOut->Rise = pTimeIn->Rise + tDelayBlockRise;
00613             if ( pTimeOut->Fall < pTimeIn->Fall + tDelayBlockFall )
00614                 pTimeOut->Fall = pTimeIn->Fall + tDelayBlockFall;
00615         }
00616         if ( PinPhase != MIO_PHASE_NONINV )  // INV phase is present
00617         {
00618             if ( pTimeOut->Rise < pTimeIn->Fall + tDelayBlockRise )
00619                 pTimeOut->Rise = pTimeIn->Fall + tDelayBlockRise;
00620             if ( pTimeOut->Fall < pTimeIn->Rise + tDelayBlockFall )
00621                 pTimeOut->Fall = pTimeIn->Rise + tDelayBlockFall;
00622         }
00623         pPin = Mio_PinReadNext(pPin);
00624     }
00625     pTimeOut->Worst = ABC_MAX( pTimeOut->Rise, pTimeOut->Fall );
00626 }

Abc_Time_t* Abc_NodeReadArrival ( Abc_Obj_t pNode  ) 

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

Synopsis [Reads the arrival time of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 63 of file abcTiming.c.

00064 {
00065     assert( pNode->pNtk->pManTime );
00066     return Abc_NodeArrival(pNode);
00067 }

Abc_Time_t* Abc_NodeReadRequired ( Abc_Obj_t pNode  ) 

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

Synopsis [Reads the arrival time of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 80 of file abcTiming.c.

00081 {
00082     assert( pNode->pNtk->pManTime );
00083     return Abc_NodeRequired(pNode);
00084 }

static Abc_Time_t* Abc_NodeRequired ( Abc_Obj_t pNode  )  [inline, static]

Definition at line 46 of file abcTiming.c.

00046 {  return pNode->pNtk->pManTime->vReqs->pArray[pNode->Id];  }

float Abc_NtkDelayTrace ( Abc_Ntk_t pNtk  ) 

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 548 of file abcTiming.c.

00549 {
00550     Abc_Obj_t * pNode, * pDriver;
00551     Vec_Ptr_t * vNodes;
00552     Abc_Time_t * pTime;
00553     float tArrivalMax;
00554     int i;
00555 
00556     assert( Abc_NtkIsMappedLogic(pNtk) );
00557 
00558     Abc_NtkTimePrepare( pNtk );
00559     vNodes = Abc_NtkDfs( pNtk, 1 );
00560     for ( i = 0; i < vNodes->nSize; i++ )
00561         Abc_NodeDelayTraceArrival( vNodes->pArray[i] );
00562     Vec_PtrFree( vNodes );
00563 
00564     // get the latest arrival times
00565     tArrivalMax = -ABC_INFINITY;
00566     Abc_NtkForEachCo( pNtk, pNode, i )
00567     {
00568         pDriver = Abc_ObjFanin0(pNode);
00569         pTime   = Abc_NodeArrival(pDriver);
00570         if ( tArrivalMax < pTime->Worst )
00571             tArrivalMax = pTime->Worst;
00572     }
00573     return tArrivalMax;
00574 }

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 521 of file abcTiming.c.

00522 {
00523     float * p;
00524     Abc_Obj_t * pNode;
00525     int i;
00526     p = ALLOC( float, Abc_NtkCiNum(pNtk) );
00527     memset( p, 0, sizeof(float) * Abc_NtkCiNum(pNtk) );
00528     if ( pNtk->pManTime == NULL )
00529         return p;
00530     // set the PI arrival times
00531     Abc_NtkForEachPi( pNtk, pNode, i )
00532         p[i] = Abc_NodeArrival(pNode)->Worst;
00533     return p;
00534 }

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 494 of file abcTiming.c.

00495 {
00496     Abc_Time_t * p;
00497     Abc_Obj_t * pNode;
00498     int i;
00499     p = ALLOC( Abc_Time_t, Abc_NtkCiNum(pNtk) );
00500     memset( p, 0, sizeof(Abc_Time_t) * Abc_NtkCiNum(pNtk) );
00501     if ( pNtk->pManTime == NULL )
00502         return p;
00503     // set the PI arrival times
00504     Abc_NtkForEachPi( pNtk, pNode, i )
00505         p[i] = *Abc_NodeArrival(pNode);
00506     return p;
00507 }

Abc_Time_t* Abc_NtkReadDefaultArrival ( Abc_Ntk_t pNtk  ) 

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

Synopsis [Reads the arrival time of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 97 of file abcTiming.c.

00098 {
00099     assert( pNtk->pManTime );
00100     return &pNtk->pManTime->tArrDef;
00101 }

Abc_Time_t* Abc_NtkReadDefaultRequired ( Abc_Ntk_t pNtk  ) 

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

Synopsis [Reads the arrival time of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 114 of file abcTiming.c.

00115 {
00116     assert( pNtk->pManTime );
00117     return &pNtk->pManTime->tReqDef;
00118 }

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 466 of file abcTiming.c.

00467 {
00468     Abc_Obj_t * pNodeOld, * pNodeNew;
00469     float tAndDelay;
00470     int i;
00471     if ( pNtkOld->pManTime == NULL )
00472         return;
00473     if ( Mio_LibraryReadNand2(Abc_FrameReadLibGen()) == NULL )
00474         return;
00475     tAndDelay = Mio_LibraryReadDelayNand2Max(Abc_FrameReadLibGen());
00476     Abc_NtkForEachPi( pNtkOld, pNodeOld, i )
00477     {
00478         pNodeNew = pNodeOld->pCopy;
00479         pNodeNew->Level = (int)(Abc_NodeArrival(pNodeOld)->Worst / tAndDelay);
00480     }
00481 }

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 746 of file abcTiming.c.

00747 {
00748     Vec_Ptr_t * vNodes;
00749     Abc_Obj_t * pObj;
00750     int i;
00751     // remember the maximum number of direct levels
00752     pNtk->LevelMax = Abc_NtkLevel(pNtk) + nMaxLevelIncrease;
00753     // start the reverse levels
00754     pNtk->vLevelsR = Vec_IntAlloc( 0 );
00755     Vec_IntFill( pNtk->vLevelsR, 1 + Abc_NtkObjNumMax(pNtk), 0 );
00756     // compute levels in reverse topological order
00757     vNodes = Abc_NtkDfsReverse( pNtk );
00758     Vec_PtrForEachEntry( vNodes, pObj, i )
00759         Abc_ObjSetReverseLevel( pObj, Abc_ObjReverseLevelNew(pObj) );
00760     Vec_PtrFree( vNodes );
00761 }

void Abc_NtkStopReverseLevels ( Abc_Ntk_t pNtk  ) 

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 774 of file abcTiming.c.

00775 {
00776     assert( pNtk->vLevelsR );
00777     Vec_IntFree( pNtk->vLevelsR );
00778     pNtk->vLevelsR = NULL;
00779     pNtk->LevelMax = 0;
00780 
00781 }

void Abc_NtkTimeInitialize ( Abc_Ntk_t pNtk  ) 

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 231 of file abcTiming.c.

00232 {
00233     Abc_Obj_t * pObj;
00234     Abc_Time_t ** ppTimes, * pTime;
00235     int i;
00236     if ( pNtk->pManTime == NULL )
00237         return;
00238     Abc_ManTimeExpand( pNtk->pManTime, Abc_NtkObjNumMax(pNtk), 0 );
00239     // set the default timing
00240     ppTimes = (Abc_Time_t **)pNtk->pManTime->vArrs->pArray;
00241     Abc_NtkForEachPi( pNtk, pObj, i )
00242     {
00243         pTime = ppTimes[pObj->Id];
00244         if ( pTime->Worst != -ABC_INFINITY )
00245             continue;
00246         *pTime = pNtk->pManTime->tArrDef;
00247     }
00248     // set the default timing
00249     ppTimes = (Abc_Time_t **)pNtk->pManTime->vReqs->pArray;
00250     Abc_NtkForEachPo( pNtk, pObj, i )
00251     {
00252         pTime = ppTimes[pObj->Id];
00253         if ( pTime->Worst != -ABC_INFINITY )
00254             continue;
00255         *pTime = pNtk->pManTime->tReqDef;
00256     }
00257     // set the 0 arrival times for latch outputs and constant nodes
00258     ppTimes = (Abc_Time_t **)pNtk->pManTime->vArrs->pArray;
00259     Abc_NtkForEachLatchOutput( pNtk, pObj, i )
00260     {
00261         pTime = ppTimes[pObj->Id];
00262         pTime->Fall = pTime->Rise = pTime->Worst = 0.0;
00263     }
00264 }

void Abc_NtkTimePrepare ( Abc_Ntk_t pNtk  ) 

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

Synopsis [Prepares the timing manager for delay trace.]

Description []

SideEffects []

SeeAlso []

Definition at line 277 of file abcTiming.c.

00278 {
00279     Abc_Obj_t * pObj;
00280     Abc_Time_t ** ppTimes, * pTime;
00281     int i;
00282     // if there is no timing manager, allocate and initialize
00283     if ( pNtk->pManTime == NULL )
00284     {
00285         pNtk->pManTime = Abc_ManTimeStart();
00286         Abc_NtkTimeInitialize( pNtk );
00287         return;
00288     }
00289     // if timing manager is given, expand it if necessary
00290     Abc_ManTimeExpand( pNtk->pManTime, Abc_NtkObjNumMax(pNtk), 0 );
00291     // clean arrivals except for PIs
00292     ppTimes = (Abc_Time_t **)pNtk->pManTime->vArrs->pArray;
00293     Abc_NtkForEachNode( pNtk, pObj, i )
00294     {
00295         pTime = ppTimes[pObj->Id];
00296         pTime->Fall = pTime->Rise = pTime->Worst = -ABC_INFINITY;
00297     }
00298     Abc_NtkForEachPo( pNtk, pObj, i )
00299     {
00300         pTime = ppTimes[pObj->Id];
00301         pTime->Fall = pTime->Rise = pTime->Worst = -ABC_INFINITY;
00302     }
00303     // clean required except for POs
00304 }

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 175 of file abcTiming.c.

00176 {
00177     Vec_Ptr_t * vTimes;
00178     Abc_Time_t * pTime;
00179     if ( pNtk->pManTime == NULL )
00180         pNtk->pManTime = Abc_ManTimeStart();
00181     if ( pNtk->pManTime->tArrDef.Rise == Rise && pNtk->pManTime->tArrDef.Fall == Fall )
00182         return;
00183     Abc_ManTimeExpand( pNtk->pManTime, ObjId + 1, 1 );
00184     // set the arrival time
00185     vTimes = pNtk->pManTime->vArrs;
00186     pTime = vTimes->pArray[ObjId];
00187     pTime->Rise  = Rise;
00188     pTime->Fall  = Rise;
00189     pTime->Worst = ABC_MAX( Rise, Fall );
00190 }

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 131 of file abcTiming.c.

00132 {
00133     if ( Rise == 0.0 && Fall == 0.0 )
00134         return;
00135     if ( pNtk->pManTime == NULL )
00136         pNtk->pManTime = Abc_ManTimeStart();
00137     pNtk->pManTime->tArrDef.Rise  = Rise;
00138     pNtk->pManTime->tArrDef.Fall  = Fall;
00139     pNtk->pManTime->tArrDef.Worst = ABC_MAX( Rise, Fall );
00140 }

void Abc_NtkTimeSetDefaultRequired ( Abc_Ntk_t pNtk,
float  Rise,
float  Fall 
)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 153 of file abcTiming.c.

00154 {
00155     if ( Rise == 0.0 && Fall == 0.0 )
00156         return;
00157     if ( pNtk->pManTime == NULL )
00158         pNtk->pManTime = Abc_ManTimeStart();
00159     pNtk->pManTime->tReqDef.Rise  = Rise;
00160     pNtk->pManTime->tReqDef.Rise  = Fall;
00161     pNtk->pManTime->tReqDef.Worst = ABC_MAX( Rise, Fall );
00162 }

void Abc_NtkTimeSetRequired ( 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 203 of file abcTiming.c.

00204 {
00205     Vec_Ptr_t * vTimes;
00206     Abc_Time_t * pTime;
00207     if ( pNtk->pManTime == NULL )
00208         pNtk->pManTime = Abc_ManTimeStart();
00209     if ( pNtk->pManTime->tReqDef.Rise == Rise && pNtk->pManTime->tReqDef.Fall == Fall )
00210         return;
00211     Abc_ManTimeExpand( pNtk->pManTime, ObjId + 1, 1 );
00212     // set the required time
00213     vTimes = pNtk->pManTime->vReqs;
00214     pTime = vTimes->pArray[ObjId];
00215     pTime->Rise  = Rise;
00216     pTime->Fall  = Rise;
00217     pTime->Worst = ABC_MAX( Rise, Fall );
00218 }

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 890 of file abcTiming.c.

00891 {
00892     // replace the old node by the new node
00893     pObjNew->Level = pObj->Level;
00894     Abc_ObjReplace( pObj, pObjNew );
00895     // update the level of the node
00896     Abc_NtkUpdateLevel( pObjNew, vLevels );
00897     Abc_ObjSetReverseLevel( pObjNew, 0 );
00898     Abc_NtkUpdateReverseLevel( pObjNew, vLevels );
00899 }

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 794 of file abcTiming.c.

00795 {
00796     Abc_Obj_t * pFanout, * pTemp;
00797     int LevelOld, Lev, k, m;
00798     // check if level has changed
00799     LevelOld = Abc_ObjLevel(pObjNew);
00800     if ( LevelOld == Abc_ObjLevelNew(pObjNew) )
00801         return;
00802     // start the data structure for level update
00803     // we cannot fail to visit a node when using this structure because the 
00804     // nodes are stored by their _old_ levels, which are assumed to be correct
00805     Vec_VecClear( vLevels );
00806     Vec_VecPush( vLevels, LevelOld, pObjNew );
00807     pObjNew->fMarkA = 1;
00808     // recursively update level
00809     Vec_VecForEachEntryStart( vLevels, pTemp, Lev, k, LevelOld )
00810     {
00811         pTemp->fMarkA = 0;
00812         assert( Abc_ObjLevel(pTemp) == Lev );
00813         Abc_ObjSetLevel( pTemp, Abc_ObjLevelNew(pTemp) );
00814         // if the level did not change, no need to check the fanout levels
00815         if ( Abc_ObjLevel(pTemp) == Lev )
00816             continue;
00817         // schedule fanout for level update
00818         Abc_ObjForEachFanout( pTemp, pFanout, m )
00819         {
00820             if ( !Abc_ObjIsCo(pFanout) && !pFanout->fMarkA )
00821             {
00822                 assert( Abc_ObjLevel(pFanout) >= Lev );
00823                 Vec_VecPush( vLevels, Abc_ObjLevel(pFanout), pFanout );
00824                 pFanout->fMarkA = 1;
00825             }
00826         }
00827     }
00828 }

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 841 of file abcTiming.c.

00842 {
00843     Abc_Obj_t * pFanin, * pTemp;
00844     int LevelOld, LevFanin, Lev, k, m;
00845     // check if level has changed
00846     LevelOld = Abc_ObjReverseLevel(pObjNew);
00847     if ( LevelOld == Abc_ObjReverseLevelNew(pObjNew) )
00848         return;
00849     // start the data structure for level update
00850     // we cannot fail to visit a node when using this structure because the 
00851     // nodes are stored by their _old_ levels, which are assumed to be correct
00852     Vec_VecClear( vLevels );
00853     Vec_VecPush( vLevels, LevelOld, pObjNew );
00854     pObjNew->fMarkA = 1;
00855     // recursively update level
00856     Vec_VecForEachEntryStart( vLevels, pTemp, Lev, k, LevelOld )
00857     {
00858         pTemp->fMarkA = 0;
00859         LevelOld = Abc_ObjReverseLevel(pTemp); 
00860         assert( LevelOld == Lev );
00861         Abc_ObjSetReverseLevel( pTemp, Abc_ObjReverseLevelNew(pTemp) );
00862         // if the level did not change, no need to check the fanout levels
00863         if ( Abc_ObjReverseLevel(pTemp) == Lev )
00864             continue;
00865         // schedule fanins for level update
00866         Abc_ObjForEachFanin( pTemp, pFanin, m )
00867         {
00868             if ( !Abc_ObjIsCi(pFanin) && !pFanin->fMarkA )
00869             {
00870                 LevFanin = Abc_ObjReverseLevel( pFanin );
00871                 assert( LevFanin >= Lev );
00872                 Vec_VecPush( vLevels, LevFanin, pFanin );
00873                 pFanin->fMarkA = 1;
00874             }
00875         }
00876     }
00877 }

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 642 of file abcTiming.c.

00643 {
00644     Abc_Obj_t * pFanin;
00645     int i, Level = 0;
00646     Abc_ObjForEachFanin( pObj, pFanin, i )
00647         Level = ABC_MAX( Level, Abc_ObjLevel(pFanin) );
00648     return Level + 1;
00649 }

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 686 of file abcTiming.c.

00687 {
00688     Abc_Ntk_t * pNtk = pObj->pNtk;
00689     assert( pNtk->vLevelsR );
00690     return pNtk->LevelMax + 1 - Abc_ObjReverseLevel(pObj);
00691 }

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 705 of file abcTiming.c.

00706 {
00707     Abc_Ntk_t * pNtk = pObj->pNtk;
00708     assert( pNtk->vLevelsR );
00709     Vec_IntFillExtra( pNtk->vLevelsR, pObj->Id + 1, 0 );
00710     return Vec_IntEntry(pNtk->vLevelsR, pObj->Id);
00711 }

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 662 of file abcTiming.c.

00663 {
00664     Abc_Obj_t * pFanout;
00665     int i, LevelCur, Level = 0;
00666     Abc_ObjForEachFanout( pObj, pFanout, i )
00667     {
00668         LevelCur = Abc_ObjReverseLevel( pFanout );
00669         Level = ABC_MAX( Level, LevelCur );
00670     }
00671     return Level + 1;
00672 }

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 725 of file abcTiming.c.

00726 {
00727     Abc_Ntk_t * pNtk = pObj->pNtk;
00728     assert( pNtk->vLevelsR );
00729     Vec_IntFillExtra( pNtk->vLevelsR, pObj->Id + 1, 0 );
00730     Vec_IntWriteEntry( pNtk->vLevelsR, pObj->Id, LevelR );
00731 }


Generated on Tue Jan 5 12:18:42 2010 for abc70930 by  doxygen 1.6.1