diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2015-11-08 19:59:34 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2015-11-08 19:59:34 -0800 |
commit | 3c9f7d2bc8180462635eda6e1c7ae5b4208f2078 (patch) | |
tree | cdf01221b53d206703b4a749187a6f871bf1e753 /src/opt/sfm/sfmDec.c | |
parent | 81e1f9fef3eda8af31a5535f7bdd6754b76f2a5d (diff) | |
download | abc-3c9f7d2bc8180462635eda6e1c7ae5b4208f2078.tar.gz abc-3c9f7d2bc8180462635eda6e1c7ae5b4208f2078.tar.bz2 abc-3c9f7d2bc8180462635eda6e1c7ae5b4208f2078.zip |
Extending and improving timing manager.
Diffstat (limited to 'src/opt/sfm/sfmDec.c')
-rw-r--r-- | src/opt/sfm/sfmDec.c | 55 |
1 files changed, 41 insertions, 14 deletions
diff --git a/src/opt/sfm/sfmDec.c b/src/opt/sfm/sfmDec.c index 1240a256..c6da5429 100644 --- a/src/opt/sfm/sfmDec.c +++ b/src/opt/sfm/sfmDec.c @@ -685,18 +685,20 @@ int Sfm_MffcDeref_rec( Abc_Obj_t * pObj ) } return Area; } -int Sfm_MffcRef_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)); Abc_ObjForEachFanin( pObj, pFanin, i ) { if ( pFanin->vFanouts.nSize++ == 0 && !Abc_ObjIsCi(pFanin) ) - Area += Sfm_MffcRef_rec( pFanin ); + Area += Sfm_MffcRef_rec( pFanin, vMffc ); } + if ( vMffc ) + Vec_IntPush( vMffc, Abc_ObjId(pObj) ); return Area; } -int Sfm_DecMffcAreaReal( Abc_Obj_t * pPivot, Vec_Int_t * vCut ) +int Sfm_DecMffcAreaReal( Abc_Obj_t * pPivot, Vec_Int_t * vCut, Vec_Int_t * vMffc ) { Abc_Ntk_t * pNtk = pPivot->pNtk; Abc_Obj_t * pObj; @@ -705,7 +707,7 @@ int Sfm_DecMffcAreaReal( Abc_Obj_t * pPivot, Vec_Int_t * vCut ) Abc_NtkForEachObjVec( vCut, pNtk, pObj, i ) pObj->vFanouts.nSize++; Area1 = Sfm_MffcDeref_rec( pPivot ); - Area2 = Sfm_MffcRef_rec( pPivot ); + Area2 = Sfm_MffcRef_rec( pPivot, vMffc ); Abc_NtkForEachObjVec( vCut, pNtk, pObj, i ) pObj->vFanouts.nSize--; assert( Area1 == Area2 ); @@ -1149,7 +1151,7 @@ int Sfm_DecPeformDec2( Sfm_Dec_t * p, Abc_Obj_t * pObj ) // compute area savings Sfm_DecPrepareVec( &p->vObjMap, pSupp[i], nSupp[i], &p->vTemp ); - AreaThis = Sfm_DecMffcAreaReal(pObj, &p->vTemp); + AreaThis = Sfm_DecMffcAreaReal(pObj, &p->vTemp, NULL); assert( p->AreaMffc <= AreaThis ); if ( p->pPars->fZeroCost ? (AreaNew > AreaThis) : (AreaNew >= AreaThis) ) continue; @@ -1243,6 +1245,13 @@ int Sfm_DecPeformDec3( Sfm_Dec_t * p, Abc_Obj_t * pObj ) return RetValue; } + // get MFFC + if ( p->pMit ) + { + Sfm_DecPrepareVec( &p->vObjMap, pSupp[i], nSupp[i], &p->vTemp ); + Sfm_DecMffcAreaReal(pObj, &p->vTemp, &p->vTemp2 ); + } + // try the delay p->nSuppVars = nSupp[i]; Abc_TtCopy( p->Copy, uTruth[i], SFM_WORD_MAX, 0 ); @@ -1256,17 +1265,31 @@ int Sfm_DecPeformDec3( Sfm_Dec_t * p, Abc_Obj_t * pObj ) Vec_Int_t vFanins = { nSupp[i], nSupp[i], pSupp[i] }; int Delay; if ( p->pMit ) - Delay = Sfm_MitEvalRemapping( p->pMit, &vFanins, &p->vObjMap, pGate1, pFans1, pGate2, pFans2 ); + { + DelayMin = 0; + Delay = Sfm_MitEvalRemapping( p->pMit, &p->vTemp2, pObj, &vFanins, &p->vObjMap, pGate1, pFans1, pGate2, pFans2 ); + if ( DelayMin < Delay ) + { + DelayMin = Delay; + pGate1Best = pGate1; + pGate2Best = pGate2; + pFans1Best = pFans1; + pFans2Best = pFans2; + iBest = i; + } + } else - Delay = Sfm_TimEvalRemapping( p->pTim, &vFanins, &p->vObjMap, pGate1, pFans1, pGate2, pFans2 ); - if ( DelayMin > Delay ) { - DelayMin = Delay; - pGate1Best = pGate1; - pGate2Best = pGate2; - pFans1Best = pFans1; - pFans2Best = pFans2; - iBest = i; + Delay = Sfm_TimEvalRemapping( p->pTim, &vFanins, &p->vObjMap, pGate1, pFans1, pGate2, pFans2 ); + if ( DelayMin > Delay ) + { + DelayMin = Delay; + pGate1Best = pGate1; + pGate2Best = pGate2; + pFans1Best = pFans1; + pFans2Best = pFans2; + iBest = i; + } } } } @@ -2004,7 +2027,11 @@ p->timeSat += Abc_Clock() - clk; assert( Vec_IntSize(&p->vObjGates) - Limit <= 2 ); p->nNodesChanged++; Abc_NtkCountStats( p, Limit ); + // reduce load due to removed MFFC + if ( p->pMit ) Sfm_MitUpdateLoad( p->pMit, &p->vTemp2, 0 ); // assuming &p->vTemp2 contains MFFC Sfm_DecInsert( pNtk, pObj, Limit, &p->vObjGates, &p->vObjFanins, &p->vObjMap, &p->vGateHands, p->GateBuffer, p->GateInvert, &p->vGateFuncs, &p->vTemp ); + // increase load due to added new nodes + if ( p->pMit ) Sfm_MitUpdateLoad( p->pMit, &p->vTemp, 1 ); // assuming &p->vTemp contains new nodes clk = Abc_Clock(); if ( p->pMit ) Sfm_MitUpdateTiming( p->pMit, &p->vTemp ); |