diff options
Diffstat (limited to 'src/map/mpm')
-rw-r--r-- | src/map/mpm/mpmDsd.c | 2 | ||||
-rw-r--r-- | src/map/mpm/mpmGates.c | 29 | ||||
-rw-r--r-- | src/map/mpm/mpmInt.h | 6 | ||||
-rw-r--r-- | src/map/mpm/mpmMan.c | 3 | ||||
-rw-r--r-- | src/map/mpm/mpmMap.c | 2 |
5 files changed, 22 insertions, 20 deletions
diff --git a/src/map/mpm/mpmDsd.c b/src/map/mpm/mpmDsd.c index b6991004..662c9bb4 100644 --- a/src/map/mpm/mpmDsd.c +++ b/src/map/mpm/mpmDsd.c @@ -986,7 +986,7 @@ Kit_DsdPrintFromTruth( (unsigned *)&t, 6 ); printf( "\n" ); // check if the gate exists if ( p->pPars->fMap4Gates ) { - if ( Vec_IntEntry(p->vNpnConfigs, iClass) < 0 ) + if ( Vec_IntSize(Vec_WecEntry(p->vNpnConfigs, iClass)) == 0 ) { p->nNoMatch++; return 0; diff --git a/src/map/mpm/mpmGates.c b/src/map/mpm/mpmGates.c index 99e0db40..d92be969 100644 --- a/src/map/mpm/mpmGates.c +++ b/src/map/mpm/mpmGates.c @@ -45,16 +45,16 @@ ABC_NAMESPACE_IMPL_START SeeAlso [] ***********************************************************************/ -Vec_Int_t * Mpm_ManFindDsdMatches( Mpm_Man_t * p, void * pScl, Vec_Int_t ** pvNpnCosts ) +Vec_Wec_t * Mpm_ManFindDsdMatches( Mpm_Man_t * p, void * pScl ) { int fVerbose = p->pPars->fVeryVerbose; SC_Lib * pLib = (SC_Lib *)pScl; - Vec_Int_t * vClasses; + Vec_Wec_t * vClasses; + Vec_Int_t * vClass; SC_Cell * pRepr; int i, Config, iClass; word Truth; - vClasses = Vec_IntStartFull( 600 ); - *pvNpnCosts = Vec_IntStartFull( 600 ); + vClasses = Vec_WecStart( 600 ); SC_LibForEachCellClass( pLib, pRepr, i ) { if ( pRepr->n_inputs > 6 || pRepr->n_outputs > 1 ) @@ -74,8 +74,8 @@ Vec_Int_t * Mpm_ManFindDsdMatches( Mpm_Man_t * p, void * pScl, Vec_Int_t ** pvNp iClass = Config >> 17; Config = (pRepr->Id << 17) | (Config & 0x1FFFF); // write gate and NPN config for this DSD class - Vec_IntWriteEntry( vClasses, iClass, Config ); - Vec_IntWriteEntry( *pvNpnCosts, iClass, (int)(100 * pRepr->area) ); + vClass = Vec_WecEntry( vClasses, iClass ); + Vec_IntPush( vClass, Config ); if ( !fVerbose ) continue; @@ -100,17 +100,19 @@ Vec_Int_t * Mpm_ManFindDsdMatches( Mpm_Man_t * p, void * pScl, Vec_Int_t ** pvNp SeeAlso [] ***********************************************************************/ -Vec_Ptr_t * Mpm_ManFindCells( Mio_Library_t * pMio, SC_Lib * pScl, Vec_Int_t * vNpnConfigs ) +Vec_Ptr_t * Mpm_ManFindCells( Mio_Library_t * pMio, SC_Lib * pScl, Vec_Wec_t * vNpnConfigs ) { Vec_Ptr_t * vNpnGatesMio; + Vec_Int_t * vClass; Mio_Gate_t * pMioGate; SC_Cell * pCell; int Config, iClass; - vNpnGatesMio = Vec_PtrStart( Vec_IntSize(vNpnConfigs) ); - Vec_IntForEachEntry( vNpnConfigs, Config, iClass ) + vNpnGatesMio = Vec_PtrStart( Vec_WecSize(vNpnConfigs) ); + Vec_WecForEachLevel( vNpnConfigs, vClass, iClass ) { - if ( Config == -1 ) + if ( Vec_IntSize(vClass) == 0 ) continue; + Config = Vec_IntEntry(vClass, 0); pCell = SC_LibCell( pScl, (Config >> 17) ); pMioGate = Mio_LibraryReadGateByName( pMio, pCell->pName, NULL ); if ( pMioGate == NULL ) @@ -161,7 +163,7 @@ Abc_Ntk_t * Mpm_ManDeriveMappedAbcNtk( Mpm_Man_t * p, Mio_Library_t * pMio ) { Abc_Ntk_t * pNtk; Vec_Ptr_t * vNpnGatesMio; - Vec_Int_t * vNodes, * vCopy; + Vec_Int_t * vNodes, * vCopy, * vClass; Abc_Obj_t * pObj, * pFanin; Mig_Obj_t * pNode; Mpm_Cut_t * pCutBest; @@ -214,7 +216,8 @@ Abc_Ntk_t * Mpm_ManDeriveMappedAbcNtk( Mpm_Man_t * p, Mio_Library_t * pMio ) Vec_IntForEachEntry( vNodes, iNode, i ) { pCutBest = Mpm_ObjCutBestP( p, Mig_ManObj(p->pMig, iNode) ); - Config = Vec_IntEntry( p->vNpnConfigs, Abc_Lit2Var(pCutBest->iFunc) ); + vClass = Vec_WecEntry( p->vNpnConfigs, Abc_Lit2Var(pCutBest->iFunc) ); + Config = Vec_IntEntry( vClass, 0 ); pObj = Abc_NtkCreateNode( pNtk ); pObj->pData = Vec_PtrEntry( vNpnGatesMio, Abc_Lit2Var(pCutBest->iFunc) ); assert( pObj->pData != NULL ); @@ -265,7 +268,7 @@ Abc_Ntk_t * Mpm_ManPerformCellMapping( Mig_Man_t * pMig, Mpm_Par_t * pPars, Mio_ p = Mpm_ManStart( pMig, pPars ); if ( p->pPars->fVerbose ) Mpm_ManPrintStatsInit( p ); - p->vNpnConfigs = Mpm_ManFindDsdMatches( p, p->pPars->pScl, &p->vNpnCosts ); + p->vNpnConfigs = Mpm_ManFindDsdMatches( p, p->pPars->pScl ); Mpm_ManPrepare( p ); Mpm_ManPerform( p ); if ( p->pPars->fVerbose ) diff --git a/src/map/mpm/mpmInt.h b/src/map/mpm/mpmInt.h index 99952568..0f61d3b8 100644 --- a/src/map/mpm/mpmInt.h +++ b/src/map/mpm/mpmInt.h @@ -36,6 +36,7 @@ #include "misc/vec/vec.h" #include "misc/vec/vecMem.h" #include "misc/vec/vecHsh.h" +#include "misc/vec/vecWec.h" #include "misc/util/utilTruth.h" #include "mpmMig.h" #include "mpm.h" @@ -136,8 +137,7 @@ struct Mpm_Man_t_ Vec_Int_t * vMap2Perm; // maps number into its permutation unsigned uPermMask[3]; unsigned uComplMask[3]; - Vec_Int_t * vNpnConfigs; - Vec_Int_t * vNpnCosts; // area cost of each NPN class + Vec_Wec_t * vNpnConfigs; // mapping attributes Vec_Int_t vCutBests; // cut best Vec_Int_t vCutLists; // cut list @@ -242,7 +242,7 @@ extern word Mpm_CutTruthFromDsd( Mpm_Man_t * pMan, Mpm_Cut_t * extern int Mpm_CutCheckDsd6( Mpm_Man_t * p, word t ); extern int Mpm_CutComputeDsd6( Mpm_Man_t * p, Mpm_Cut_t * pCut, Mpm_Cut_t * pCut0, Mpm_Cut_t * pCut1, Mpm_Cut_t * pCutC, int fCompl0, int fCompl1, int fComplC, int Type ); /*=== mpmGates.c ===========================================================*/ -extern Vec_Int_t * Mpm_ManFindDsdMatches( Mpm_Man_t * p, void * pScl, Vec_Int_t ** pvNpnCosts ); +extern Vec_Wec_t * Mpm_ManFindDsdMatches( Mpm_Man_t * p, void * pScl ); /*=== mpmLib.c ===========================================================*/ extern Mpm_LibLut_t * Mpm_LibLutSetSimple( int nLutSize ); extern void Mpm_LibLutFree( Mpm_LibLut_t * pLib ); diff --git a/src/map/mpm/mpmMan.c b/src/map/mpm/mpmMan.c index dd6342cd..ae3bfc32 100644 --- a/src/map/mpm/mpmMan.c +++ b/src/map/mpm/mpmMan.c @@ -135,8 +135,7 @@ void Mpm_ManStop( Mpm_Man_t * p ) Vec_IntFree( p->pHash->vData ); Hsh_IntManStop( p->pHash ); } - Vec_IntFreeP( &p->vNpnCosts ); - Vec_IntFreeP( &p->vNpnConfigs ); + Vec_WecFreeP( &p->vNpnConfigs ); Vec_PtrFree( p->vTemp ); Mmr_StepStop( p->pManCuts ); ABC_FREE( p->vFreeUnits.pArray ); diff --git a/src/map/mpm/mpmMap.c b/src/map/mpm/mpmMap.c index 825f8c3f..0668ed12 100644 --- a/src/map/mpm/mpmMap.c +++ b/src/map/mpm/mpmMap.c @@ -152,7 +152,7 @@ static inline int Mpm_CutGetArea( Mpm_Man_t * p, Mpm_Cut_t * pCut ) if ( p->pPars->fMap4Aig ) return MPM_UNIT_AREA * p->pDsd6[Abc_Lit2Var(pCut->iFunc)].nAnds; if ( p->pPars->fMap4Gates ) - return MPM_UNIT_AREA * Vec_IntEntry( p->vNpnCosts, Abc_Lit2Var(pCut->iFunc) ); + return MPM_UNIT_AREA * 1; return p->pLibLut->pLutAreas[pCut->nLeaves]; } static inline word Mpm_CutGetSign( Mpm_Cut_t * pCut ) |