Commit a4f97763 by Alan Mishchenko

Consolidating timing manager Scl_Con_t and propagating changes.

parent 15a891f9
...@@ -1253,8 +1253,6 @@ void Nf_ManCutMatch( Nf_Man_t * p, int iObj ) ...@@ -1253,8 +1253,6 @@ void Nf_ManCutMatch( Nf_Man_t * p, int iObj )
Nf_Mat_t * pDn = &pBest->M[1][0]; Nf_Mat_t * pDn = &pBest->M[1][0];
Nf_Mat_t * pAp = &pBest->M[0][1]; Nf_Mat_t * pAp = &pBest->M[0][1];
Nf_Mat_t * pAn = &pBest->M[1][1]; Nf_Mat_t * pAn = &pBest->M[1][1];
// word FlowRefP = (word)(MIO_NUM * Nf_ObjFlowRefs(p, iObj, 0));
// word FlowRefN = (word)(MIO_NUM * Nf_ObjFlowRefs(p, iObj, 1));
float FlowRefPf = Nf_ObjFlowRefs(p, iObj, 0); float FlowRefPf = Nf_ObjFlowRefs(p, iObj, 0);
float FlowRefNf = Nf_ObjFlowRefs(p, iObj, 1); float FlowRefNf = Nf_ObjFlowRefs(p, iObj, 1);
int i, * pCut, * pCutSet = Nf_ObjCutSet( p, iObj ); int i, * pCut, * pCutSet = Nf_ObjCutSet( p, iObj );
...@@ -1354,10 +1352,10 @@ void Nf_ManCutMatch( Nf_Man_t * p, int iObj ) ...@@ -1354,10 +1352,10 @@ void Nf_ManCutMatch( Nf_Man_t * p, int iObj )
if ( pAn->D == SCL_INFINITY ) if ( pAn->D == SCL_INFINITY )
printf( "Object %d has pAn unassigned.\n", iObj ); printf( "Object %d has pAn unassigned.\n", iObj );
/* /*
pDp->F = Abc_MinFloat( pDp->F, FLT_MAX/MIO_NUM ); pDp->F = Abc_MinFloat( pDp->F, FLT_MAX/SCL_NUM );
pDn->F = Abc_MinFloat( pDn->F, FLT_MAX/MIO_NUM ); pDn->F = Abc_MinFloat( pDn->F, FLT_MAX/SCL_NUM );
pAp->F = Abc_MinFloat( pAp->F, FLT_MAX/MIO_NUM ); pAp->F = Abc_MinFloat( pAp->F, FLT_MAX/SCL_NUM );
pAn->F = Abc_MinFloat( pAn->F, FLT_MAX/MIO_NUM ); pAn->F = Abc_MinFloat( pAn->F, FLT_MAX/SCL_NUM );
*/ */
assert( pDp->D < SCL_INFINITY ); assert( pDp->D < SCL_INFINITY );
assert( pDn->D < SCL_INFINITY ); assert( pDn->D < SCL_INFINITY );
...@@ -1823,7 +1821,7 @@ void Nf_ManElaBestMatchOne( Nf_Man_t * p, int iObj, int c, int * pCut, int * pCu ...@@ -1823,7 +1821,7 @@ void Nf_ManElaBestMatchOne( Nf_Man_t * p, int iObj, int c, int * pCut, int * pCu
pMb->Cfg = Cfg; pMb->Cfg = Cfg;
pMb->Cfg.fCompl = 0; pMb->Cfg.fCompl = 0;
// compute area // compute area
pMb->F = MIO_NUMINV * (ABC_INT64_T)Nf_MatchRefArea( p, iObj, c, pMb, Required ); pMb->F = Scl_Int2Flt((int)Nf_MatchRefArea(p, iObj, c, pMb, Required));
// compare // compare
if ( pRes->F > pMb->F || (pRes->F == pMb->F && pRes->D > pMb->D) ) if ( pRes->F > pMb->F || (pRes->F == pMb->F && pRes->D > pMb->D) )
*pRes = *pMb; *pRes = *pMb;
...@@ -1987,14 +1985,14 @@ void Nf_ManComputeMappingEla( Nf_Man_t * p ) ...@@ -1987,14 +1985,14 @@ void Nf_ManComputeMappingEla( Nf_Man_t * p )
printf( "%d -> %d ", Nf_ManCell(p, pM->Gate)->nFanins, Nf_ManCell(p, pMb->Gate)->nFanins ); printf( "%d -> %d ", Nf_ManCell(p, pM->Gate)->nFanins, Nf_ManCell(p, pMb->Gate)->nFanins );
printf( "D: %7.2f -> %7.2f ", Scl_Int2Flt(pM->D), Scl_Int2Flt(pMb->D) ); printf( "D: %7.2f -> %7.2f ", Scl_Int2Flt(pM->D), Scl_Int2Flt(pMb->D) );
printf( "R: %7.2f ", Required == SCL_INFINITY ? 9999.99 : Scl_Int2Flt(Required) ); printf( "R: %7.2f ", Required == SCL_INFINITY ? 9999.99 : Scl_Int2Flt(Required) );
printf( "A: %7.2f -> %7.2f ", MIO_NUMINV * (ABC_INT64_T)AreaBef, MIO_NUMINV * (ABC_INT64_T)AreaAft ); printf( "A: %7.2f -> %7.2f ", Scl_Int2Flt((int)AreaBef), Scl_Int2Flt((int)AreaAft) );
printf( "G: %7.2f (%7.2f) ", AreaBef >= AreaAft ? MIO_NUMINV * (ABC_INT64_T)(AreaBef - AreaAft) : -MIO_NUMINV * (ABC_INT64_T)(AreaAft - AreaBef), MIO_NUMINV * (ABC_INT64_T)(Gain) ); printf( "G: %7.2f (%7.2f) ", Scl_Int2Flt((int)AreaBef - (int)AreaAft), Scl_Int2Flt((int)Gain) );
printf( "\n" ); printf( "\n" );
} }
// set best match // set best match
assert( pMb->fBest ); assert( pMb->fBest );
assert( pMb->D <= Required ); assert( pMb->D <= Required );
//assert( pMb->F == MIO_NUMINV * (ABC_INT64_T)AreaAft ); //assert( Scl_Flt2Int(pMb->F) == (int)AreaAft );
assert( AreaBef >= AreaAft ); assert( AreaBef >= AreaAft );
*pM = *pMb; *pM = *pMb;
// update timing // update timing
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include "base/main/main.h" #include "base/main/main.h"
#include "map/mio/mio.h" #include "map/mio/mio.h"
#include "map/mapper/mapper.h" #include "map/mapper/mapper.h"
#include "misc/util/utilNam.h"
#include "map/scl/sclCon.h"
ABC_NAMESPACE_IMPL_START ABC_NAMESPACE_IMPL_START
...@@ -228,6 +230,34 @@ Map_Time_t * Abc_NtkMapCopyCoRequired( Abc_Ntk_t * pNtk, Abc_Time_t * ppTimes ) ...@@ -228,6 +230,34 @@ Map_Time_t * Abc_NtkMapCopyCoRequired( Abc_Ntk_t * pNtk, Abc_Time_t * ppTimes )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
Map_Time_t * Abc_NtkMapCopyCiArrivalCon( Abc_Ntk_t * pNtk )
{
Map_Time_t * p; int i;
p = ABC_CALLOC( Map_Time_t, Abc_NtkCiNum(pNtk) );
for ( i = 0; i < Abc_NtkCiNum(pNtk); i++ )
p[i].Fall = p[i].Rise = p[i].Worst = Scl_Int2Flt( Scl_ConGetInArr(i) );
return p;
}
Map_Time_t * Abc_NtkMapCopyCoRequiredCon( Abc_Ntk_t * pNtk )
{
Map_Time_t * p; int i;
p = ABC_CALLOC( Map_Time_t, Abc_NtkCoNum(pNtk) );
for ( i = 0; i < Abc_NtkCoNum(pNtk); i++ )
p[i].Fall = p[i].Rise = p[i].Worst = Scl_Int2Flt( Scl_ConGetOutReq(i) );
return p;
}
/**Function*************************************************************
Synopsis [Load the network into manager.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Map_Man_t * Abc_NtkToMap( Abc_Ntk_t * pNtk, double DelayTarget, int fRecovery, float * pSwitching, int fVerbose ) Map_Man_t * Abc_NtkToMap( Abc_Ntk_t * pNtk, double DelayTarget, int fRecovery, float * pSwitching, int fVerbose )
{ {
Map_Man_t * pMan; Map_Man_t * pMan;
...@@ -245,8 +275,16 @@ Map_Man_t * Abc_NtkToMap( Abc_Ntk_t * pNtk, double DelayTarget, int fRecovery, f ...@@ -245,8 +275,16 @@ Map_Man_t * Abc_NtkToMap( Abc_Ntk_t * pNtk, double DelayTarget, int fRecovery, f
Map_ManSetAreaRecovery( pMan, fRecovery ); Map_ManSetAreaRecovery( pMan, fRecovery );
Map_ManSetOutputNames( pMan, Abc_NtkCollectCioNames(pNtk, 1) ); Map_ManSetOutputNames( pMan, Abc_NtkCollectCioNames(pNtk, 1) );
Map_ManSetDelayTarget( pMan, (float)DelayTarget ); Map_ManSetDelayTarget( pMan, (float)DelayTarget );
Map_ManSetInputArrivals( pMan, Abc_NtkMapCopyCiArrival(pNtk, Abc_NtkGetCiArrivalTimes(pNtk)) );
Map_ManSetOutputRequireds( pMan, Abc_NtkMapCopyCoRequired(pNtk, Abc_NtkGetCoRequiredTimes(pNtk)) ); // set arrival and requireds
if ( Scl_ConIsRunning() && Scl_ConHasInArrs() )
Map_ManSetInputArrivals( pMan, Abc_NtkMapCopyCiArrivalCon(pNtk) );
else
Map_ManSetInputArrivals( pMan, Abc_NtkMapCopyCiArrival(pNtk, Abc_NtkGetCiArrivalTimes(pNtk)) );
if ( Scl_ConIsRunning() && Scl_ConHasOutReqs() )
Map_ManSetOutputRequireds( pMan, Abc_NtkMapCopyCoRequiredCon(pNtk) );
else
Map_ManSetOutputRequireds( pMan, Abc_NtkMapCopyCoRequired(pNtk, Abc_NtkGetCoRequiredTimes(pNtk)) );
// create PIs and remember them in the old nodes // create PIs and remember them in the old nodes
Abc_NtkCleanCopy( pNtk ); Abc_NtkCleanCopy( pNtk );
......
...@@ -70,9 +70,6 @@ struct Mio_Cell2_t_ ...@@ -70,9 +70,6 @@ struct Mio_Cell2_t_
void * pMioGate; // gate pointer void * pMioGate; // gate pointer
}; };
#define MIO_NUM 1000
#define MIO_NUMINV 0.001
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/// GLOBAL VARIABLES /// /// GLOBAL VARIABLES ///
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
......
...@@ -22,7 +22,9 @@ ...@@ -22,7 +22,9 @@
#include "exp.h" #include "exp.h"
#include "misc/util/utilTruth.h" #include "misc/util/utilTruth.h"
#include "opt/dau/dau.h" #include "opt/dau/dau.h"
#include "misc/util/utilNam.h"
#include "map/scl/sclLib.h" #include "map/scl/sclLib.h"
#include "map/scl/sclCon.h"
ABC_NAMESPACE_IMPL_START ABC_NAMESPACE_IMPL_START
...@@ -655,13 +657,13 @@ static inline void Mio_CollectCopy2( Mio_Cell2_t * pCell, Mio_Gate_t * pGate ) ...@@ -655,13 +657,13 @@ static inline void Mio_CollectCopy2( Mio_Cell2_t * pCell, Mio_Gate_t * pGate )
pCell->vExpr = pGate->vExpr; pCell->vExpr = pGate->vExpr;
pCell->uTruth = pGate->uTruth; pCell->uTruth = pGate->uTruth;
pCell->AreaF = pGate->dArea; pCell->AreaF = pGate->dArea;
pCell->AreaW = (word)(MIO_NUM * pGate->dArea); pCell->AreaW = (word)(SCL_NUM * pGate->dArea);
pCell->nFanins = pGate->nInputs; pCell->nFanins = pGate->nInputs;
pCell->pMioGate = pGate; pCell->pMioGate = pGate;
pCell->iDelayAve = 0; pCell->iDelayAve = 0;
for ( k = 0, pPin = pGate->pPins; pPin; pPin = pPin->pNext, k++ ) for ( k = 0, pPin = pGate->pPins; pPin; pPin = pPin->pNext, k++ )
{ {
pCell->iDelays[k] = (int)(MIO_NUM/2 * pPin->dDelayBlockRise + MIO_NUM/2 * pPin->dDelayBlockFall); pCell->iDelays[k] = (int)(SCL_NUM/2 * pPin->dDelayBlockRise + SCL_NUM/2 * pPin->dDelayBlockFall);
pCell->iDelayAve += pCell->iDelays[k]; pCell->iDelayAve += pCell->iDelays[k];
} }
if ( pCell->nFanins ) if ( pCell->nFanins )
...@@ -758,7 +760,7 @@ Mio_Cell2_t * Mio_CollectRootsNew2( Mio_Library_t * pLib, int nInputs, int * pnG ...@@ -758,7 +760,7 @@ Mio_Cell2_t * Mio_CollectRootsNew2( Mio_Library_t * pLib, int nInputs, int * pnG
printf( "None\n" ); printf( "None\n" );
else else
printf( "%-20s In = %d N = %3d A = %12.6f D = %12.6f\n", printf( "%-20s In = %d N = %3d A = %12.6f D = %12.6f\n",
pCell->pName, pCell->nFanins, pCounts[i], pCell->AreaF, MIO_NUMINV*pCell->iDelayAve ); pCell->pName, pCell->nFanins, pCounts[i], pCell->AreaF, Scl_Int2Flt(pCell->iDelayAve) );
} }
ABC_FREE( pCounts ); ABC_FREE( pCounts );
} }
......
...@@ -60,11 +60,10 @@ struct Scl_Con_t_ ...@@ -60,11 +60,10 @@ struct Scl_Con_t_
#define SCL_DEF_DIRECTIVE(ITEM) ".default_"ITEM #define SCL_DEF_DIRECTIVE(ITEM) ".default_"ITEM
#define SCL_NUM 1000 #define SCL_NUM 1000
#define SCL_NUMINV 0.001
#define SCL_INFINITY (0x3FFFFFFF) #define SCL_INFINITY (0x3FFFFFFF)
static inline int Scl_Flt2Int( float w ) { return SCL_NUM*w; } static inline int Scl_Flt2Int( float w ) { return SCL_NUM*w; }
static inline float Scl_Int2Flt( int i ) { return SCL_NUMINV*i; } static inline float Scl_Int2Flt( int i ) { return (float)i/SCL_NUM; }
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS /// /// FUNCTION DEFINITIONS ///
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
#include "map/mio/mio.h" #include "map/mio/mio.h"
#include "bool/kit/kit.h" #include "bool/kit/kit.h"
#include "misc/extra/extra.h" #include "misc/extra/extra.h"
#include "misc/util/utilNam.h"
#include "map/scl/sclCon.h"
ABC_NAMESPACE_IMPL_START ABC_NAMESPACE_IMPL_START
...@@ -56,14 +58,14 @@ static void Abc_SclReadSurface( Vec_Str_t * vOut, int * pPos, SC_Surface * p ) ...@@ -56,14 +58,14 @@ static void Abc_SclReadSurface( Vec_Str_t * vOut, int * pPos, SC_Surface * p )
{ {
float Num = Vec_StrGetF(vOut, pPos); float Num = Vec_StrGetF(vOut, pPos);
Vec_FltPush( &p->vIndex0, Num ); Vec_FltPush( &p->vIndex0, Num );
Vec_IntPush( &p->vIndex0I, (int)(MIO_NUM*Num) ); Vec_IntPush( &p->vIndex0I, Scl_Flt2Int(Num) );
} }
for ( i = Vec_StrGetI(vOut, pPos); i != 0; i-- ) for ( i = Vec_StrGetI(vOut, pPos); i != 0; i-- )
{ {
float Num = Vec_StrGetF(vOut, pPos); float Num = Vec_StrGetF(vOut, pPos);
Vec_FltPush( &p->vIndex1, Num ); Vec_FltPush( &p->vIndex1, Num );
Vec_IntPush( &p->vIndex1I, (int)(MIO_NUM*Num) ); Vec_IntPush( &p->vIndex1I, Scl_Flt2Int(Num) );
} }
for ( i = 0; i < Vec_FltSize(&p->vIndex0); i++ ) for ( i = 0; i < Vec_FltSize(&p->vIndex0); i++ )
...@@ -76,7 +78,7 @@ static void Abc_SclReadSurface( Vec_Str_t * vOut, int * pPos, SC_Surface * p ) ...@@ -76,7 +78,7 @@ static void Abc_SclReadSurface( Vec_Str_t * vOut, int * pPos, SC_Surface * p )
{ {
float Num = Vec_StrGetF(vOut, pPos); float Num = Vec_StrGetF(vOut, pPos);
Vec_FltPush( vVec, Num ); Vec_FltPush( vVec, Num );
Vec_IntPush( vVecI, (int)(MIO_NUM*Num) ); Vec_IntPush( vVecI, Scl_Flt2Int(Num) );
} }
} }
...@@ -154,8 +156,8 @@ static int Abc_SclReadLibrary( Vec_Str_t * vOut, int * pPos, SC_Lib * p ) ...@@ -154,8 +156,8 @@ static int Abc_SclReadLibrary( Vec_Str_t * vOut, int * pPos, SC_Lib * p )
pCell->n_inputs = Vec_StrGetI(vOut, pPos); pCell->n_inputs = Vec_StrGetI(vOut, pPos);
pCell->n_outputs = Vec_StrGetI(vOut, pPos); pCell->n_outputs = Vec_StrGetI(vOut, pPos);
pCell->areaI = (int)(MIO_NUM*pCell->area); pCell->areaI = Scl_Flt2Int(pCell->area);
pCell->leakageI = (int)(MIO_NUM*pCell->leakage); pCell->leakageI = Scl_Flt2Int(pCell->leakage);
/* /*
printf( "%s\n", pCell->pName ); printf( "%s\n", pCell->pName );
if ( !strcmp( "XOR3_X4M_A9TL", pCell->pName ) ) if ( !strcmp( "XOR3_X4M_A9TL", pCell->pName ) )
...@@ -173,8 +175,8 @@ static int Abc_SclReadLibrary( Vec_Str_t * vOut, int * pPos, SC_Lib * p ) ...@@ -173,8 +175,8 @@ static int Abc_SclReadLibrary( Vec_Str_t * vOut, int * pPos, SC_Lib * p )
pPin->rise_cap = Vec_StrGetF(vOut, pPos); pPin->rise_cap = Vec_StrGetF(vOut, pPos);
pPin->fall_cap = Vec_StrGetF(vOut, pPos); pPin->fall_cap = Vec_StrGetF(vOut, pPos);
pPin->rise_capI = (int)(MIO_NUM*pPin->rise_cap); pPin->rise_capI = Scl_Flt2Int(pPin->rise_cap);
pPin->fall_capI = (int)(MIO_NUM*pPin->fall_cap); pPin->fall_capI = Scl_Flt2Int(pPin->fall_cap);
} }
for ( j = 0; j < pCell->n_outputs; j++ ) for ( j = 0; j < pCell->n_outputs; j++ )
......
...@@ -149,6 +149,7 @@ static inline word * Sfm_DecDivPats( Sfm_Dec_t * p, int d, int c ) { r ...@@ -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_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_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 ...@@ -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->pNtk = pNtk;
p->pSat = sat_solver_new(); p->pSat = sat_solver_new();
p->pGateInv = Mio_LibraryReadInv( pLib ); p->pGateInv = Mio_LibraryReadInv( pLib );
p->AreaInv = MIO_NUM*Mio_GateReadArea( p->pGateInv ); p->AreaInv = Scl_Flt2Int(Mio_GateReadArea(p->pGateInv));
p->DelayInv = MIO_NUM*Mio_GateReadDelayMax( p->pGateInv ); p->DelayInv = Scl_Flt2Int(Mio_GateReadDelayMax(p->pGateInv));
p->DeltaCrit = pPars->DeltaCrit ? MIO_NUM*pPars->DeltaCrit : 5 * (int)(MIO_NUM*Mio_LibraryReadDelayInvMax(pLib)) / 2; p->DeltaCrit = pPars->DeltaCrit ? Scl_Flt2Int((float)pPars->DeltaCrit) : 5 * Scl_Flt2Int(Mio_LibraryReadDelayInvMax(pLib)) / 2;
p->timeLib = Abc_Clock(); p->timeLib = Abc_Clock();
p->pLib = Sfm_LibPrepare( pPars->nVarMax, 1, !pPars->fArea, pPars->fVerbose, pPars->fLibVerbose ); p->pLib = Sfm_LibPrepare( pPars->nVarMax, 1, !pPars->fArea, pPars->fVerbose, pPars->fLibVerbose );
p->timeLib = Abc_Clock() - p->timeLib; p->timeLib = Abc_Clock() - p->timeLib;
...@@ -676,13 +677,13 @@ int Sfm_DecMffcArea( Abc_Ntk_t * pNtk, Vec_Int_t * vMffc ) ...@@ -676,13 +677,13 @@ int Sfm_DecMffcArea( Abc_Ntk_t * pNtk, Vec_Int_t * vMffc )
Abc_Obj_t * pObj; Abc_Obj_t * pObj;
int i, nAreaMffc = 0; int i, nAreaMffc = 0;
Abc_NtkForEachObjVec( vMffc, pNtk, pObj, i ) 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; return nAreaMffc;
} }
int Sfm_MffcDeref_rec( Abc_Obj_t * pObj ) int Sfm_MffcDeref_rec( Abc_Obj_t * pObj )
{ {
Abc_Obj_t * pFanin; 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 ) Abc_ObjForEachFanin( pObj, pFanin, i )
{ {
assert( pFanin->vFanouts.nSize > 0 ); assert( pFanin->vFanouts.nSize > 0 );
...@@ -694,7 +695,7 @@ int Sfm_MffcDeref_rec( Abc_Obj_t * pObj ) ...@@ -694,7 +695,7 @@ int Sfm_MffcDeref_rec( Abc_Obj_t * pObj )
int Sfm_MffcRef_rec( Abc_Obj_t * pObj, Vec_Int_t * vMffc ) int Sfm_MffcRef_rec( Abc_Obj_t * pObj, Vec_Int_t * vMffc )
{ {
Abc_Obj_t * pFanin; 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 ) Abc_ObjForEachFanin( pObj, pFanin, i )
{ {
if ( pFanin->vFanouts.nSize++ == 0 && !Abc_ObjIsCi(pFanin) ) 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 ...@@ -753,7 +754,7 @@ int Sfm_DecComputeFlipInvGain( Sfm_Dec_t * p, Abc_Obj_t * pPivot, int * pfNeedIn
continue; continue;
} }
pGateNew = (Mio_Gate_t *)Vec_PtrEntry( &p->vGateHands, Handle ); 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 ) if ( fNeedInv )
Gain -= p->AreaInv; Gain -= p->AreaInv;
...@@ -816,7 +817,7 @@ int Sfm_DecPeformDec_rec( Sfm_Dec_t * p, word * pTruth, int * pSupp, int * pAssu ...@@ -816,7 +817,7 @@ int Sfm_DecPeformDec_rec( Sfm_Dec_t * p, word * pTruth, int * pSupp, int * pAssu
if ( p->pPars->fVeryVerbose ) if ( p->pPars->fVeryVerbose )
{ {
printf( "\nObject %d\n", p->iTarget ); 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( "Pat0 = %d. Pat1 = %d. ", p->nPats[0], p->nPats[1] );
printf( "\n" ); printf( "\n" );
if ( nAssump ) if ( nAssump )
...@@ -1099,7 +1100,7 @@ int Sfm_DecPeformDec2( Sfm_Dec_t * p, Abc_Obj_t * pObj ) ...@@ -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 i, RetValue, Prev = 0, iBest = -1, AreaThis, AreaNew;//, AreaNewInv;
int GainThis, GainBest = -1, iLibObj, iLibObjBest = -1; int GainThis, GainBest = -1, iLibObj, iLibObjBest = -1;
assert( p->pPars->fArea == 1 ); assert( p->pPars->fArea == 1 );
//printf( "AreaGainInv = %8.2f ", MIO_NUMINV*AreaGainInv ); //printf( "AreaGainInv = %8.2f ", Scl_Int2Flt(AreaGainInv) );
//Sfm_DecPrint( p, NULL ); //Sfm_DecPrint( p, NULL );
if ( fVeryVerbose ) if ( fVeryVerbose )
printf( "\nNode %4d : MFFC %2d\n", p->iTarget, p->nMffc ); 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 ) ...@@ -1149,7 +1150,7 @@ int Sfm_DecPeformDec2( Sfm_Dec_t * p, Abc_Obj_t * pObj )
if ( AreaNew > 0 && AreaNewInv > 0 && AreaNew - AreaNewInv + AreaGainInv > 0 ) if ( AreaNew > 0 && AreaNewInv > 0 && AreaNew - AreaNewInv + AreaGainInv > 0 )
printf( "AreaNew = %8.2f AreaNewInv = %8.2f Gain = %8.2f Total = %8.2f\n", 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 else
printf( "\n" ); printf( "\n" );
*/ */
...@@ -1488,14 +1489,14 @@ void Sfm_DecMarkMffc( Abc_Obj_t * pPivot, int nLevelMin, int nMffcMax, int fVery ...@@ -1488,14 +1489,14 @@ void Sfm_DecMarkMffc( Abc_Obj_t * pPivot, int nLevelMin, int nMffcMax, int fVery
Vec_IntPushUnique( vInMffc, Abc_ObjId(pFanin3) ); 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 ) 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( "\n" );
printf( "Node %d: ", pPivot->Id ); printf( "Node %d: ", pPivot->Id );
Abc_NtkForEachObjVec( vInMffc, pPivot->pNtk, pObj, i ) 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" ); printf( "\n" );
*/ */
} }
...@@ -1588,7 +1589,7 @@ printf( "\n\nTarget %d\n", Abc_ObjId(pPivot) ); ...@@ -1588,7 +1589,7 @@ printf( "\n\nTarget %d\n", Abc_ObjId(pPivot) );
Sfm_DecMarkMffc( pPivot, nLevelMin, pPars->nMffcMax, fVeryVerbose, vMffc, vInMffc, pTim, pMit ); Sfm_DecMarkMffc( pPivot, nLevelMin, pPars->nMffcMax, fVeryVerbose, vMffc, vInMffc, pTim, pMit );
assert( Vec_IntSize(vMffc) <= pPars->nMffcMax ); assert( Vec_IntSize(vMffc) <= pPars->nMffcMax );
if ( fVeryVerbose ) 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) // collect TFI(TFO)
Abc_NtkForEachObjVec( vRoots, pNtk, pObj, i ) Abc_NtkForEachObjVec( vRoots, pNtk, pObj, i )
Abc_NtkDfsOne_rec( pObj, vTfi, nLevelMin, SFM_MASK_INPUT ); Abc_NtkDfsOne_rec( pObj, vTfi, nLevelMin, SFM_MASK_INPUT );
...@@ -2072,10 +2073,10 @@ p->timeTime += Abc_Clock() - clk; ...@@ -2072,10 +2073,10 @@ p->timeTime += Abc_Clock() - clk;
assert( p->pMit || p->DelayMin == 0 || p->DelayMin == Sfm_ManReadObjDelay(p, Abc_ObjId(pObjNew)) ); assert( p->pMit || p->DelayMin == 0 || p->DelayMin == Sfm_ManReadObjDelay(p, Abc_ObjId(pObjNew)) );
// report // report
if ( pPars->fDelayVerbose ) 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), 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)), Scl_Int2Flt(DelayOld), Scl_Int2Flt(Sfm_ManReadObjDelay(p, Abc_ObjId(pObjNew))),
MIO_NUMINV*Sfm_ManReadNtkDelay(p) ); Scl_Int2Flt(Sfm_ManReadNtkDelay(p)), Scl_Int2Flt(Sfm_ManReadNtkMinSlack(p)) );
break; break;
} }
if ( pPars->iNodeOne ) if ( pPars->iNodeOne )
...@@ -2110,7 +2111,7 @@ void Abc_NtkPerformMfs3( Abc_Ntk_t * pNtk, Sfm_Par_t * pPars ) ...@@ -2110,7 +2111,7 @@ void Abc_NtkPerformMfs3( Abc_Ntk_t * pNtk, Sfm_Par_t * pPars )
if ( !pPars->fArea ) if ( !pPars->fArea )
printf( "Win = %d. ", pPars->nTimeWin ); printf( "Win = %d. ", pPars->nTimeWin );
if ( !pPars->fArea ) if ( !pPars->fArea )
printf( "Delta = %.2f ps. ", MIO_NUMINV*p->DeltaCrit ); printf( "Delta = %.2f ps. ", Scl_Int2Flt(p->DeltaCrit) );
if ( pPars->fArea ) if ( pPars->fArea )
printf( "0-cost = %s. ", pPars->fZeroCost ? "yes" : "no" ); printf( "0-cost = %s. ", pPars->fZeroCost ? "yes" : "no" );
printf( "Effort = %s. ", pPars->fMoreEffort ? "yes" : "no" ); printf( "Effort = %s. ", pPars->fMoreEffort ? "yes" : "no" );
......
...@@ -230,6 +230,7 @@ extern int Sfm_TimEvalRemapping( Sfm_Tim_t * p, Vec_Int_t * vFanins, Ve ...@@ -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 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 void Sfm_MitStop( Sfm_Mit_t * p );
extern int Sfm_MitReadNtkDelay( 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 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_MitTransferLoad( Sfm_Mit_t * p, Abc_Obj_t * pNew, Abc_Obj_t * pOld );
extern void Sfm_MitTimingGrow( Sfm_Mit_t * p ); extern void Sfm_MitTimingGrow( Sfm_Mit_t * p );
......
...@@ -537,7 +537,7 @@ void Sfm_LibPrintObj( Sfm_Lib_t * p, Sfm_Fun_t * pObj ) ...@@ -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 * pCellB = p->pCells + (int)pObj->pFansB[0];
Mio_Cell2_t * pCellT = p->pCells + (int)pObj->pFansT[0]; Mio_Cell2_t * pCellT = p->pCells + (int)pObj->pFansT[0];
int i, nFanins = pCellB->nFanins + (pCellT == p->pCells ? 0 : pCellT->nFanins - 1); 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 ) if ( pCellT == p->pCells )
Sfm_LibPrintGate( pCellB, pObj->pFansB + 1, NULL, NULL ); Sfm_LibPrintGate( pCellB, pObj->pFansB + 1, NULL, NULL );
else else
...@@ -548,7 +548,7 @@ void Sfm_LibPrintObj( Sfm_Lib_t * p, Sfm_Fun_t * pObj ) ...@@ -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 Offset = Vec_IntEntry( &p->vProfs, Sfm_LibFunId(p, pObj) );
int * pProf = Vec_IntEntryP( &p->vStore, Offset ); int * pProf = Vec_IntEntryP( &p->vStore, Offset );
for ( i = 0; i < nFanins; i++ ) 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 ) void Sfm_LibPrint( Sfm_Lib_t * p )
......
...@@ -52,6 +52,7 @@ struct Sfm_Mit_t_ ...@@ -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; } 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 ) {} void Sfm_MitStop( Sfm_Mit_t * p ) {}
int Sfm_MitReadNtkDelay( Sfm_Mit_t * p ) { return 0;} 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;} 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_MitTransferLoad( Sfm_Mit_t * p, Abc_Obj_t * pNew, Abc_Obj_t * pOld ) {};
void Sfm_MitTimingGrow( Sfm_Mit_t * p ) {}; void Sfm_MitTimingGrow( Sfm_Mit_t * p ) {};
......
...@@ -75,8 +75,8 @@ static inline int Sfm_TimSlack( Sfm_Tim_t * p, Abc_Obj_t * pNode ) { i ...@@ -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 ) static inline void Sfm_TimEdgeArrival( Sfm_Tim_t * p, Mio_Pin_t * pPin, int * pTimeIn, int * pTimeOut )
{ {
Mio_PinPhase_t PinPhase = Mio_PinReadPhase(pPin); Mio_PinPhase_t PinPhase = Mio_PinReadPhase(pPin);
int tDelayBlockRise = (int)(MIO_NUM*Mio_PinReadDelayBlockRise(pPin)); int tDelayBlockRise = Scl_Flt2Int(Mio_PinReadDelayBlockRise(pPin));
int tDelayBlockFall = (int)(MIO_NUM*Mio_PinReadDelayBlockFall(pPin)); int tDelayBlockFall = Scl_Flt2Int(Mio_PinReadDelayBlockFall(pPin));
if ( PinPhase != MIO_PHASE_INV ) // NONINV phase is present if ( PinPhase != MIO_PHASE_INV ) // NONINV phase is present
{ {
pTimeOut[0] = Abc_MaxInt( pTimeOut[0], pTimeIn[0] + tDelayBlockRise ); 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 ) ...@@ -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 ) static inline void Sfm_TimEdgeRequired( Sfm_Tim_t * p, Mio_Pin_t * pPin, int * pTimeIn, int * pTimeOut )
{ {
Mio_PinPhase_t PinPhase = Mio_PinReadPhase(pPin); Mio_PinPhase_t PinPhase = Mio_PinReadPhase(pPin);
int tDelayBlockRise = (int)(MIO_NUM*Mio_PinReadDelayBlockRise(pPin)); int tDelayBlockRise = Scl_Flt2Int(Mio_PinReadDelayBlockRise(pPin));
int tDelayBlockFall = (int)(MIO_NUM*Mio_PinReadDelayBlockFall(pPin)); int tDelayBlockFall = Scl_Flt2Int(Mio_PinReadDelayBlockFall(pPin));
if ( PinPhase != MIO_PHASE_INV ) // NONINV phase is present if ( PinPhase != MIO_PHASE_INV ) // NONINV phase is present
{ {
pTimeIn[0] = Abc_MinInt( pTimeIn[0], pTimeOut[0] - tDelayBlockRise ); 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 ...@@ -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->vTimArrs, 3*Abc_NtkObjNumMax(pNtk), 0 );
Vec_IntFill( &p->vTimReqs, 3*Abc_NtkObjNumMax(pNtk), 0 ); Vec_IntFill( &p->vTimReqs, 3*Abc_NtkObjNumMax(pNtk), 0 );
p->Delay = Sfm_TimTrace( p ); p->Delay = Sfm_TimTrace( p );
assert( DeltaCrit > 0 && DeltaCrit < MIO_NUM*1000 ); assert( DeltaCrit > 0 && DeltaCrit < Scl_Flt2Int(1000.0) );
p->DeltaCrit = DeltaCrit; p->DeltaCrit = DeltaCrit;
return p; return p;
} }
...@@ -272,7 +272,7 @@ void Sfm_TimTest( Abc_Ntk_t * pNtk ) ...@@ -272,7 +272,7 @@ void Sfm_TimTest( Abc_Ntk_t * pNtk )
{ {
Mio_Library_t * pLib = (Mio_Library_t *)pNtk->pManFunc; Mio_Library_t * pLib = (Mio_Library_t *)pNtk->pManFunc;
Sfm_Tim_t * p = Sfm_TimStart( pLib, NULL, pNtk, 100 ); 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 ); Sfm_TimStop( p );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment