DSD manager.

This commit is contained in:
Alan Mishchenko
2012-11-19 23:42:05 -08:00
parent d671adbb86
commit ffbe3bc576
8 changed files with 525 additions and 24 deletions
+4 -2
View File
@@ -35,7 +35,7 @@
#include "misc/mem/mem.h"
#include "misc/tim/tim.h"
#include "misc/util/utilNam.h"
#include "opt/dau/dau.h"
ABC_NAMESPACE_HEADER_START
@@ -189,6 +189,7 @@ struct If_Man_t_
Vec_Int_t * vSwitching; // switching activity of each node
Vec_Int_t ** pDriverCuts; // temporary driver cuts
int pPerm[3][IF_MAX_LUTSIZE]; // permutations
unsigned uSharedMask; // mask of shared variables
int nShared; // the number of shared variables
// SOP balancing
Vec_Int_t * vCover; // used to compute ISOP
@@ -218,8 +219,9 @@ struct If_Man_t_
int nCutsCount[32];
int nCutsCountAll;
int nCutsUselessAll;
Abc_Nam_t * pNamDsd;
// Abc_Nam_t * pNamDsd;
int iNamVar;
Dss_Man_t * pDsdMan;
// timing manager
Tim_Man_t * pManTim;
+3
View File
@@ -418,11 +418,13 @@ int If_CutMerge( If_Man_t * p, If_Cut_t * pC0, If_Cut_t * pC1, If_Cut_t * pC )
p->nShared = nLimit;
pC->nLeaves = nLimit;
pC->uSign = pC0->uSign | pC1->uSign;
p->uSharedMask = Abc_InfoMask( nLimit );
return 1;
}
// compare two cuts with different numbers
i = k = c = s = 0;
p->uSharedMask = 0;
while ( 1 )
{
if ( c == nLimit ) return 0;
@@ -440,6 +442,7 @@ int If_CutMerge( If_Man_t * p, If_Cut_t * pC0, If_Cut_t * pC1, If_Cut_t * pC )
}
else
{
p->uSharedMask |= (1 << c);
p->pPerm[0][i] = p->pPerm[1][k] = p->pPerm[2][s++] = c;
pC->pLeaves[c++] = pC0->pLeaves[i++]; k++;
if ( i == nSizeC0 ) goto FlushCut1;
+13 -4
View File
@@ -83,8 +83,10 @@ If_Man_t * If_ManStart( If_Par_t * pPars )
p->pCutTemp = (If_Cut_t *)ABC_ALLOC( char, p->nCutBytes );
if ( pPars->fUseDsd )
{
p->pNamDsd = Abc_NamStart( 1000, 20 );
p->iNamVar = Abc_NamStrFindOrAdd( p->pNamDsd, "a", NULL );
// p->pNamDsd = Abc_NamStart( 1000, 20 );
// p->iNamVar = Abc_NamStrFindOrAdd( p->pNamDsd, "a", NULL );
p->pDsdMan = Dss_ManAlloc( pPars->nLutSize );
p->iNamVar = 2;
}
// create the constant node
@@ -150,8 +152,9 @@ void If_ManStop( If_Man_t * p )
Abc_Print( 1, "Useless cuts %2d = %9d (out of %9d) (%6.2f %%)\n", i, p->nCutsUseless[i], p->nCutsCount[i], 100.0*p->nCutsUseless[i]/(p->nCutsCount[i]+1) );
Abc_Print( 1, "Useless cuts all = %9d (out of %9d) (%6.2f %%)\n", p->nCutsUselessAll, p->nCutsCountAll, 100.0*p->nCutsUselessAll/(p->nCutsCountAll+1) );
}
if ( p->pNamDsd )
if ( p->pPars->fUseDsd )
{
/*
if ( p->pPars->fVerbose )
Abc_Print( 1, "Number of unique entries in the DSD table = %d. Memory = %.1f MB.\n",
Abc_NamObjNumMax(p->pNamDsd), 1.0*Abc_NamMemAlloc(p->pNamDsd)/(1<<20) );
@@ -161,6 +164,8 @@ void If_ManStop( If_Man_t * p )
Abc_PrintTime( 1, "Time3", s_TimeComp[3] );
// Abc_NamPrint( p->pNamDsd );
Abc_NamStop( p->pNamDsd );
*/
Dss_ManFree( p->pDsdMan );
}
// Abc_PrintTime( 1, "Truth", p->timeTruth );
// Abc_Print( 1, "Small support = %d.\n", p->nSmallSupp );
@@ -427,7 +432,11 @@ void If_ManSetupCutTriv( If_Man_t * p, If_Cut_t * pCut, int ObjId )
pCut->nLeaves = 1;
pCut->pLeaves[0] = p->pPars->fLiftLeaves? (ObjId << 8) : ObjId;
pCut->uSign = If_ObjCutSign( pCut->pLeaves[0] );
pCut->iDsd = p->iNamVar;
if ( p->pPars->fUseDsd )
{
pCut->iDsd = p->iNamVar;
pCut->pPerm[0] = 0;
}
// set up elementary truth table of the unit cut
if ( p->pPars->fTruth )
{
+19
View File
@@ -277,6 +277,10 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
}
if ( p->pPars->fUseDsd )
{
int j, iDsd[2] = { Abc_LitNotCond(pCut0->iDsd, pObj->fCompl0), Abc_LitNotCond(pCut1->iDsd, pObj->fCompl1) };
int nFans[2] = { pCut0->nLeaves, pCut1->nLeaves };
int Fans[2][DAU_MAX_VAR], * pFans[2] = { Fans[0], Fans[1] };
/*
char * pName = Dau_DsdMerge(
Abc_NamStr(p->pNamDsd, pCut0->iDsd),
If_CutPerm0(pCut, pCut0),
@@ -284,6 +288,21 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
If_CutPerm1(pCut, pCut1),
pObj->fCompl0, pObj->fCompl1, pCut->nLimit );
pCut->iDsd = Abc_NamStrFindOrAdd( p->pNamDsd, pName, NULL );
*/
// create fanins
for ( j = 0; j < (int)pCut0->nLeaves; j++ )
pFans[0][j] = Abc_Lit2Lit( p->pPerm[0], (int)pCut0->pPerm[j] );
for ( j = 0; j < (int)pCut1->nLeaves; j++ )
pFans[1][j] = Abc_Lit2Lit( p->pPerm[1], (int)pCut1->pPerm[j] );
// canonicize
if ( iDsd[0] > iDsd[1] )
{
ABC_SWAP( int, iDsd[0], iDsd[1] );
ABC_SWAP( int, nFans[0], nFans[1] );
ABC_SWAP( int *, pFans[0], pFans[1] );
}
// derive new DSD
pCut->iDsd = Dss_ManMerge( p->pDsdMan, iDsd, nFans, pFans, p->uSharedMask, pCut->nLimit, pCut->pPerm );
}
// compute the application-specific cost and depth