diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2012-08-29 16:20:39 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2012-08-29 16:20:39 -0700 |
commit | 83bfe0b1fec515d9350ebd63f07f0ed742bb4745 (patch) | |
tree | 8fcfd00de92c20fc7e07011c70c8d6ffa8d9d537 /src/map/scl/sclMan.h | |
parent | 6814c48bb4e748add7e4ebd37f0d4d00312e0c5a (diff) | |
download | abc-83bfe0b1fec515d9350ebd63f07f0ed742bb4745.tar.gz abc-83bfe0b1fec515d9350ebd63f07f0ed742bb4745.tar.bz2 abc-83bfe0b1fec515d9350ebd63f07f0ed742bb4745.zip |
New package to read/write a subset of Liberty for STA.
Diffstat (limited to 'src/map/scl/sclMan.h')
-rw-r--r-- | src/map/scl/sclMan.h | 130 |
1 files changed, 84 insertions, 46 deletions
diff --git a/src/map/scl/sclMan.h b/src/map/scl/sclMan.h index 6dd24ac1..7d49c773 100644 --- a/src/map/scl/sclMan.h +++ b/src/map/scl/sclMan.h @@ -4,7 +4,9 @@ SystemName [ABC: Logic synthesis and verification system.] - Synopsis [Standard-cell library representation.] + PackageName [Standard-cell library representation.] + + Synopsis [Timing/gate-sizing manager.] Author [Alan Mishchenko, Niklas Een] @@ -47,9 +49,8 @@ struct SC_Man_ { SC_Lib * pLib; // library Abc_Ntk_t * pNtk; // network - float SumArea; // total area - int nObjs; // allocated size Vec_Int_t * vGates; // mapping of objId into gateId + int nObjs; // allocated size SC_Pair * pLoads; // loads for each gate SC_Pair * pTimes; // arrivals for each gate SC_Pair * pSlews; // slews for each gate @@ -57,6 +58,10 @@ struct SC_Man_ SC_Pair * pSlews2; // slews for each gate char * pWLoadUsed; // name of the used WireLoad model clock_t clkStart; // starting time + float SumArea; // total area + float MaxDelay; // max delay + float SumArea0; // total area at the begining + float MaxDelay0; // max delay at the begining }; //////////////////////////////////////////////////////////////////////// @@ -67,35 +72,67 @@ struct SC_Man_ /// MACRO DEFINITIONS /// //////////////////////////////////////////////////////////////////////// -static inline SC_Pair * Abc_SclObjLoad( SC_Man * p, Abc_Obj_t * pObj ) { return p->pLoads + Abc_ObjId(pObj); } -static inline SC_Pair * Abc_SclObjTime( SC_Man * p, Abc_Obj_t * pObj ) { return p->pTimes + Abc_ObjId(pObj); } -static inline SC_Pair * Abc_SclObjSlew( SC_Man * p, Abc_Obj_t * pObj ) { return p->pSlews + Abc_ObjId(pObj); } +static inline SC_Cell * Abc_SclObjCell( SC_Man * p, Abc_Obj_t * pObj ) { return SC_LibCell( p->pLib, Vec_IntEntry(p->vGates, Abc_ObjId(pObj)) ); } -static inline SC_Pair * Abc_SclObjTime2( SC_Man * p, Abc_Obj_t * pObj ) { return p->pTimes2 + Abc_ObjId(pObj); } -static inline SC_Pair * Abc_SclObjSlew2( SC_Man * p, Abc_Obj_t * pObj ) { return p->pSlews2 + Abc_ObjId(pObj); } +static inline SC_Pair * Abc_SclObjLoad( SC_Man * p, Abc_Obj_t * pObj ) { return p->pLoads + Abc_ObjId(pObj); } +static inline SC_Pair * Abc_SclObjTime( SC_Man * p, Abc_Obj_t * pObj ) { return p->pTimes + Abc_ObjId(pObj); } +static inline SC_Pair * Abc_SclObjSlew( SC_Man * p, Abc_Obj_t * pObj ) { return p->pSlews + Abc_ObjId(pObj); } +static inline SC_Pair * Abc_SclObjTime2( SC_Man * p, Abc_Obj_t * pObj ) { return p->pTimes2 + Abc_ObjId(pObj); } +static inline SC_Pair * Abc_SclObjSlew2( SC_Man * p, Abc_Obj_t * pObj ) { return p->pSlews2 + Abc_ObjId(pObj); } -static inline float Abc_SclObjGain( SC_Man * p, Abc_Obj_t * pObj ) { return (Abc_SclObjTime2(p, pObj)->rise - Abc_SclObjTime(p, pObj)->rise) + (Abc_SclObjTime2(p, pObj)->fall - Abc_SclObjTime(p, pObj)->fall); } - -static inline void Abc_SclObjDupFanin( SC_Man * p, Abc_Obj_t * pObj ) -{ - assert( Abc_ObjIsCo(pObj) ); - *Abc_SclObjTime(p, pObj) = *Abc_SclObjTime(p, Abc_ObjFanin0(pObj)); -} +static inline void Abc_SclObjDupFanin( SC_Man * p, Abc_Obj_t * pObj ) { assert( Abc_ObjIsCo(pObj) ); *Abc_SclObjTime(p, pObj) = *Abc_SclObjTime(p, Abc_ObjFanin0(pObj)); } +static inline float Abc_SclObjGain( SC_Man * p, Abc_Obj_t * pObj ) { return (Abc_SclObjTime2(p, pObj)->rise - Abc_SclObjTime(p, pObj)->rise) + (Abc_SclObjTime2(p, pObj)->fall - Abc_SclObjTime(p, pObj)->fall); } static inline double Abc_SclObjLoadFf( SC_Man * p, Abc_Obj_t * pObj, int fRise ) { return SC_LibCapFf( p->pLib, fRise ? Abc_SclObjLoad(p, pObj)->rise : Abc_SclObjLoad(p, pObj)->fall); } static inline double Abc_SclObjTimePs( SC_Man * p, Abc_Obj_t * pObj, int fRise ) { return SC_LibTimePs(p->pLib, fRise ? Abc_SclObjTime(p, pObj)->rise : Abc_SclObjTime(p, pObj)->fall); } static inline double Abc_SclObjSlewPs( SC_Man * p, Abc_Obj_t * pObj, int fRise ) { return SC_LibTimePs(p->pLib, fRise ? Abc_SclObjSlew(p, pObj)->rise : Abc_SclObjSlew(p, pObj)->fall); } -static inline SC_Cell * Abc_SclObjCell( SC_Man * p, Abc_Obj_t * pObj ) { return SC_LibCell( p->pLib, Vec_IntEntry(p->vGates, Abc_ObjId(pObj)) ); } - //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// +/**Function************************************************************* + + Synopsis [Constructor/destructor of STA manager.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline SC_Man * Abc_SclManAlloc( SC_Lib * pLib, Abc_Ntk_t * pNtk ) +{ + SC_Man * p; + assert( Abc_NtkHasMapping(pNtk) ); + p = ABC_CALLOC( SC_Man, 1 ); + p->pLib = pLib; + p->pNtk = pNtk; + p->nObjs = Abc_NtkObjNumMax(pNtk); + p->pLoads = ABC_CALLOC( SC_Pair, p->nObjs ); + p->pTimes = ABC_CALLOC( SC_Pair, p->nObjs ); + p->pSlews = ABC_CALLOC( SC_Pair, p->nObjs ); + p->pTimes2 = ABC_CALLOC( SC_Pair, p->nObjs ); + p->pSlews2 = ABC_CALLOC( SC_Pair, p->nObjs ); + p->clkStart = clock(); + return p; +} +static inline void Abc_SclManFree( SC_Man * p ) +{ + Vec_IntFreeP( &p->vGates ); + ABC_FREE( p->pLoads ); + ABC_FREE( p->pTimes ); + ABC_FREE( p->pSlews ); + ABC_FREE( p->pTimes2 ); + ABC_FREE( p->pSlews2 ); + ABC_FREE( p ); +} + /**Function************************************************************* - Synopsis [] + Synopsis [Stores/retrivies timing information for the logic cone.] Description [] @@ -106,12 +143,13 @@ static inline SC_Cell * Abc_SclObjCell( SC_Man * p, Abc_Obj_t * pObj ) { return ***********************************************************************/ static inline void Abc_SclConeStore( SC_Man * p, Vec_Int_t * vCone ) { + SC_Pair Zero = { 0.0, 0.0 }; Abc_Obj_t * pObj; int i; Abc_NtkForEachObjVec( vCone, p->pNtk, pObj, i ) { - *Abc_SclObjTime2(p, pObj) = *Abc_SclObjTime(p, pObj); - *Abc_SclObjSlew2(p, pObj) = *Abc_SclObjSlew(p, pObj); + *Abc_SclObjTime2(p, pObj) = *Abc_SclObjTime(p, pObj); *Abc_SclObjTime(p, pObj) = Zero; + *Abc_SclObjSlew2(p, pObj) = *Abc_SclObjSlew(p, pObj); *Abc_SclObjSlew(p, pObj) = Zero; } } static inline void Abc_SclConeRestore( SC_Man * p, Vec_Int_t * vCone ) @@ -127,7 +165,7 @@ static inline void Abc_SclConeRestore( SC_Man * p, Vec_Int_t * vCone ) /**Function************************************************************* - Synopsis [Prepares STA manager.] + Synopsis [] Description [] @@ -136,41 +174,41 @@ static inline void Abc_SclConeRestore( SC_Man * p, Vec_Int_t * vCone ) SeeAlso [] ***********************************************************************/ -static inline SC_Man * Abc_SclManAlloc( SC_Lib * pLib, Abc_Ntk_t * pNtk ) +static inline float Abc_SclGetTotalArea( SC_Man * p ) { - SC_Man * p; - assert( Abc_NtkHasMapping(pNtk) ); - p = ABC_CALLOC( SC_Man, 1 ); - p->pLib = pLib; - p->pNtk = pNtk; - p->nObjs = Abc_NtkObjNumMax(pNtk); - p->pLoads = ABC_CALLOC( SC_Pair, p->nObjs ); - p->pTimes = ABC_CALLOC( SC_Pair, p->nObjs ); - p->pSlews = ABC_CALLOC( SC_Pair, p->nObjs ); - p->pTimes2 = ABC_CALLOC( SC_Pair, p->nObjs ); - p->pSlews2 = ABC_CALLOC( SC_Pair, p->nObjs ); - p->clkStart = clock(); - return p; + double Area = 0; + Abc_Obj_t * pObj; + int i; + Abc_NtkForEachNode( p->pNtk, pObj, i ) + Area += Abc_SclObjCell( p, pObj )->area; + return Area; } -static inline void Abc_SclManFree( SC_Man * p ) +static inline float Abc_SclGetMaxDelay( SC_Man * p ) { - Vec_IntFreeP( &p->vGates ); - ABC_FREE( p->pLoads ); - ABC_FREE( p->pTimes ); - ABC_FREE( p->pSlews ); - ABC_FREE( p->pTimes2 ); - ABC_FREE( p->pSlews2 ); - ABC_FREE( p ); + float fMaxArr = 0; + Abc_Obj_t * pObj; + SC_Pair * pArr; + int i; + Abc_NtkForEachCo( p->pNtk, pObj, i ) + { + pArr = Abc_SclObjTime( p, pObj ); + if ( fMaxArr < pArr->rise ) fMaxArr = pArr->rise; + if ( fMaxArr < pArr->fall ) fMaxArr = pArr->fall; + } + return fMaxArr; } /*=== sclTime.c =============================================================*/ +extern Vec_Int_t * Abc_SclFindCriticalPath( SC_Man * p ); +extern Abc_Obj_t * Abc_SclFindCriticalCo( SC_Man * p, int * pfRise ); +extern void Abc_SclTimeNtkPrint( SC_Man * p, int fShowAll ); extern SC_Man * Abc_SclManStart( SC_Lib * pLib, Abc_Ntk_t * pNtk ); -extern Abc_Obj_t * Abc_SclFindMostCritical( SC_Man * p, int * pfRise ); -extern Vec_Int_t * Abc_SclCriticalPathFind( SC_Man * p ); extern void Abc_SclTimeCone( SC_Man * p, Vec_Int_t * vCone ); +/*=== sclTime.c =============================================================*/ +extern void Abc_SclComputeLoad( SC_Man * p ); extern void Abc_SclUpdateLoad( SC_Man * p, Abc_Obj_t * pObj, SC_Cell * pOld, SC_Cell * pNew ); -extern void Abc_SclCriticalPathPrint( SC_Man * p ); + ABC_NAMESPACE_HEADER_END |