Commit 71e11a3e by Alan Mishchenko

Improvements to technology mapping.

parent 7669c996
...@@ -193,11 +193,14 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep ...@@ -193,11 +193,14 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
if ( p->pPars->fTruth ) if ( p->pPars->fTruth )
{ {
// int nShared = pCut0->nLeaves + pCut1->nLeaves - pCut->nLeaves; // int nShared = pCut0->nLeaves + pCut1->nLeaves - pCut->nLeaves;
abctime clk = Abc_Clock(); abctime clk = 0;
if ( p->pPars->fVerbose )
clk = Abc_Clock();
if ( p->pPars->fUseTtPerm ) if ( p->pPars->fUseTtPerm )
fChange = If_CutComputeTruthPerm( p, pCut, pCut0R, pCut1R, fFunc0R, fFunc1R ); fChange = If_CutComputeTruthPerm( p, pCut, pCut0R, pCut1R, fFunc0R, fFunc1R );
else else
fChange = If_CutComputeTruth( p, pCut, pCut0, pCut1, pObj->fCompl0, pObj->fCompl1 ); fChange = If_CutComputeTruth( p, pCut, pCut0, pCut1, pObj->fCompl0, pObj->fCompl1 );
if ( p->pPars->fVerbose )
p->timeCache[4] += Abc_Clock() - clk; p->timeCache[4] += Abc_Clock() - clk;
if ( !p->pPars->fSkipCutFilter && fChange && If_CutFilter( pCutSet, pCut ) ) if ( !p->pPars->fSkipCutFilter && fChange && If_CutFilter( pCutSet, pCut ) )
continue; continue;
......
...@@ -111,7 +111,7 @@ int If_CutComputeTruth( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0, If_Cut_ ...@@ -111,7 +111,7 @@ int If_CutComputeTruth( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0, If_Cut_
Abc_TtStretch( pTruth1, pCut->nLeaves, pCut1->pLeaves, pCut1->nLeaves, pCut->pLeaves, pCut->nLeaves ); Abc_TtStretch( pTruth1, pCut->nLeaves, pCut1->pLeaves, pCut1->nLeaves, pCut->pLeaves, pCut->nLeaves );
fCompl = (pTruth0[0] & pTruth1[0] & 1); fCompl = (pTruth0[0] & pTruth1[0] & 1);
Abc_TtAnd( pTruth, pTruth0, pTruth1, nWords, fCompl ); Abc_TtAnd( pTruth, pTruth0, pTruth1, nWords, fCompl );
if ( p->pPars->fCutMin ) if ( p->pPars->fCutMin && (pCut0->nLeaves + pCut1->nLeaves > pCut->nLeaves || pCut0->nLeaves == 0 || pCut1->nLeaves == 0) )
{ {
nLeavesNew = Abc_TtMinBase( pTruth, pCut->pLeaves, pCut->nLeaves, pCut->nLeaves ); nLeavesNew = Abc_TtMinBase( pTruth, pCut->pLeaves, pCut->nLeaves, pCut->nLeaves );
if ( nLeavesNew < If_CutLeaveNum(pCut) ) if ( nLeavesNew < If_CutLeaveNum(pCut) )
...@@ -149,7 +149,7 @@ int If_CutComputeTruth( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0, If_Cut_ ...@@ -149,7 +149,7 @@ int If_CutComputeTruth( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0, If_Cut_
int If_CutComputeTruthPerm_int( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0, If_Cut_t * pCut1, int iCutFunc0, int iCutFunc1 ) int If_CutComputeTruthPerm_int( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0, If_Cut_t * pCut1, int iCutFunc0, int iCutFunc1 )
{ {
int fVerbose = 0; int fVerbose = 0;
abctime clk; abctime clk = 0;
int pPerm[IF_MAX_LUTSIZE]; int pPerm[IF_MAX_LUTSIZE];
int v, Place, fCompl, truthId, nLeavesNew, RetValue = 0; int v, Place, fCompl, truthId, nLeavesNew, RetValue = 0;
int nWords = Abc_TtWordNum( pCut->nLeaves ); int nWords = Abc_TtWordNum( pCut->nLeaves );
...@@ -211,8 +211,10 @@ if ( fVerbose ) ...@@ -211,8 +211,10 @@ if ( fVerbose )
} }
} }
// compute canonical form // compute canonical form
if ( p->pPars->fVerbose )
clk = Abc_Clock(); clk = Abc_Clock();
p->uCanonPhase = Abc_TtCanonicize( pTruth, pCut->nLeaves, p->pCanonPerm ); p->uCanonPhase = Abc_TtCanonicize( pTruth, pCut->nLeaves, p->pCanonPerm );
if ( p->pPars->fVerbose )
p->timeCache[3] += Abc_Clock() - clk; p->timeCache[3] += Abc_Clock() - clk;
for ( v = 0; v < (int)pCut->nLeaves; v++ ) for ( v = 0; v < (int)pCut->nLeaves; v++ )
pPerm[v] = Abc_LitNotCond( pCut->pLeaves[(int)p->pCanonPerm[v]], ((p->uCanonPhase>>v)&1) ); pPerm[v] = Abc_LitNotCond( pCut->pLeaves[(int)p->pCanonPerm[v]], ((p->uCanonPhase>>v)&1) );
...@@ -247,11 +249,14 @@ if ( fVerbose ) ...@@ -247,11 +249,14 @@ if ( fVerbose )
} }
int If_CutComputeTruthPerm( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0, If_Cut_t * pCut1, int iCutFunc0, int iCutFunc1 ) int If_CutComputeTruthPerm( If_Man_t * p, If_Cut_t * pCut, If_Cut_t * pCut0, If_Cut_t * pCut1, int iCutFunc0, int iCutFunc1 )
{ {
abctime clk = Abc_Clock(); abctime clk = 0;
int i, Num, nEntriesOld, RetValue; int i, Num, nEntriesOld, RetValue;
if ( pCut0->nLeaves + pCut1->nLeaves > pCut->nLeaves || iCutFunc0 < 2 || iCutFunc1 < 2 ) if ( pCut0->nLeaves + pCut1->nLeaves > pCut->nLeaves || iCutFunc0 < 2 || iCutFunc1 < 2 )
{ {
if ( p->pPars->fVerbose )
clk = Abc_Clock();
RetValue = If_CutComputeTruthPerm_int( p, pCut, pCut0, pCut1, iCutFunc0, iCutFunc1 ); RetValue = If_CutComputeTruthPerm_int( p, pCut, pCut0, pCut1, iCutFunc0, iCutFunc1 );
if ( p->pPars->fVerbose )
p->timeCache[0] += Abc_Clock() - clk; p->timeCache[0] += Abc_Clock() - clk;
return RetValue; return RetValue;
} }
...@@ -284,9 +289,11 @@ p->timeCache[0] += Abc_Clock() - clk; ...@@ -284,9 +289,11 @@ p->timeCache[0] += Abc_Clock() - clk;
} }
// printf( "Found: %d(%d) %d(%d) -> %d(%d)\n", iCutFunc0, pCut0->nLeaves, iCutFunc1, pCut0->nLeaves, pCut->iCutFunc, pCut->nLeaves ); // printf( "Found: %d(%d) %d(%d) -> %d(%d)\n", iCutFunc0, pCut0->nLeaves, iCutFunc1, pCut0->nLeaves, pCut->iCutFunc, pCut->nLeaves );
p->nCacheHits++; p->nCacheHits++;
p->timeCache[1] += Abc_Clock() - clk; //p->timeCache[1] += Abc_Clock() - clk;
return 0; return 0;
} }
if ( p->pPars->fVerbose )
clk = Abc_Clock();
p->nCacheMisses++; p->nCacheMisses++;
RetValue = If_CutComputeTruthPerm_int( p, pCut, pCut0, pCut1, iCutFunc0, iCutFunc1 ); RetValue = If_CutComputeTruthPerm_int( p, pCut, pCut0, pCut1, iCutFunc0, iCutFunc1 );
assert( RetValue == 0 ); assert( RetValue == 0 );
...@@ -300,6 +307,7 @@ p->timeCache[1] += Abc_Clock() - clk; ...@@ -300,6 +307,7 @@ p->timeCache[1] += Abc_Clock() - clk;
Vec_StrPush( p->vPairPerms, (char)Abc_Var2Lit((int)p->pCanonPerm[i], ((p->uCanonPhase>>i)&1)) ); Vec_StrPush( p->vPairPerms, (char)Abc_Var2Lit((int)p->pCanonPerm[i], ((p->uCanonPhase>>i)&1)) );
for ( i = (int)pCut0->nLeaves + (int)pCut1->nLeaves; i < (int)pCut->nLimit; i++ ) for ( i = (int)pCut0->nLeaves + (int)pCut1->nLeaves; i < (int)pCut->nLimit; i++ )
Vec_StrPush( p->vPairPerms, (char)-1 ); Vec_StrPush( p->vPairPerms, (char)-1 );
if ( p->pPars->fVerbose )
p->timeCache[2] += Abc_Clock() - clk; p->timeCache[2] += Abc_Clock() - clk;
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment