126 float fArrMax, fSlackFan;
153 if ( fSlackFan >= 0 )
162 float fSlackMax = fMaxArr * Window / 100.0;
170 if ( fSlackThis >= 0 )
277 SC_Cell * pCellOld, * pCellNew;
278 float dGain, dGainBest;
279 int k, gateBest, NoChange = 0;
287 dGainBest = -DelayGap;
290 if ( pCellNew == pCellOld )
304 if ( dGainBest < dGain )
307 gateBest = pCellNew->
Id;
321 *pGainBest = dGainBest;
338 SC_Cell * pCellOld, * pCellNew;
341 Abc_Obj_t * pBuf, * pFanin, * pFanout, * pExtra;
342 int i, j, iNode, gateBest, gateBest2, fanBest,
Counter = 0;
343 float dGainBest, dGainBest2;
359 if ( p->pNtk->vPhases == NULL )
400 gateBest =
Abc_SclFindBestCell( p, pFanin, vRecalcs, vEvals, Notches, DelayGap, &dGainBest );
404 if ( gateBest == -1 )
407 if ( dGainBest2 < dGainBest )
409 dGainBest2 = dGainBest;
410 gateBest2 = gateBest;
415 if ( gateBest2 >= 0 )
417 assert( dGainBest2 > 0.0 );
446 if ( p->pNtk->vPhases == NULL )
473 if ( dGainBest2 == -1 )
492 p->SumArea += pCellNew->
area - pCellOld->
area;
511 printf(
"Node %6d Redir fanout %6d to fanin %6d. Gain = %7.1f ps. ",
513 printf(
"Gate %12s (%2d/%2d) -> %12s (%2d/%2d) \n",
598 SC_Cell * pCellOld, * pCellNew;
602 float dGainBest, dGainBest2;
603 int i, gateBest, Limit,
Counter, iIterLast;
613 if ( iIterLast >= 0 && iIterLast + 5 > iIter )
619 gateBest =
Abc_SclFindBestCell( p, pObj, vRecalcs, vEvals, Notches, DelayGap, &dGainBest );
623 assert( dGainBest > 0.0 );
674 if ( dGainBest2 == -1 )
683 assert( pCellNew != NULL );
689 p->SumArea += pCellNew->
area - pCellOld->
area;
699 if ( Counter == Limit )
711 int i, ObjId, GateId, GateId2;
716 assert( GateId == GateId2 );
753 float fDiff = (float)0.001;
770 printf(
"%6d : load rise differs %12.6f %f %f\n", k, p->pLoads[k].rise-pLoads[k].
rise, p->pLoads[k].rise, pLoads[k].
rise );
772 printf(
"%6d : load fall differs %12.6f %f %f\n", k, p->pLoads[k].fall-pLoads[k].
fall, p->pLoads[k].fall, pLoads[k].
fall );
775 printf(
"%6d : slew rise differs %12.6f %f %f\n", k, p->pSlews[k].rise-pSlews[k].
rise, p->pSlews[k].rise, pSlews[k].
rise );
777 printf(
"%6d : slew fall differs %12.6f %f %f\n", k, p->pSlews[k].fall-pSlews[k].
fall, p->pSlews[k].fall, pSlews[k].
fall );
780 printf(
"%6d : time rise differs %12.6f %f %f\n", k, p->pTimes[k].rise-pTimes[k].
rise, p->pTimes[k].rise, pTimes[k].
rise );
782 printf(
"%6d : time fall differs %12.6f %f %f\n", k, p->pTimes[k].fall-pTimes[k].
fall, p->pTimes[k].fall, pTimes[k].
fall );
812 printf(
"%4d ", Iter );
813 printf(
"Win:%3d. ", win );
814 printf(
"PO:%6d. ", nPathPos );
815 printf(
"Path:%7d. ", nPathNodes );
816 printf(
"Gate:%5d. ", nUpsizes );
817 printf(
"TFO:%7d. ", nTFOs );
819 printf(
"%.2f ", p->SumArea );
820 printf(
"(%+5.1f %%) ", 100.0 * (p->SumArea - p->SumArea0)/ p->SumArea0 );
822 printf(
"%.2f ps ", p->MaxDelay );
823 printf(
"(%+5.1f %%) ", 100.0 * (p->MaxDelay - p->MaxDelay0)/ p->MaxDelay0 );
825 printf(
"%.2f ps ", p->BestDelay );
826 printf(
"(%+5.1f %%)", 100.0 * (p->BestDelay - p->MaxDelay0)/ p->MaxDelay0 );
827 printf(
"%8.2f sec ", 1.0*(
Abc_Clock() - p->timeTotal)/(CLOCKS_PER_SEC) );
828 printf(
"%c", fVerbose ?
'\n' :
'\r' );
851 p->SumArea -= pCell->
area;
874 int i = 0, win, nUpsizes = -1, nFramesNoChange = 0, nConeSize = 0;
875 int nAllPos, nAllNodes, nAllTfos, nAllUpsizes;
878 printf(
"Parameters: " );
879 printf(
"Iters =%5d. ", pPars->
nIters );
880 printf(
"Time win =%3d %%. ", pPars->
Window );
881 printf(
"Update ratio =%3d %%. ", pPars->
Ratio );
882 printf(
"UseDept =%2d. ", pPars->
fUseDept );
884 printf(
"Target =%5d ps. ", pPars->
DelayUser );
885 printf(
"DelayGap =%3d ps. ", pPars->
DelayGap );
886 printf(
"Timeout =%4d sec", pPars->
TimeOut );
895 assert( p->vGatesBest == NULL );
896 p->vGatesBest =
Vec_IntDup( p->pNtk->vGates );
897 p->BestDelay = p->MaxDelay0;
899 nAllPos = nAllNodes = nAllTfos = nAllUpsizes = 0;
901 printf(
"Current delay (%.2f ps) does not exceed the target delay (%.2f ps). Upsizing is not performed.\n", p->BestDelay, (
float)pPars->
DelayUser );
903 for ( i = 0; i < pPars->
nIters; i++ )
905 for ( win = pPars->
Window + ((i % 7) == 6); win <= 100; win *= 2 )
955 if ( p->BestDelay > p->MaxDelay )
957 p->BestDelay = p->MaxDelay;
969 nAllTfos += nConeSize;
970 nAllUpsizes += nUpsizes;
974 if ( nRuntimeLimit &&
Abc_Clock() > nRuntimeLimit )
991 Abc_SclUpsizePrint( p, i, pPars->
Window, nAllPos/(i?i:1), nAllNodes/(i?i:1), nAllUpsizes/(i?i:1), nAllTfos/(i?i:1), 1 );
995 p->timeTotal =
Abc_Clock() - p->timeTotal;
998 p->timeOther = p->timeTotal - p->timeCone - p->timeSize - p->timeTime;
999 ABC_PRTP(
"Runtime: Critical path", p->timeCone, p->timeTotal );
1000 ABC_PRTP(
"Runtime: Sizing eval ", p->timeSize, p->timeTotal );
1001 ABC_PRTP(
"Runtime: Timing update", p->timeTime, p->timeTotal );
1002 ABC_PRTP(
"Runtime: Other ", p->timeOther, p->timeTotal );
1003 ABC_PRTP(
"Runtime: TOTAL ", p->timeTotal, p->timeTotal );
1007 if ( nRuntimeLimit &&
Abc_Clock() > nRuntimeLimit )
1008 printf(
"Gate sizing timed out at %d seconds.\n", pPars->
TimeOut );
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
static float Abc_SclReadMaxDelay(SC_Man *p)
void Abc_SclUpsizePrint(SC_Man *p, int Iter, int win, int nPathPos, int nPathNodes, int nUpsizes, int nTFOs, int fVerbose)
void Abc_SclTimeNtkRecompute(SC_Man *p, float *pArea, float *pDelay, int fReverse, float DUser)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static float Abc_SclObjGetSlack(SC_Man *p, Abc_Obj_t *pObj, float D)
static void Abc_SclLoadStore3(SC_Man *p, Abc_Obj_t *pObj)
int Abc_SclIsInv(Abc_Obj_t *pObj)
#define Abc_NtkForEachNodeNotBarBuf(pNtk, pNode, i)
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
static void Abc_SclConeStore(SC_Man *p, Vec_Int_t *vCone)
Vec_Int_t * Abc_SclFindCriticalNodeWindow(SC_Man *p, Vec_Int_t *vPathCos, int Window, int fDept)
void Abc_SclTimeIncInsert(SC_Man *p, Abc_Obj_t *pObj)
static void Vec_FltWriteEntry(Vec_Flt_t *p, int i, float Entry)
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
static float Abc_AbsFloat(float a)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void Abc_SclFindCriticalNodeWindow_rec(SC_Man *p, Abc_Obj_t *pObj, Vec_Int_t *vPath, float fSlack, int fDept)
void Abc_NodeInvUpdateObjFanoutPolarity(Abc_Obj_t *pObj, Abc_Obj_t *pFanout)
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
static void Abc_SclConeRestore(SC_Man *p, Vec_Int_t *vCone)
ABC_DLL int Abc_NodeFindFanin(Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
static void Abc_SclObjSetCell(Abc_Obj_t *p, SC_Cell *pCell)
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
void Abc_SclApplyUpdateToBest(Vec_Int_t *vGatesBest, Vec_Int_t *vGates, Vec_Int_t *vUpdate)
ABC_DLL void Abc_NtkDeleteObj_rec(Abc_Obj_t *pObj, int fOnlyNodes)
void Abc_SclFindNodesToUpdate(Abc_Obj_t *pPivot, Vec_Int_t **pvNodes, Vec_Int_t **pvEvals, Abc_Obj_t *pExtra)
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
int Abc_SclObjCheckMarkedFanFans(Abc_Obj_t *pObj)
#define ABC_ALLOC(type, num)
#define Abc_NtkForEachCo(pNtk, pCo, i)
void Abc_SclUpsizePrintDiffs(SC_Man *p, SC_Lib *pLib, Abc_Ntk_t *pNtk)
static int Vec_QuePop(Vec_Que_t *p)
#define SC_RingForEachCell(pRing, pCell, i)
typedefABC_NAMESPACE_HEADER_START struct SC_Man_ SC_Man
INCLUDES ///.
static abctime Abc_Clock()
static int Abc_MaxInt(int a, int b)
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
void Abc_SclTimeIncUpdateLevel(Abc_Obj_t *pObj)
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
static float Abc_MaxFloat(float a, float b)
static void Vec_IntReverseOrder(Vec_Int_t *p)
Vec_Int_t * Abc_SclFindCriticalCoWindow(SC_Man *p, int Window)
#define ABC_SWAP(Type, a, b)
void Abc_SclUpsizeRemoveDangling(SC_Man *p, Abc_Ntk_t *pNtk)
int Abc_SclTimeIncUpdate(SC_Man *p)
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
static void Abc_SclLoadStore(SC_Man *p, Abc_Obj_t *pObj)
#define ABC_PRTP(a, t, T)
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
static void Vec_QueClear(Vec_Que_t *p)
static int Vec_QueSize(Vec_Que_t *p)
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
static void Abc_SclLoadRestore(SC_Man *p, Abc_Obj_t *pObj)
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
static void Abc_SclManFree(SC_Man *p)
static int Abc_MinInt(int a, int b)
static void Abc_SclDumpStats(SC_Man *p, char *pFileName, abctime Time)
void Abc_SclUnmarkCriticalNodeWindow(SC_Man *p, Vec_Int_t *vPath)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
ABC_NAMESPACE_IMPL_START void Abc_SclFindTFO_rec(Abc_Obj_t *pObj, Vec_Int_t *vNodes, Vec_Int_t *vCos)
DECLARATIONS ///.
#define Abc_NtkForEachObjVec(vIds, pNtk, pObj, i)
void Abc_SclUpsizePerform(SC_Lib *pLib, Abc_Ntk_t *pNtk, SC_SizePars *pPars)
static int Vec_IntEntry(Vec_Int_t *p, int i)
void Abc_SclUpdateLoadSplit(SC_Man *p, Abc_Obj_t *pBuffer, Abc_Obj_t *pFanout)
#define ABC_NAMESPACE_IMPL_END
void Abc_SclUndoRecentChanges(Abc_Ntk_t *pNtk, Vec_Int_t *vTrans)
#define Vec_IntForEachEntryTwo(vVec1, vVec2, Entry1, Entry2, i)
int Abc_SclFindUpsizes(SC_Man *p, Vec_Int_t *vPathNodes, int Ratio, int Notches, int iIter, int DelayGap, int fMoreConserf)
static int Vec_IntUniqify(Vec_Int_t *p)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
void Abc_SclObjMarkFanFans(Abc_Obj_t *pObj, Vec_Ptr_t *vNodes)
static SC_Cell * SC_LibCell(SC_Lib *p, int i)
void Abc_SclSclGates2MioGates(SC_Lib *pLib, Abc_Ntk_t *p)
static void Abc_SclEvalStore(SC_Man *p, Vec_Int_t *vCone)
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
#define Abc_NtkForEachNode(pNtk, pNode, i)
#define ABC_NAMESPACE_IMPL_START
int Abc_SclFindBestCell(SC_Man *p, Abc_Obj_t *pObj, Vec_Int_t *vRecalcs, Vec_Int_t *vEvals, int Notches, int DelayGap, float *pGainBest)
void Abc_SclTimeCone(SC_Man *p, Vec_Int_t *vCone)
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
static int Vec_IntSize(Vec_Int_t *p)
#define Abc_ObjForEachFanout(pObj, pFanout, i)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static void Abc_SclLoadRestore3(SC_Man *p, Abc_Obj_t *pObj)
static float Abc_SclEvalPerform(SC_Man *p, Vec_Int_t *vCone)
#define Abc_ObjForEachFanin(pObj, pFanin, i)
int Abc_SclCountNearCriticalNodes(SC_Man *p)
void Abc_SclAddWireLoad(SC_Man *p, Abc_Obj_t *pObj, int fSubtr)
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Vec_Int_t * Abc_SclFindTFO(Abc_Ntk_t *p, Vec_Int_t *vPath)
static float Abc_SclGetMaxDelayNodeFanins(SC_Man *p, Abc_Obj_t *pNode)
static float Vec_FltEntry(Vec_Flt_t *p, int i)
static float Abc_SclObjTimeMax(SC_Man *p, Abc_Obj_t *pObj)
static Abc_Ntk_t * Abc_ObjNtk(Abc_Obj_t *pObj)
ABC_DLL void Abc_NodeCollectFanouts(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
static void Vec_IntFree(Vec_Int_t *p)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
static void Vec_IntClear(Vec_Int_t *p)
static void Vec_QuePush(Vec_Que_t *p, int v)
int Abc_SclFindBypasses(SC_Man *p, Vec_Int_t *vPathNodes, int Ratio, int Notches, int iIter, int DelayGap, int fVeryVerbose)
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
void Abc_SclUpdateLoad(SC_Man *p, Abc_Obj_t *pObj, SC_Cell *pOld, SC_Cell *pNew)
static void Vec_PtrFree(Vec_Ptr_t *p)
static SC_Cell * Abc_SclObjCell(Abc_Obj_t *p)
SC_Man * Abc_SclManStart(SC_Lib *pLib, Abc_Ntk_t *pNtk, int fUseWireLoads, int fDept, float DUser, int nTreeCRatio)