summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/base/abci/abc.c12
-rw-r--r--src/map/mpm/mpmInt.h3
-rw-r--r--src/map/mpm/mpmMan.c4
-rw-r--r--src/map/mpm/mpmMap.c102
-rw-r--r--src/map/mpm/mpmTruth.c14
5 files changed, 49 insertions, 86 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index 6fc53c34..548745dd 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -29555,8 +29555,6 @@ int Abc_CommandAbc9If2( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -1, "LUT size %d is not supported.\n", nLutSize );
goto usage;
}
- assert( pPars->pLib == NULL );
- pPars->pLib = Mpm_LibLutSetSimple( nLutSize );
break;
case 'C':
if ( globalUtilOptind >= argc )
@@ -29612,8 +29610,6 @@ int Abc_CommandAbc9If2( Abc_Frame_t * pAbc, int argc, char ** argv )
goto usage;
}
}
- if ( pPars->pLib == NULL )
- pPars->pLib = Mpm_LibLutSetSimple( nLutSize );
if ( pPars->fMap4Cnf )
pPars->fUseDsd = 1;
if ( pPars->fCutMin )
@@ -29631,7 +29627,13 @@ int Abc_CommandAbc9If2( Abc_Frame_t * pAbc, int argc, char ** argv )
}
if ( pPars->fUseDsd || pPars->fUseTruth )
pPars->fDeriveLuts = 1;
+ if ( pPars->fUseDsd && nLutSize != 6 )
+ {
+ Abc_Print( -1, "Currently DSD can only be used with 6-input cuts.\n" );
+ return 1;
+ }
// perform mapping
+ assert( pPars->pLib == NULL );
if ( pPars->fMap4Gates )
{
if ( Abc_FrameReadLibGen() == NULL )
@@ -29639,6 +29641,7 @@ int Abc_CommandAbc9If2( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -1, "There is no GENLIB library available.\n" );
return 1;
}
+ pPars->pLib = Mpm_LibLutSetSimple( nLutSize );
pTemp = Mpm_ManCellMapping( pAbc->pGia, pPars, Abc_FrameReadLibGen() );
Mpm_LibLutFree( pPars->pLib );
if ( pTemp == NULL )
@@ -29650,6 +29653,7 @@ int Abc_CommandAbc9If2( Abc_Frame_t * pAbc, int argc, char ** argv )
}
else
{
+ pPars->pLib = Mpm_LibLutSetSimple( nLutSize );
pNew = Mpm_ManLutMapping( pAbc->pGia, pPars );
Mpm_LibLutFree( pPars->pLib );
if ( pNew == NULL )
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)) );