summaryrefslogtreecommitdiffstats
path: root/src/opt
diff options
context:
space:
mode:
Diffstat (limited to 'src/opt')
-rw-r--r--src/opt/sfm/sfmDec.c37
-rw-r--r--src/opt/sfm/sfmInt.h1
-rw-r--r--src/opt/sfm/sfmLib.c4
-rw-r--r--src/opt/sfm/sfmMit.c1
-rw-r--r--src/opt/sfm/sfmTim.c12
5 files changed, 29 insertions, 26 deletions
diff --git a/src/opt/sfm/sfmDec.c b/src/opt/sfm/sfmDec.c
index f228222e..ff0dc574 100644
--- a/src/opt/sfm/sfmDec.c
+++ b/src/opt/sfm/sfmDec.c
@@ -149,6 +149,7 @@ static inline word * Sfm_DecDivPats( Sfm_Dec_t * p, int d, int c ) { r
static inline int Sfm_ManReadObjDelay( Sfm_Dec_t * p, int Id ) { return p->pMit ? Sfm_MitReadObjDelay(p->pMit, Id) : Sfm_TimReadObjDelay(p->pTim, Id); }
static inline int Sfm_ManReadNtkDelay( Sfm_Dec_t * p ) { return p->pMit ? Sfm_MitReadNtkDelay(p->pMit) : Sfm_TimReadNtkDelay(p->pTim); }
+static inline int Sfm_ManReadNtkMinSlack( Sfm_Dec_t * p ) { return p->pMit ? Sfm_MitReadNtkMinSlack(p->pMit) : 0; }
@@ -211,9 +212,9 @@ Sfm_Dec_t * Sfm_DecStart( Sfm_Par_t * pPars, Mio_Library_t * pLib, Abc_Ntk_t * p
p->pNtk = pNtk;
p->pSat = sat_solver_new();
p->pGateInv = Mio_LibraryReadInv( pLib );
- p->AreaInv = MIO_NUM*Mio_GateReadArea( p->pGateInv );
- p->DelayInv = MIO_NUM*Mio_GateReadDelayMax( p->pGateInv );
- p->DeltaCrit = pPars->DeltaCrit ? MIO_NUM*pPars->DeltaCrit : 5 * (int)(MIO_NUM*Mio_LibraryReadDelayInvMax(pLib)) / 2;
+ p->AreaInv = Scl_Flt2Int(Mio_GateReadArea(p->pGateInv));
+ p->DelayInv = Scl_Flt2Int(Mio_GateReadDelayMax(p->pGateInv));
+ p->DeltaCrit = pPars->DeltaCrit ? Scl_Flt2Int((float)pPars->DeltaCrit) : 5 * Scl_Flt2Int(Mio_LibraryReadDelayInvMax(pLib)) / 2;
p->timeLib = Abc_Clock();
p->pLib = Sfm_LibPrepare( pPars->nVarMax, 1, !pPars->fArea, pPars->fVerbose, pPars->fLibVerbose );
p->timeLib = Abc_Clock() - p->timeLib;
@@ -676,13 +677,13 @@ int Sfm_DecMffcArea( Abc_Ntk_t * pNtk, Vec_Int_t * vMffc )
Abc_Obj_t * pObj;
int i, nAreaMffc = 0;
Abc_NtkForEachObjVec( vMffc, pNtk, pObj, i )
- nAreaMffc += (int)(MIO_NUM * Mio_GateReadArea((Mio_Gate_t *)pObj->pData));
+ nAreaMffc += Scl_Flt2Int(Mio_GateReadArea((Mio_Gate_t *)pObj->pData));
return nAreaMffc;
}
int Sfm_MffcDeref_rec( Abc_Obj_t * pObj )
{
Abc_Obj_t * pFanin;
- int i, Area = (int)(MIO_NUM*Mio_GateReadArea((Mio_Gate_t *)pObj->pData));
+ int i, Area = Scl_Flt2Int(Mio_GateReadArea((Mio_Gate_t *)pObj->pData));
Abc_ObjForEachFanin( pObj, pFanin, i )
{
assert( pFanin->vFanouts.nSize > 0 );
@@ -694,7 +695,7 @@ int Sfm_MffcDeref_rec( Abc_Obj_t * pObj )
int Sfm_MffcRef_rec( Abc_Obj_t * pObj, Vec_Int_t * vMffc )
{
Abc_Obj_t * pFanin;
- int i, Area = (int)(MIO_NUM*Mio_GateReadArea((Mio_Gate_t *)pObj->pData));
+ int i, Area = Scl_Flt2Int(Mio_GateReadArea((Mio_Gate_t *)pObj->pData));
Abc_ObjForEachFanin( pObj, pFanin, i )
{
if ( pFanin->vFanouts.nSize++ == 0 && !Abc_ObjIsCi(pFanin) )
@@ -753,7 +754,7 @@ int Sfm_DecComputeFlipInvGain( Sfm_Dec_t * p, Abc_Obj_t * pPivot, int * pfNeedIn
continue;
}
pGateNew = (Mio_Gate_t *)Vec_PtrEntry( &p->vGateHands, Handle );
- Gain += MIO_NUM*Mio_GateReadArea(pGate) - MIO_NUM*Mio_GateReadArea(pGateNew);
+ Gain += Scl_Flt2Int(Mio_GateReadArea(pGate)) - Scl_Flt2Int(Mio_GateReadArea(pGateNew));
}
if ( fNeedInv )
Gain -= p->AreaInv;
@@ -816,7 +817,7 @@ int Sfm_DecPeformDec_rec( Sfm_Dec_t * p, word * pTruth, int * pSupp, int * pAssu
if ( p->pPars->fVeryVerbose )
{
printf( "\nObject %d\n", p->iTarget );
- printf( "Divs = %d. Nodes = %d. Mffc = %d. Mffc area = %.2f. ", p->nDivs, Vec_IntSize(&p->vObjGates), p->nMffc, MIO_NUMINV*p->AreaMffc );
+ printf( "Divs = %d. Nodes = %d. Mffc = %d. Mffc area = %.2f. ", p->nDivs, Vec_IntSize(&p->vObjGates), p->nMffc, Scl_Int2Flt(p->AreaMffc) );
printf( "Pat0 = %d. Pat1 = %d. ", p->nPats[0], p->nPats[1] );
printf( "\n" );
if ( nAssump )
@@ -1099,7 +1100,7 @@ int Sfm_DecPeformDec2( Sfm_Dec_t * p, Abc_Obj_t * pObj )
int i, RetValue, Prev = 0, iBest = -1, AreaThis, AreaNew;//, AreaNewInv;
int GainThis, GainBest = -1, iLibObj, iLibObjBest = -1;
assert( p->pPars->fArea == 1 );
-//printf( "AreaGainInv = %8.2f ", MIO_NUMINV*AreaGainInv );
+//printf( "AreaGainInv = %8.2f ", Scl_Int2Flt(AreaGainInv) );
//Sfm_DecPrint( p, NULL );
if ( fVeryVerbose )
printf( "\nNode %4d : MFFC %2d\n", p->iTarget, p->nMffc );
@@ -1149,7 +1150,7 @@ int Sfm_DecPeformDec2( Sfm_Dec_t * p, Abc_Obj_t * pObj )
if ( AreaNew > 0 && AreaNewInv > 0 && AreaNew - AreaNewInv + AreaGainInv > 0 )
printf( "AreaNew = %8.2f AreaNewInv = %8.2f Gain = %8.2f Total = %8.2f\n",
- MIO_NUMINV*AreaNew, MIO_NUMINV*AreaNewInv, MIO_NUMINV*(AreaNew - AreaNewInv), MIO_NUMINV*(AreaNew - AreaNewInv + AreaGainInv) );
+ Scl_Int2Flt(AreaNew), Scl_Int2Flt(AreaNewInv), Scl_Int2Flt(AreaNew - AreaNewInv), Scl_Int2Flt(AreaNew - AreaNewInv + AreaGainInv) );
else
printf( "\n" );
*/
@@ -1488,14 +1489,14 @@ void Sfm_DecMarkMffc( Abc_Obj_t * pPivot, int nLevelMin, int nMffcMax, int fVery
Vec_IntPushUnique( vInMffc, Abc_ObjId(pFanin3) );
/*
- printf( "Node %d: (%.2f) ", pPivot->Id, MIO_NUMINV*Sfm_ManReadObjDelay(p, Abc_ObjId(pPivot)) );
+ printf( "Node %d: (%.2f) ", pPivot->Id, Scl_Int2Flt(Sfm_ManReadObjDelay(p, Abc_ObjId(pPivot))) );
Abc_ObjForEachFanin( pPivot, pFanin, i )
- printf( "%d: %.2f ", Abc_ObjLevel(pFanin), MIO_NUMINV*Sfm_ManReadObjDelay(p, Abc_ObjId(pFanin)) );
+ printf( "%d: %.2f ", Abc_ObjLevel(pFanin), Scl_Int2Flt(Sfm_ManReadObjDelay(p, Abc_ObjId(pFanin))) );
printf( "\n" );
printf( "Node %d: ", pPivot->Id );
Abc_NtkForEachObjVec( vInMffc, pPivot->pNtk, pObj, i )
- printf( "%d: %.2f ", Abc_ObjLevel(pObj), MIO_NUMINV*Sfm_ManReadObjDelay(p, Abc_ObjId(pObj)) );
+ printf( "%d: %.2f ", Abc_ObjLevel(pObj), Scl_Int2Flt(Sfm_ManReadObjDelay(p, Abc_ObjId(pObj))) );
printf( "\n" );
*/
}
@@ -1588,7 +1589,7 @@ printf( "\n\nTarget %d\n", Abc_ObjId(pPivot) );
Sfm_DecMarkMffc( pPivot, nLevelMin, pPars->nMffcMax, fVeryVerbose, vMffc, vInMffc, pTim, pMit );
assert( Vec_IntSize(vMffc) <= pPars->nMffcMax );
if ( fVeryVerbose )
-printf( "Mffc size = %d. Mffc area = %.2f. InMffc size = %d.\n", Vec_IntSize(vMffc), Sfm_DecMffcArea(pNtk, vMffc)*MIO_NUMINV, Vec_IntSize(vInMffc) );
+printf( "Mffc size = %d. Mffc area = %.2f. InMffc size = %d.\n", Vec_IntSize(vMffc), Scl_Int2Flt(Sfm_DecMffcArea(pNtk, vMffc)), Vec_IntSize(vInMffc) );
// collect TFI(TFO)
Abc_NtkForEachObjVec( vRoots, pNtk, pObj, i )
Abc_NtkDfsOne_rec( pObj, vTfi, nLevelMin, SFM_MASK_INPUT );
@@ -2072,10 +2073,10 @@ p->timeTime += Abc_Clock() - clk;
assert( p->pMit || p->DelayMin == 0 || p->DelayMin == Sfm_ManReadObjDelay(p, Abc_ObjId(pObjNew)) );
// report
if ( pPars->fDelayVerbose )
- printf( "Node %5d %5d : I =%3d. Cand = %5d (%6.2f %%) Old =%8.2f. New =%8.2f. Final =%8.2f\n",
+ printf( "Node %5d %5d : I =%3d. Cand = %5d (%6.2f %%) Old =%8.2f. New =%8.2f. Final =%8.2f. WNS =%8.2f.\n",
OldId, Abc_NtkObjNumMax(p->pNtk), i, Vec_IntSize(&p->vCands), 100.0 * Vec_IntSize(&p->vCands) / Abc_NtkNodeNum(p->pNtk),
- MIO_NUMINV*DelayOld, MIO_NUMINV*Sfm_ManReadObjDelay(p, Abc_ObjId(pObjNew)),
- MIO_NUMINV*Sfm_ManReadNtkDelay(p) );
+ Scl_Int2Flt(DelayOld), Scl_Int2Flt(Sfm_ManReadObjDelay(p, Abc_ObjId(pObjNew))),
+ Scl_Int2Flt(Sfm_ManReadNtkDelay(p)), Scl_Int2Flt(Sfm_ManReadNtkMinSlack(p)) );
break;
}
if ( pPars->iNodeOne )
@@ -2110,7 +2111,7 @@ void Abc_NtkPerformMfs3( Abc_Ntk_t * pNtk, Sfm_Par_t * pPars )
if ( !pPars->fArea )
printf( "Win = %d. ", pPars->nTimeWin );
if ( !pPars->fArea )
- printf( "Delta = %.2f ps. ", MIO_NUMINV*p->DeltaCrit );
+ printf( "Delta = %.2f ps. ", Scl_Int2Flt(p->DeltaCrit) );
if ( pPars->fArea )
printf( "0-cost = %s. ", pPars->fZeroCost ? "yes" : "no" );
printf( "Effort = %s. ", pPars->fMoreEffort ? "yes" : "no" );
diff --git a/src/opt/sfm/sfmInt.h b/src/opt/sfm/sfmInt.h
index a08979ab..2b96d4bd 100644
--- a/src/opt/sfm/sfmInt.h
+++ b/src/opt/sfm/sfmInt.h
@@ -230,6 +230,7 @@ extern int Sfm_TimEvalRemapping( Sfm_Tim_t * p, Vec_Int_t * vFanins, Ve
extern Sfm_Mit_t * Sfm_MitStart( Mio_Library_t * pLib, SC_Lib * pScl, Scl_Con_t * pExt, Abc_Ntk_t * pNtk, int DeltaCrit );
extern void Sfm_MitStop( Sfm_Mit_t * p );
extern int Sfm_MitReadNtkDelay( Sfm_Mit_t * p );
+extern int Sfm_MitReadNtkMinSlack( Sfm_Mit_t * p );
extern int Sfm_MitReadObjDelay( Sfm_Mit_t * p, int iObj );
extern void Sfm_MitTransferLoad( Sfm_Mit_t * p, Abc_Obj_t * pNew, Abc_Obj_t * pOld );
extern void Sfm_MitTimingGrow( Sfm_Mit_t * p );
diff --git a/src/opt/sfm/sfmLib.c b/src/opt/sfm/sfmLib.c
index 0bf7c4a0..34906b56 100644
--- a/src/opt/sfm/sfmLib.c
+++ b/src/opt/sfm/sfmLib.c
@@ -537,7 +537,7 @@ void Sfm_LibPrintObj( Sfm_Lib_t * p, Sfm_Fun_t * pObj )
Mio_Cell2_t * pCellB = p->pCells + (int)pObj->pFansB[0];
Mio_Cell2_t * pCellT = p->pCells + (int)pObj->pFansT[0];
int i, nFanins = pCellB->nFanins + (pCellT == p->pCells ? 0 : pCellT->nFanins - 1);
- printf( "F = %d A =%6.2f ", nFanins, MIO_NUMINV*pObj->Area );
+ printf( "F = %d A =%6.2f ", nFanins, Scl_Int2Flt(pObj->Area) );
if ( pCellT == p->pCells )
Sfm_LibPrintGate( pCellB, pObj->pFansB + 1, NULL, NULL );
else
@@ -548,7 +548,7 @@ void Sfm_LibPrintObj( Sfm_Lib_t * p, Sfm_Fun_t * pObj )
int Offset = Vec_IntEntry( &p->vProfs, Sfm_LibFunId(p, pObj) );
int * pProf = Vec_IntEntryP( &p->vStore, Offset );
for ( i = 0; i < nFanins; i++ )
- printf( "%6.2f ", MIO_NUMINV*pProf[i] );
+ printf( "%6.2f ", Scl_Int2Flt(pProf[i]) );
}
}
void Sfm_LibPrint( Sfm_Lib_t * p )
diff --git a/src/opt/sfm/sfmMit.c b/src/opt/sfm/sfmMit.c
index 09fcf34c..bd9dfb52 100644
--- a/src/opt/sfm/sfmMit.c
+++ b/src/opt/sfm/sfmMit.c
@@ -52,6 +52,7 @@ struct Sfm_Mit_t_
Sfm_Mit_t * Sfm_MitStart( Mio_Library_t * pLib, SC_Lib * pScl, Scl_Con_t * pExt, Abc_Ntk_t * pNtk, int DeltaCrit ) { return NULL; }
void Sfm_MitStop( Sfm_Mit_t * p ) {}
int Sfm_MitReadNtkDelay( Sfm_Mit_t * p ) { return 0;}
+int Sfm_MitReadNtkMinSlack( Sfm_Mit_t * p ) { return 0;}
int Sfm_MitReadObjDelay( Sfm_Mit_t * p, int iObj ) { return 0;}
void Sfm_MitTransferLoad( Sfm_Mit_t * p, Abc_Obj_t * pNew, Abc_Obj_t * pOld ) {};
void Sfm_MitTimingGrow( Sfm_Mit_t * p ) {};
diff --git a/src/opt/sfm/sfmTim.c b/src/opt/sfm/sfmTim.c
index d5ccc3e2..d2880639 100644
--- a/src/opt/sfm/sfmTim.c
+++ b/src/opt/sfm/sfmTim.c
@@ -75,8 +75,8 @@ static inline int Sfm_TimSlack( Sfm_Tim_t * p, Abc_Obj_t * pNode ) { i
static inline void Sfm_TimEdgeArrival( Sfm_Tim_t * p, Mio_Pin_t * pPin, int * pTimeIn, int * pTimeOut )
{
Mio_PinPhase_t PinPhase = Mio_PinReadPhase(pPin);
- int tDelayBlockRise = (int)(MIO_NUM*Mio_PinReadDelayBlockRise(pPin));
- int tDelayBlockFall = (int)(MIO_NUM*Mio_PinReadDelayBlockFall(pPin));
+ int tDelayBlockRise = Scl_Flt2Int(Mio_PinReadDelayBlockRise(pPin));
+ int tDelayBlockFall = Scl_Flt2Int(Mio_PinReadDelayBlockFall(pPin));
if ( PinPhase != MIO_PHASE_INV ) // NONINV phase is present
{
pTimeOut[0] = Abc_MaxInt( pTimeOut[0], pTimeIn[0] + tDelayBlockRise );
@@ -109,8 +109,8 @@ static inline void Sfm_TimNodeArrival( Sfm_Tim_t * p, Abc_Obj_t * pNode )
static inline void Sfm_TimEdgeRequired( Sfm_Tim_t * p, Mio_Pin_t * pPin, int * pTimeIn, int * pTimeOut )
{
Mio_PinPhase_t PinPhase = Mio_PinReadPhase(pPin);
- int tDelayBlockRise = (int)(MIO_NUM*Mio_PinReadDelayBlockRise(pPin));
- int tDelayBlockFall = (int)(MIO_NUM*Mio_PinReadDelayBlockFall(pPin));
+ int tDelayBlockRise = Scl_Flt2Int(Mio_PinReadDelayBlockRise(pPin));
+ int tDelayBlockFall = Scl_Flt2Int(Mio_PinReadDelayBlockFall(pPin));
if ( PinPhase != MIO_PHASE_INV ) // NONINV phase is present
{
pTimeIn[0] = Abc_MinInt( pTimeIn[0], pTimeOut[0] - tDelayBlockRise );
@@ -235,7 +235,7 @@ Sfm_Tim_t * Sfm_TimStart( Mio_Library_t * pLib, Scl_Con_t * pExt, Abc_Ntk_t * pN
Vec_IntFill( &p->vTimArrs, 3*Abc_NtkObjNumMax(pNtk), 0 );
Vec_IntFill( &p->vTimReqs, 3*Abc_NtkObjNumMax(pNtk), 0 );
p->Delay = Sfm_TimTrace( p );
- assert( DeltaCrit > 0 && DeltaCrit < MIO_NUM*1000 );
+ assert( DeltaCrit > 0 && DeltaCrit < Scl_Flt2Int(1000.0) );
p->DeltaCrit = DeltaCrit;
return p;
}
@@ -272,7 +272,7 @@ void Sfm_TimTest( Abc_Ntk_t * pNtk )
{
Mio_Library_t * pLib = (Mio_Library_t *)pNtk->pManFunc;
Sfm_Tim_t * p = Sfm_TimStart( pLib, NULL, pNtk, 100 );
- printf( "Max delay = %.2f. Path = %d (%d).\n", MIO_NUMINV*p->Delay, Sfm_TimCriticalPath(p, 1), Abc_NtkNodeNum(p->pNtk) );
+ printf( "Max delay = %.2f. Path = %d (%d).\n", Scl_Int2Flt(p->Delay), Sfm_TimCriticalPath(p, 1), Abc_NtkNodeNum(p->pNtk) );
Sfm_TimStop( p );
}