diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/mpm/mpmCore.c | 2 | ||||
-rw-r--r-- | src/map/mpm/mpmDsd.c | 2 | ||||
-rw-r--r-- | src/map/mpm/mpmGates.c | 62 | ||||
-rw-r--r-- | src/map/mpm/mpmInt.h | 2 | ||||
-rw-r--r-- | src/map/mpm/mpmMan.c | 2 |
5 files changed, 46 insertions, 24 deletions
diff --git a/src/map/mpm/mpmCore.c b/src/map/mpm/mpmCore.c index bc0e5aa6..de2d7bc7 100644 --- a/src/map/mpm/mpmCore.c +++ b/src/map/mpm/mpmCore.c @@ -79,8 +79,6 @@ Gia_Man_t * Mpm_ManPerformLutMapping( Mig_Man_t * pMig, Mpm_Par_t * pPars ) p = Mpm_ManStart( pMig, pPars ); if ( p->pPars->fVerbose ) Mpm_ManPrintStatsInit( p ); -// if ( p->pPars->fMap4Gates ) -// p->vGateNpnConfig = Mpm_ManFindDsdMatches( p, p->pPars->pScl, &p->vNpnCosts ); Mpm_ManPrepare( p ); Mpm_ManPerform( p ); if ( p->pPars->fVerbose ) diff --git a/src/map/mpm/mpmDsd.c b/src/map/mpm/mpmDsd.c index 01b7a520..b6991004 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->vGateNpnConfig, iClass) < 0 ) + if ( Vec_IntEntry(p->vNpnConfigs, iClass) < 0 ) { p->nNoMatch++; return 0; diff --git a/src/map/mpm/mpmGates.c b/src/map/mpm/mpmGates.c index cdcc4e36..4e31fb34 100644 --- a/src/map/mpm/mpmGates.c +++ b/src/map/mpm/mpmGates.c @@ -100,19 +100,24 @@ 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 * vNpnGates ) +Vec_Ptr_t * Mpm_ManFindCells( Mio_Library_t * pMio, SC_Lib * pScl, Vec_Int_t * vNpnConfigs ) { Vec_Ptr_t * vNpnGatesMio; Mio_Gate_t * pMioGate; SC_Cell * pCell; - int iCell, iClass; - vNpnGatesMio = Vec_PtrStart( Vec_IntSize(vNpnGates) ); - Vec_IntForEachEntry( vNpnGates, iCell, iClass ) + int Config, iClass; + vNpnGatesMio = Vec_PtrStart( Vec_IntSize(vNpnConfigs) ); + Vec_IntForEachEntry( vNpnConfigs, Config, iClass ) { - if ( iCell == -1 ) + if ( Config == -1 ) continue; - pCell = SC_LibCell( pScl, (iCell >> 17) ); + pCell = SC_LibCell( pScl, (Config >> 17) ); pMioGate = Mio_LibraryReadGateByName( pMio, pCell->pName, NULL ); + if ( pMioGate == NULL ) + { + Vec_PtrFree( vNpnGatesMio ); + return NULL; + } assert( pMioGate != NULL ); Vec_PtrWriteEntry( vNpnGatesMio, iClass, pMioGate ); } @@ -160,10 +165,15 @@ Abc_Ntk_t * Mpm_ManDeriveMappedAbcNtk( Mpm_Man_t * p, Mio_Library_t * pMio ) Abc_Obj_t * pObj, * pFanin; Mig_Obj_t * pNode; Mpm_Cut_t * pCutBest; - int i, k, iNode, iMigLit, fCompl; + int i, k, iNode, iMigLit, fCompl, Config; // find mapping of SCL cells into MIO cells - vNpnGatesMio = Mpm_ManFindCells( pMio, (SC_Lib *)p->pPars->pScl, p->vGateNpnConfig ); + vNpnGatesMio = Mpm_ManFindCells( pMio, (SC_Lib *)p->pPars->pScl, p->vNpnConfigs ); + if ( vNpnGatesMio == NULL ) + { + printf( "Genlib library does not match SCL library.\n" ); + return NULL; + } // create mapping for each phase of each node vCopy = Vec_IntStartFull( 2 * Mig_ManObjNum(p->pMig) ); @@ -185,25 +195,39 @@ Abc_Ntk_t * Mpm_ManDeriveMappedAbcNtk( Mpm_Man_t * p, Mio_Library_t * pMio ) Abc_NtkAddDummyPiNames( pNtk ); // create constant nodes - pObj = Abc_NtkCreateNodeConst0(pNtk); - Vec_IntWriteEntry( vCopy, Abc_Var2Lit( 0, 0 ), Abc_ObjId(pObj) ); - pObj = Abc_NtkCreateNodeConst1(pNtk); - Vec_IntWriteEntry( vCopy, Abc_Var2Lit( 0, 1 ), Abc_ObjId(pObj) ); + Mig_ManForEachCo( p->pMig, pNode, i ) + if ( Mig_ObjFaninLit(pNode, 0) == 0 ) + { + pObj = Abc_NtkCreateNodeConst0(pNtk); + Vec_IntWriteEntry( vCopy, Abc_Var2Lit( 0, 0 ), Abc_ObjId(pObj) ); + break; + } + Mig_ManForEachCo( p->pMig, pNode, i ) + if ( Mig_ObjFaninLit(pNode, 0) == 1 ) + { + pObj = Abc_NtkCreateNodeConst1(pNtk); + Vec_IntWriteEntry( vCopy, Abc_Var2Lit( 0, 1 ), Abc_ObjId(pObj) ); + break; + } // create internal nodes Vec_IntForEachEntry( vNodes, iNode, i ) { - pNode = Mig_ManObj( p->pMig, iNode ); - pCutBest = Mpm_ObjCutBestP( p, pNode ); + pCutBest = Mpm_ObjCutBestP( p, Mig_ManObj(p->pMig, iNode) ); + Config = Vec_IntEntry( p->vNpnConfigs, Abc_Lit2Var(pCutBest->iFunc) ); pObj = Abc_NtkCreateNode( pNtk ); pObj->pData = Vec_PtrEntry( vNpnGatesMio, Abc_Lit2Var(pCutBest->iFunc) ); - fCompl = Abc_LitIsCompl(pCutBest->iFunc); - Mpm_CutForEachLeafLit( pCutBest, iMigLit, k ) + assert( pObj->pData != NULL ); + fCompl = Abc_LitIsCompl(pCutBest->iFunc) ^ ((Config >> 16) & 1); + Config &= 0xFFFF; + for ( k = 0; k < (int)pCutBest->nLeaves; k++ ) { - pFanin = Mpm_ManGetAbcNode( pNtk, vCopy, iMigLit ); + assert( (Config >> 6) < 720 ); + iMigLit = pCutBest->pLeaves[ (int)(p->Perm6[Config >> 6][k]) ]; + pFanin = Mpm_ManGetAbcNode( pNtk, vCopy, Abc_LitNotCond(iMigLit, (Config >> k) & 1) ); Abc_ObjAddFanin( pObj, pFanin ); } - Vec_IntWriteEntry( vCopy, Abc_Var2Lit( iNode, fCompl ), Abc_ObjId(pObj) ); + Vec_IntWriteEntry( vCopy, Abc_Var2Lit(iNode, fCompl), Abc_ObjId(pObj) ); } // create primary outputs @@ -241,7 +265,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->vGateNpnConfig = Mpm_ManFindDsdMatches( p, p->pPars->pScl, &p->vNpnCosts ); + p->vNpnConfigs = Mpm_ManFindDsdMatches( p, p->pPars->pScl, &p->vNpnCosts ); 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 e8b6d4de..cf267a07 100644 --- a/src/map/mpm/mpmInt.h +++ b/src/map/mpm/mpmInt.h @@ -140,7 +140,7 @@ struct Mpm_Man_t_ Vec_Int_t * vMap2Perm; // maps number into its permutation unsigned uPermMask[3]; unsigned uComplMask[3]; - Vec_Int_t * vGateNpnConfig; + Vec_Int_t * vNpnConfigs; Vec_Int_t * vNpnCosts; // area cost of each NPN class // mapping attributes Vec_Int_t vCutBests; // cut best diff --git a/src/map/mpm/mpmMan.c b/src/map/mpm/mpmMan.c index 3ed07c83..89e754f4 100644 --- a/src/map/mpm/mpmMan.c +++ b/src/map/mpm/mpmMan.c @@ -139,7 +139,7 @@ void Mpm_ManStop( Mpm_Man_t * p ) Hsh_IntManStop( p->pHash ); } Vec_IntFreeP( &p->vNpnCosts ); - Vec_IntFreeP( &p->vGateNpnConfig ); + Vec_IntFreeP( &p->vNpnConfigs ); Vec_PtrFree( p->vTemp ); Mmr_StepStop( p->pManCuts ); ABC_FREE( p->vObjPresUsed.pArray ); |