diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2013-07-18 13:03:01 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2013-07-18 13:03:01 -0700 |
commit | a35599960b1fc7ba3a94c0ac562ec0ad217230a2 (patch) | |
tree | 8b374b398f2d29d59f8e78d20558117b3b98fb8b /src/map | |
parent | 4decece2c73d826c49c5bbca3df3364da94357bc (diff) | |
download | abc-a35599960b1fc7ba3a94c0ac562ec0ad217230a2.tar.gz abc-a35599960b1fc7ba3a94c0ac562ec0ad217230a2.tar.bz2 abc-a35599960b1fc7ba3a94c0ac562ec0ad217230a2.zip |
New technology mapper.
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/mpm/mpmInt.h | 3 | ||||
-rw-r--r-- | src/map/mpm/mpmMan.c | 4 | ||||
-rw-r--r-- | src/map/mpm/mpmMap.c | 102 | ||||
-rw-r--r-- | src/map/mpm/mpmTruth.c | 14 |
4 files changed, 41 insertions, 82 deletions
diff --git a/src/map/mpm/mpmInt.h b/src/map/mpm/mpmInt.h index f22ecb6d..99952568 100644 --- a/src/map/mpm/mpmInt.h +++ b/src/map/mpm/mpmInt.h @@ -113,9 +113,6 @@ struct Mpm_Man_t_ Mpm_Uni_t pCutUnits[MPM_CUT_MAX+1]; // cut info units Vec_Ptr_t vFreeUnits; // free cut info units Vec_Ptr_t * vTemp; // storage for cuts - // object presence - unsigned char * pObjPres; // object presence - Vec_Int_t vObjPresUsed; // used objects // cut comparison int (* pCutCmp) (Mpm_Uni_t *, Mpm_Uni_t *);// procedure to compare cuts // fanin cuts/signatures diff --git a/src/map/mpm/mpmMan.c b/src/map/mpm/mpmMan.c index 137ec5fc..573c0bcd 100644 --- a/src/map/mpm/mpmMan.c +++ b/src/map/mpm/mpmMan.c @@ -65,8 +65,6 @@ Mpm_Man_t * Mpm_ManStart( Mig_Man_t * pMig, Mpm_Par_t * pPars ) Vec_PtrGrow( &p->vFreeUnits, p->nNumCuts + 1 ); for ( i = p->nNumCuts; i >= 0; i-- ) Vec_PtrPush( &p->vFreeUnits, p->pCutUnits + i ); - p->pObjPres = ABC_FALLOC( unsigned char, Mig_ManObjNum(pMig) ); - Vec_IntGrow( &p->vObjPresUsed, p->nLutSize ); p->vTemp = Vec_PtrAlloc( 1000 ); // mapping attributes Vec_IntFill( &p->vCutBests, Mig_ManObjNum(pMig), 0 ); @@ -141,9 +139,7 @@ void Mpm_ManStop( Mpm_Man_t * p ) Vec_IntFreeP( &p->vNpnConfigs ); Vec_PtrFree( p->vTemp ); Mmr_StepStop( p->pManCuts ); - ABC_FREE( p->vObjPresUsed.pArray ); ABC_FREE( p->vFreeUnits.pArray ); - ABC_FREE( p->pObjPres ); // mapping attributes ABC_FREE( p->vCutBests.pArray ); ABC_FREE( p->vCutLists.pArray ); diff --git a/src/map/mpm/mpmMap.c b/src/map/mpm/mpmMap.c index 042dcbc7..b906a3a1 100644 --- a/src/map/mpm/mpmMap.c +++ b/src/map/mpm/mpmMap.c @@ -343,29 +343,14 @@ p->timeCompare += Abc_Clock() - clk; ***********************************************************************/ static inline Mpm_Cut_t * Mpm_ManMergeCuts( Mpm_Man_t * p, Mpm_Cut_t * pCut0, Mpm_Cut_t * pCut1, Mpm_Cut_t * pCut2 ) { - int fUsePres = 0; Mpm_Cut_t * pTemp, * pCut = &((Mpm_Uni_t *)Vec_PtrEntryLast(&p->vFreeUnits))->pCut; - int i, c, iObj, fDisj = 1; - - if ( fUsePres ) + int i, c, iObj, iPlace; + // base cut + memcpy( pCut->pLeaves, pCut0->pLeaves, sizeof(int) * pCut0->nLeaves ); + pCut->nLeaves = pCut0->nLeaves; + // remaining cuts + if ( p->pPars->fUseDsd ) { - // clean present objects - for ( i = 0; i < p->vObjPresUsed.nSize; i++ ) - p->pObjPres[p->vObjPresUsed.pArray[i]] = (unsigned char)0xFF; - Vec_IntClear(&p->vObjPresUsed); - // check present objects - // for ( i = 0; i < Mig_ManObjNum(p->pMig); i++ ) - // assert( p->pObjPres[i] == (unsigned char)0xFF ); - // base cut - pCut->nLeaves = 0; - for ( i = 0; i < (int)pCut0->nLeaves; i++ ) - { - iObj = Abc_Lit2Var(pCut0->pLeaves[i]); - Vec_IntPush( &p->vObjPresUsed, iObj ); - p->pObjPres[iObj] = pCut->nLeaves; - pCut->pLeaves[pCut->nLeaves++] = pCut0->pLeaves[i]; - } - // remaining cuts for ( c = 1; c < 3; c++ ) { pTemp = (c == 1) ? pCut1 : pCut2; @@ -376,39 +361,28 @@ static inline Mpm_Cut_t * Mpm_ManMergeCuts( Mpm_Man_t * p, Mpm_Cut_t * pCut0, Mp for ( i = 0; i < (int)pTemp->nLeaves; i++ ) { iObj = Abc_Lit2Var(pTemp->pLeaves[i]); - if ( p->pObjPres[iObj] == (unsigned char)0xFF ) + for ( iPlace = 0; iPlace < (int)pCut->nLeaves; iPlace++ ) + if ( iObj == Abc_Lit2Var(pCut->pLeaves[iPlace]) ) + break; + if ( iPlace == (int)pCut->nLeaves ) { if ( (int)pCut->nLeaves == p->nLutSize ) return NULL; - Vec_IntPush( &p->vObjPresUsed, iObj ); - p->pObjPres[iObj] = pCut->nLeaves; pCut->pLeaves[pCut->nLeaves++] = pTemp->pLeaves[i]; } - else - fDisj = 0; - p->uPermMask[c] ^= (((i & 7) ^ 7) << (3*p->pObjPres[iObj])); - assert( Abc_Lit2Var(pTemp->pLeaves[i]) == Abc_Lit2Var(pCut->pLeaves[p->pObjPres[iObj]]) ); - if ( pTemp->pLeaves[i] != pCut->pLeaves[p->pObjPres[iObj]] ) - p->uComplMask[c] |= (1 << p->pObjPres[iObj]); + p->uPermMask[c] ^= (((i & 7) ^ 7) << (3*iPlace)); + if ( pTemp->pLeaves[i] != pCut->pLeaves[iPlace] ) + p->uComplMask[c] |= (1 << iPlace); } - // Mpm_ManPrintPerm( p->uPermMask[c] ); printf( "\n" ); } } else { - int iPlace; - // base cut - pCut->nLeaves = 0; - for ( i = 0; i < (int)pCut0->nLeaves; i++ ) - pCut->pLeaves[pCut->nLeaves++] = pCut0->pLeaves[i]; - // remaining cuts for ( c = 1; c < 3; c++ ) { pTemp = (c == 1) ? pCut1 : pCut2; if ( pTemp == NULL ) break; - p->uPermMask[c] = 0x3FFFF; // 18 bits - p->uComplMask[c] = 0; for ( i = 0; i < (int)pTemp->nLeaves; i++ ) { iObj = Abc_Lit2Var(pTemp->pLeaves[i]); @@ -421,16 +395,9 @@ static inline Mpm_Cut_t * Mpm_ManMergeCuts( Mpm_Man_t * p, Mpm_Cut_t * pCut0, Mp return NULL; pCut->pLeaves[pCut->nLeaves++] = pTemp->pLeaves[i]; } - else - fDisj = 0; - p->uPermMask[c] ^= (((i & 7) ^ 7) << (3*iPlace)); - assert( Abc_Lit2Var(pTemp->pLeaves[i]) == Abc_Lit2Var(pCut->pLeaves[iPlace]) ); - if ( pTemp->pLeaves[i] != pCut->pLeaves[iPlace] ) - p->uComplMask[c] |= (1 << iPlace); } } } -// printf( "%d", fDisj ); if ( pCut1 == NULL ) { pCut->hNext = 0; @@ -455,37 +422,50 @@ static inline int Mpm_ManExploreNewCut( Mpm_Man_t * p, Mig_Obj_t * pObj, Mpm_Cut { Mpm_Cut_t * pCut; int ArrTime; - #ifdef MIG_RUNTIME abctime clk = clock(); #endif - pCut = Mpm_ManMergeCuts( p, pCut0, pCut1, pCut2 ); - if ( pCut == NULL ) + + if ( pCut0->nLeaves >= pCut1->nLeaves ) { + pCut = Mpm_ManMergeCuts( p, pCut0, pCut1, pCut2 ); #ifdef MIG_RUNTIME p->timeMerge += clock() - clk; #endif - return 1; + if ( pCut == NULL ) + return 1; + if ( p->pPars->fUseTruth ) + Mpm_CutComputeTruth( p, pCut, pCut0, pCut1, pCut2, Mig_ObjFaninC0(pObj), Mig_ObjFaninC1(pObj), Mig_ObjFaninC2(pObj), Mig_ObjNodeType(pObj) ); + else if ( p->pPars->fUseDsd ) + { + if ( !Mpm_CutComputeDsd6( p, pCut, pCut0, pCut1, pCut2, Mig_ObjFaninC0(pObj), Mig_ObjFaninC1(pObj), Mig_ObjFaninC2(pObj), Mig_ObjNodeType(pObj) ) ) + return 1; + } } - - // derive truth table - if ( p->pPars->fUseTruth ) - Mpm_CutComputeTruth( p, pCut, pCut0, pCut1, pCut2, Mig_ObjFaninC0(pObj), Mig_ObjFaninC1(pObj), Mig_ObjFaninC2(pObj), Mig_ObjNodeType(pObj) ); - else if ( p->pPars->fUseDsd ) + else { - if ( !Mpm_CutComputeDsd6( p, pCut, pCut0, pCut1, pCut2, Mig_ObjFaninC0(pObj), Mig_ObjFaninC1(pObj), Mig_ObjFaninC2(pObj), Mig_ObjNodeType(pObj) ) ) + pCut = Mpm_ManMergeCuts( p, pCut1, pCut0, pCut2 ); +#ifdef MIG_RUNTIME +p->timeMerge += clock() - clk; +#endif + if ( pCut == NULL ) return 1; + if ( p->pPars->fUseTruth ) + Mpm_CutComputeTruth( p, pCut, pCut1, pCut0, pCut2, Mig_ObjFaninC1(pObj), Mig_ObjFaninC0(pObj), 1 ^ Mig_ObjFaninC2(pObj), Mig_ObjNodeType(pObj) ); + else if ( p->pPars->fUseDsd ) + { + if ( !Mpm_CutComputeDsd6( p, pCut, pCut1, pCut0, pCut2, Mig_ObjFaninC1(pObj), Mig_ObjFaninC0(pObj), 1 ^ Mig_ObjFaninC2(pObj), Mig_ObjNodeType(pObj) ) ) + return 1; + } } #ifdef MIG_RUNTIME -p->timeMerge += clock() - clk; clk = clock(); #endif ArrTime = Mpm_CutGetArrTime( p, pCut ); #ifdef MIG_RUNTIME p->timeEval += clock() - clk; #endif - if ( p->fMainRun && ArrTime > Required ) return 1; @@ -497,11 +477,11 @@ clk = Abc_Clock(); p->timeStore += Abc_Clock() - clk; #endif - // return 0 if const or buffer cut is derived - reset all cuts to contain only one +/* + // return 0 if const or buffer cut is derived - reset all cuts to contain only one --- does not work // if ( pCut->nLeaves < 2 && p->nCutStore == 1 ) // return 0; -/* - if ( pCut->nLeaves < 2 ) + if ( pCut->nLeaves < 2 ) { int i; assert( p->nCutStore >= 1 ); diff --git a/src/map/mpm/mpmTruth.c b/src/map/mpm/mpmTruth.c index 79f24cca..c60ebb6e 100644 --- a/src/map/mpm/mpmTruth.c +++ b/src/map/mpm/mpmTruth.c @@ -91,13 +91,6 @@ static inline int Mpm_CutTruthMinimize6( Mpm_Man_t * p, Mpm_Cut_t * pCut ) } k++; } - else - { - int iObj = Abc_Lit2Var( pCut->pLeaves[i] ); - int Res = Vec_IntRemove( &p->vObjPresUsed, iObj ); - assert( Res == 1 ); - p->pObjPres[iObj] = (unsigned char)0xFF; - } } assert( k == nSuppSize ); pCut->nLeaves = nSuppSize; @@ -129,13 +122,6 @@ static inline int Mpm_CutTruthMinimize7( Mpm_Man_t * p, Mpm_Cut_t * pCut ) } k++; } - else - { - int iObj = Abc_Lit2Var( pCut->pLeaves[i] ); - int Res = Vec_IntRemove( &p->vObjPresUsed, iObj ); - assert( Res == 1 ); - p->pObjPres[iObj] = (unsigned char)0xFF; - } } assert( k == nSuppSize ); assert( nSuppSize == Abc_TtSupportSize(p->Truth, Mpm_CutLeafNum(pCut)) ); |