diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2012-10-08 21:20:13 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2012-10-08 21:20:13 -0700 |
commit | 9206e6ff80e56c810814a9b9f61e45be8c4c4987 (patch) | |
tree | 53f370b362f29e064722cddfac15c15195df901b /src/map/scl/sclMan.h | |
parent | 2cb69e45111e9633dce486eac17e76e0d09e6098 (diff) | |
download | abc-9206e6ff80e56c810814a9b9f61e45be8c4c4987.tar.gz abc-9206e6ff80e56c810814a9b9f61e45be8c4c4987.tar.bz2 abc-9206e6ff80e56c810814a9b9f61e45be8c4c4987.zip |
Improvements to gate sizing.
Diffstat (limited to 'src/map/scl/sclMan.h')
-rw-r--r-- | src/map/scl/sclMan.h | 99 |
1 files changed, 82 insertions, 17 deletions
diff --git a/src/map/scl/sclMan.h b/src/map/scl/sclMan.h index 700dc2bc..f1566ad0 100644 --- a/src/map/scl/sclMan.h +++ b/src/map/scl/sclMan.h @@ -26,6 +26,8 @@ /// INCLUDES /// //////////////////////////////////////////////////////////////////////// +#include "misc/vec/vecQue.h" + ABC_NAMESPACE_HEADER_START //////////////////////////////////////////////////////////////////////// @@ -49,21 +51,33 @@ struct SC_Man_ { SC_Lib * pLib; // library Abc_Ntk_t * pNtk; // network - int fUseWireLoads; // set to 1 if wireloads are used int nObjs; // allocated size + // get assignment Vec_Int_t * vGates; // mapping of objId into gateId + Vec_Int_t * vGatesBest; // best gate sizes found so far + Vec_Int_t * vUpdates; // sizing updates in this round + // timing information SC_Pair * pLoads; // loads for each gate + SC_Pair * pLoads2; // loads for each gate SC_Pair * pDepts; // departures for each gate SC_Pair * pTimes; // arrivals for each gate SC_Pair * pSlews; // slews for each gate SC_Pair * pTimes2; // arrivals for each gate SC_Pair * pSlews2; // slews for each gate - char * pWLoadUsed; // name of the used WireLoad model - clock_t clkStart; // starting time + Vec_Flt_t * vTimesOut; // output arrival times + Vec_Que_t * vQue; // outputs by their time + SC_WireLoad * pWLoadUsed; // name of the used WireLoad model float SumArea; // total area float MaxDelay; // max delay float SumArea0; // total area at the begining float MaxDelay0; // max delay at the begining + float BestDelay; // best delay in the middle + // runtime statistics + clock_t timeTotal; // starting/total time + clock_t timeCone; // critical path selection + clock_t timeSize; // incremental sizing + clock_t timeTime; // timing update + clock_t timeOther; // everything else }; //////////////////////////////////////////////////////////////////////// @@ -78,6 +92,7 @@ static inline SC_Cell * Abc_SclObjCell( SC_Man * p, Abc_Obj_t * pObj ) static inline void Abc_SclObjSetCell( SC_Man * p, Abc_Obj_t * pObj, SC_Cell * pCell ) { Vec_IntWriteEntry( p->vGates, Abc_ObjId(pObj), pCell->Id ); } static inline SC_Pair * Abc_SclObjLoad( SC_Man * p, Abc_Obj_t * pObj ) { return p->pLoads + Abc_ObjId(pObj); } +static inline SC_Pair * Abc_SclObjLoad2( SC_Man * p, Abc_Obj_t * pObj ) { return p->pLoads2 + Abc_ObjId(pObj); } static inline SC_Pair * Abc_SclObjDept( SC_Man * p, Abc_Obj_t * pObj ) { return p->pDepts + 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); } @@ -113,24 +128,38 @@ static inline double Abc_SclObjSlewPs( SC_Man * p, Abc_Obj_t * pObj, int fRis static inline SC_Man * Abc_SclManAlloc( SC_Lib * pLib, Abc_Ntk_t * pNtk ) { SC_Man * p; + int i; 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->pDepts = 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(); + p->pLib = pLib; + p->pNtk = pNtk; + p->nObjs = Abc_NtkObjNumMax(pNtk); + p->pLoads = ABC_CALLOC( SC_Pair, p->nObjs ); + p->pLoads2 = ABC_CALLOC( SC_Pair, p->nObjs ); + p->pDepts = 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->vTimesOut = Vec_FltStart( Abc_NtkCoNum(pNtk) ); + p->vQue = Vec_QueAlloc( Abc_NtkCoNum(pNtk) ); + Vec_QueSetCosts( p->vQue, Vec_FltArray(p->vTimesOut) ); + for ( i = 0; i < Abc_NtkCoNum(pNtk); i++ ) + Vec_QuePush( p->vQue, i ); + p->vUpdates = Vec_IntAlloc( 1000 ); return p; } static inline void Abc_SclManFree( SC_Man * p ) { + Vec_IntFreeP( &p->vUpdates ); + Vec_IntFreeP( &p->vGatesBest ); +// Vec_QuePrint( p->vQue ); + Vec_QueCheck( p->vQue ); + Vec_QueFreeP( &p->vQue ); + Vec_FltFreeP( &p->vTimesOut ); Vec_IntFreeP( &p->vGates ); ABC_FREE( p->pLoads ); + ABC_FREE( p->pLoads2 ); ABC_FREE( p->pDepts ); ABC_FREE( p->pTimes ); ABC_FREE( p->pSlews ); @@ -159,13 +188,12 @@ static inline void Abc_SclManCleanTime( SC_Man * p ) ***********************************************************************/ 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_SclObjTime(p, pObj) = Zero; - *Abc_SclObjSlew2(p, pObj) = *Abc_SclObjSlew(p, pObj); *Abc_SclObjSlew(p, pObj) = Zero; + *Abc_SclObjTime2(p, pObj) = *Abc_SclObjTime(p, pObj); + *Abc_SclObjSlew2(p, pObj) = *Abc_SclObjSlew(p, pObj); } } static inline void Abc_SclConeRestore( SC_Man * p, Vec_Int_t * vCone ) @@ -178,6 +206,43 @@ static inline void Abc_SclConeRestore( SC_Man * p, Vec_Int_t * vCone ) *Abc_SclObjSlew(p, pObj) = *Abc_SclObjSlew2(p, pObj); } } +static inline void Abc_SclConeClear( 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_SclObjTime(p, pObj) = Zero; + *Abc_SclObjSlew(p, pObj) = Zero; + } +} + +/**Function************************************************************* + + Synopsis [Stores/retrivies load information.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline void Abc_SclLoadStore( SC_Man * p, Abc_Obj_t * pObj ) +{ + Abc_Obj_t * pFanin; + int i; + Abc_ObjForEachFanin( pObj, pFanin, i ) + *Abc_SclObjLoad2(p, pFanin) = *Abc_SclObjLoad(p, pFanin); +} +static inline void Abc_SclLoadRestore( SC_Man * p, Abc_Obj_t * pObj ) +{ + Abc_Obj_t * pFanin; + int i; + Abc_ObjForEachFanin( pObj, pFanin, i ) + *Abc_SclObjLoad(p, pFanin) = *Abc_SclObjLoad2(p, pFanin); +} /**Function************************************************************* @@ -246,7 +311,7 @@ extern Abc_Obj_t * Abc_SclFindMostCriticalFanin( SC_Man * p, int * pfRise, Abc_O extern void Abc_SclTimeNtkPrint( SC_Man * p, int fShowAll, int fShort ); extern SC_Man * Abc_SclManStart( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fUseWireLoads ); extern void Abc_SclTimeCone( SC_Man * p, Vec_Int_t * vCone ); -extern void Abc_SclTimeNtkRecompute( SC_Man * p, float * pArea, float * pDelay ); +extern void Abc_SclTimeNtkRecompute( SC_Man * p, float * pArea, float * pDelay, int fReverse ); /*=== 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 ); |