summaryrefslogtreecommitdiffstats
path: root/src/map/if/ifMan.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/if/ifMan.c')
-rw-r--r--src/map/if/ifMan.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/src/map/if/ifMan.c b/src/map/if/ifMan.c
index 939e5a7b..3034df67 100644
--- a/src/map/if/ifMan.c
+++ b/src/map/if/ifMan.c
@@ -64,23 +64,25 @@ If_Man_t * If_ManStart( If_Par_t * pPars )
// p->vMapped = Vec_PtrAlloc( 100 );
p->vTemp = Vec_PtrAlloc( 100 );
// prepare the memory manager
- p->nTruthWords = p->pPars->fTruth? If_CutTruthWords( p->pPars->nLutSize ) : 0;
+ p->vTtMem = p->pPars->fTruth? Vec_MemAllocForTT( p->pPars->nLutSize ) : NULL;
+ p->nTruth6Words= p->pPars->fTruth? Abc_Truth6WordNum( p->pPars->nLutSize ) : 0;
+// p->nTruthWords = p->pPars->fTruth? If_CutTruthWords( p->pPars->nLutSize ) : 0;
p->nPermWords = p->pPars->fUsePerm? If_CutPermWords( p->pPars->nLutSize ) : 0;
- p->nObjBytes = sizeof(If_Obj_t) + sizeof(int) * (p->pPars->nLutSize + p->nPermWords + p->nTruthWords);
- p->nCutBytes = sizeof(If_Cut_t) + sizeof(int) * (p->pPars->nLutSize + p->nPermWords + p->nTruthWords);
+ p->nObjBytes = sizeof(If_Obj_t) + sizeof(int) * (p->pPars->nLutSize + p->nPermWords/* + p->nTruthWords*/);
+ p->nCutBytes = sizeof(If_Cut_t) + sizeof(int) * (p->pPars->nLutSize + p->nPermWords/* + p->nTruthWords*/);
p->nSetBytes = sizeof(If_Set_t) + (sizeof(If_Cut_t *) + p->nCutBytes) * (p->pPars->nCutsMax + 1);
p->pMemObj = Mem_FixedStart( p->nObjBytes );
// p->pMemSet = Mem_FixedStart( p->nSetBytes );
// report expected memory usage
if ( p->pPars->fVerbose )
Abc_Print( 1, "K = %d. Memory (bytes): Truth = %4d. Cut = %4d. Obj = %4d. Set = %4d. CutMin = %s\n",
- p->pPars->nLutSize, 4 * p->nTruthWords, p->nCutBytes, p->nObjBytes, p->nSetBytes, p->pPars->fCutMin? "yes":"no" );
+ p->pPars->nLutSize, 8 * p->nTruth6Words, p->nCutBytes, p->nObjBytes, p->nSetBytes, p->pPars->fCutMin? "yes":"no" );
// room for temporary truth tables
- p->puTemp[0] = p->pPars->fTruth? ABC_ALLOC( unsigned, 4 * p->nTruthWords ) : NULL;
- p->puTemp[1] = p->puTemp[0] + p->nTruthWords;
- p->puTemp[2] = p->puTemp[1] + p->nTruthWords;
- p->puTemp[3] = p->puTemp[2] + p->nTruthWords;
- p->pCutTemp = (If_Cut_t *)ABC_ALLOC( char, p->nCutBytes );
+ p->puTemp[0] = p->pPars->fTruth? ABC_ALLOC( unsigned, 8 * p->nTruth6Words ) : NULL;
+ p->puTemp[1] = p->puTemp[0] + p->nTruth6Words*2;
+ p->puTemp[2] = p->puTemp[1] + p->nTruth6Words*2;
+ p->puTemp[3] = p->puTemp[2] + p->nTruth6Words*2;
+ p->puTempW = p->pPars->fTruth? ABC_ALLOC( word, p->nTruth6Words ) : NULL;
if ( pPars->fUseDsd )
{
// p->pNamDsd = Abc_NamStart( 1000, 20 );
@@ -144,6 +146,8 @@ void If_ManStop( If_Man_t * p )
// If_CluHashFindMedian( p );
// If_CluHashTableCheck( p );
}
+ if ( p->pPars->fVerbose && p->vTtMem )
+ printf( "Unique truth tables = %d. Memory = %.2f MB\n", Vec_MemEntryNum(p->vTtMem), Vec_MemMemory(p->vTtMem) / (1<<20) );
if ( p->pPars->fVerbose && p->nCutsUselessAll )
{
int i;
@@ -176,7 +180,6 @@ void If_ManStop( If_Man_t * p )
Vec_PtrFree( p->vCis );
Vec_PtrFree( p->vCos );
Vec_PtrFree( p->vObjs );
-// Vec_PtrFree( p->vMapped );
Vec_PtrFree( p->vTemp );
Vec_IntFreeP( &p->vCover );
Vec_WrdFreeP( &p->vAnds );
@@ -185,11 +188,13 @@ void If_ManStop( If_Man_t * p )
if ( p->vObjsRev ) Vec_PtrFree( p->vObjsRev );
if ( p->vLatchOrder ) Vec_PtrFree( p->vLatchOrder );
if ( p->vLags ) Vec_IntFree( p->vLags );
+ Vec_MemHashFree( p->vTtMem );
+ Vec_MemFreeP( &p->vTtMem );
Mem_FixedStop( p->pMemObj, 0 );
ABC_FREE( p->pMemCi );
ABC_FREE( p->pMemAnd );
ABC_FREE( p->puTemp[0] );
- ABC_FREE( p->pCutTemp );
+ ABC_FREE( p->puTempW );
// free pars memory
ABC_FREE( p->pPars->pTimesArr );
ABC_FREE( p->pPars->pTimesReq );
@@ -383,8 +388,6 @@ void If_ManSetupCut( If_Man_t * p, If_Cut_t * pCut )
pCut->pLeaves = (int *)(pCut + 1);
if ( p->pPars->fUsePerm )
pCut->pPerm = (char *)(pCut->pLeaves + p->pPars->nLutSize);
- if ( p->pPars->fTruth )
- pCut->pTruth = (unsigned *)pCut->pLeaves + p->pPars->nLutSize + p->nPermWords;
}
/**Function*************************************************************
@@ -435,17 +438,11 @@ void If_ManSetupCutTriv( If_Man_t * p, If_Cut_t * pCut, int ObjId )
pCut->uSign = If_ObjCutSign( pCut->pLeaves[0] );
if ( p->pPars->fUseDsd )
{
- pCut->iDsd = p->iNamVar;
+ pCut->iCutFunc = p->iNamVar;
pCut->pPerm[0] = 0;
}
// set up elementary truth table of the unit cut
- if ( p->pPars->fTruth )
- {
- int i, nTruthWords = If_CutTruthWords(pCut->nLimit);
- for ( i = 0; i < nTruthWords; i++ )
- If_CutTruth(pCut)[i] = 0xAAAAAAAA;
- }
-
+ pCut->iCutFunc = p->pPars->fTruth ? 2 : -1;
assert( pCut->pLeaves[0] < p->vObjs->nSize );
}
@@ -523,11 +520,9 @@ If_Set_t * If_ManSetupNodeCutSet( If_Man_t * p, If_Obj_t * pObj )
assert( pObj->pCutSet == NULL );
// pObj->pCutSet = (If_Set_t *)Mem_FixedEntryFetch( p->pMemSet );
// If_ManSetupSet( p, pObj->pCutSet );
-
pObj->pCutSet = If_ManCutSetFetch( p );
pObj->pCutSet->nCuts = 0;
pObj->pCutSet->nCutsMax = p->pPars->nCutsMax;
-
return pObj->pCutSet;
}