Commit b05ee943 by Alan Mishchenko

Improvements to Boolean matching.

parent ee727912
...@@ -15309,7 +15309,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -15309,7 +15309,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars->fEnableCheck07 ^= 1; pPars->fEnableCheck07 ^= 1;
break; break;
case 'i': case 'i':
pPars->fEnableCheck08 ^= 1; pPars->fUseCofVars ^= 1;
break; break;
case 'k': case 'k':
pPars->fUseDsdTune ^= 1; pPars->fUseDsdTune ^= 1;
...@@ -15376,7 +15376,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -15376,7 +15376,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars->fCutMin = 1; pPars->fCutMin = 1;
} }
if ( pPars->fEnableCheck07 + pPars->fEnableCheck08 + pPars->fUseDsdTune + (pPars->pLutStruct != NULL) > 1 ) if ( pPars->fEnableCheck07 + pPars->fUseCofVars + pPars->fUseDsdTune + (pPars->pLutStruct != NULL) > 1 )
{ {
Abc_Print( -1, "Only one additional check can be performed at the same time.\n" ); Abc_Print( -1, "Only one additional check can be performed at the same time.\n" );
return 1; return 1;
...@@ -15391,14 +15391,13 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -15391,14 +15391,13 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars->pFuncCell = If_CutPerformCheck07; pPars->pFuncCell = If_CutPerformCheck07;
pPars->fCutMin = 1; pPars->fCutMin = 1;
} }
if ( pPars->fEnableCheck08 ) if ( pPars->fUseCofVars )
{ {
if ( pPars->nLutSize < 6 || pPars->nLutSize > 8 ) if ( !(pPars->nLutSize & 1) )
{ {
Abc_Print( -1, "This feature only works for {6,7,8}-LUTs.\n" ); Abc_Print( -1, "This feature only works for odd-sized LUTs.\n" );
return 1; return 1;
} }
pPars->pFuncCell = If_CutPerformCheck08;
pPars->fCutMin = 1; pPars->fCutMin = 1;
} }
if ( pPars->fUseDsdTune ) if ( pPars->fUseDsdTune )
...@@ -15610,7 +15609,7 @@ usage: ...@@ -15610,7 +15609,7 @@ usage:
Abc_Print( -2, "\t-y : toggles delay optimization with recorded library [default = %s]\n", pPars->fUserRecLib? "yes": "no" ); Abc_Print( -2, "\t-y : toggles delay optimization with recorded library [default = %s]\n", pPars->fUserRecLib? "yes": "no" );
Abc_Print( -2, "\t-o : toggles using buffers to decouple combinational outputs [default = %s]\n", pPars->fUseBuffs? "yes": "no" ); Abc_Print( -2, "\t-o : toggles using buffers to decouple combinational outputs [default = %s]\n", pPars->fUseBuffs? "yes": "no" );
Abc_Print( -2, "\t-j : toggles enabling additional check [default = %s]\n", pPars->fEnableCheck07? "yes": "no" ); Abc_Print( -2, "\t-j : toggles enabling additional check [default = %s]\n", pPars->fEnableCheck07? "yes": "no" );
Abc_Print( -2, "\t-i : toggles enabling additional check [default = %s]\n", pPars->fEnableCheck08? "yes": "no" ); Abc_Print( -2, "\t-i : toggles using cofactoring variables [default = %s]\n", pPars->fUseCofVars? "yes": "no" );
Abc_Print( -2, "\t-k : toggles matching based on precomputed DSD manager [default = %s]\n", pPars->fUseDsdTune? "yes": "no" ); Abc_Print( -2, "\t-k : toggles matching based on precomputed DSD manager [default = %s]\n", pPars->fUseDsdTune? "yes": "no" );
Abc_Print( -2, "\t-t : toggles optimizing average rather than maximum level [default = %s]\n", pPars->fDoAverage? "yes": "no" ); Abc_Print( -2, "\t-t : toggles optimizing average rather than maximum level [default = %s]\n", pPars->fDoAverage? "yes": "no" );
Abc_Print( -2, "\t-n : toggles computing DSDs of the cut functions [default = %s]\n", pPars->fUseDsd? "yes": "no" ); Abc_Print( -2, "\t-n : toggles computing DSDs of the cut functions [default = %s]\n", pPars->fUseDsd? "yes": "no" );
...@@ -30984,7 +30983,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -30984,7 +30983,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
} }
pPars->pLutLib = (If_LibLut_t *)pAbc->pLibLut; pPars->pLutLib = (If_LibLut_t *)pAbc->pLibLut;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "KCFAGRDEWSTqalepmrsdbgxyojikfuztncvh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "KCFAGRDEWSTqalepmrsdbgxyojfuikztncvh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -31159,18 +31158,18 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -31159,18 +31158,18 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'j': case 'j':
pPars->fEnableCheck07 ^= 1; pPars->fEnableCheck07 ^= 1;
break; break;
case 'i':
pPars->fEnableCheck08 ^= 1;
break;
case 'k':
pPars->fUseDsdTune ^= 1;
break;
case 'f': case 'f':
pPars->fEnableCheck75 ^= 1; pPars->fEnableCheck75 ^= 1;
break; break;
case 'u': case 'u':
pPars->fEnableCheck75u ^= 1; pPars->fEnableCheck75u ^= 1;
break; break;
case 'i':
pPars->fUseCofVars ^= 1;
break;
case 'k':
pPars->fUseDsdTune ^= 1;
break;
case 'z': case 'z':
pPars->fDeriveLuts ^= 1; pPars->fDeriveLuts ^= 1;
break; break;
...@@ -31247,7 +31246,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -31247,7 +31246,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars->fCutMin = 1; pPars->fCutMin = 1;
} }
if ( pPars->fEnableCheck07 + pPars->fEnableCheck08 + pPars->fUseDsdTune + pPars->fEnableCheck75 + pPars->fEnableCheck75u + (pPars->pLutStruct != NULL) > 1 ) if ( pPars->fEnableCheck07 + pPars->fUseCofVars + pPars->fUseDsdTune + pPars->fEnableCheck75 + pPars->fEnableCheck75u + (pPars->pLutStruct != NULL) > 1 )
{ {
Abc_Print( -1, "Only one additional check can be performed at the same time.\n" ); Abc_Print( -1, "Only one additional check can be performed at the same time.\n" );
return 1; return 1;
...@@ -31262,14 +31261,13 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -31262,14 +31261,13 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars->pFuncCell = If_CutPerformCheck07; pPars->pFuncCell = If_CutPerformCheck07;
pPars->fCutMin = 1; pPars->fCutMin = 1;
} }
if ( pPars->fEnableCheck08 ) if ( pPars->fUseCofVars )
{ {
if ( pPars->nLutSize < 6 || pPars->nLutSize > 8 ) if ( !(pPars->nLutSize & 1) )
{ {
Abc_Print( -1, "This feature only works for {6,7,8}-LUTs.\n" ); Abc_Print( -1, "This feature only works for odd-sized LUTs.\n" );
return 1; return 1;
} }
pPars->pFuncCell = If_CutPerformCheck08;
pPars->fCutMin = 1; pPars->fCutMin = 1;
} }
if ( pPars->fUseDsdTune ) if ( pPars->fUseDsdTune )
...@@ -31439,7 +31437,7 @@ usage: ...@@ -31439,7 +31437,7 @@ usage:
sprintf(LutSize, "library" ); sprintf(LutSize, "library" );
else else
sprintf(LutSize, "%d", pPars->nLutSize ); sprintf(LutSize, "%d", pPars->nLutSize );
Abc_Print( -2, "usage: &if [-KCFAGRT num] [-DEW float] [-S str] [-qarlepmsdbgxyojikfuztncvh]\n" ); Abc_Print( -2, "usage: &if [-KCFAGRT num] [-DEW float] [-S str] [-qarlepmsdbgxyojfuikztncvh]\n" );
Abc_Print( -2, "\t performs FPGA technology mapping of the network\n" ); Abc_Print( -2, "\t performs FPGA technology mapping of the network\n" );
Abc_Print( -2, "\t-K num : the number of LUT inputs (2 < num < %d) [default = %s]\n", IF_MAX_LUTSIZE+1, LutSize ); Abc_Print( -2, "\t-K num : the number of LUT inputs (2 < num < %d) [default = %s]\n", IF_MAX_LUTSIZE+1, LutSize );
Abc_Print( -2, "\t-C num : the max number of priority cuts (0 < num < 2^12) [default = %d]\n", pPars->nCutsMax ); Abc_Print( -2, "\t-C num : the max number of priority cuts (0 < num < 2^12) [default = %d]\n", pPars->nCutsMax );
...@@ -31467,9 +31465,9 @@ usage: ...@@ -31467,9 +31465,9 @@ usage:
Abc_Print( -2, "\t-y : toggles delay optimization with recorded library [default = %s]\n", pPars->fUserRecLib? "yes": "no" ); Abc_Print( -2, "\t-y : toggles delay optimization with recorded library [default = %s]\n", pPars->fUserRecLib? "yes": "no" );
Abc_Print( -2, "\t-o : toggles using buffers to decouple combinational outputs [default = %s]\n", pPars->fUseBuffs? "yes": "no" ); Abc_Print( -2, "\t-o : toggles using buffers to decouple combinational outputs [default = %s]\n", pPars->fUseBuffs? "yes": "no" );
Abc_Print( -2, "\t-j : toggles enabling additional check [default = %s]\n", pPars->fEnableCheck07? "yes": "no" ); Abc_Print( -2, "\t-j : toggles enabling additional check [default = %s]\n", pPars->fEnableCheck07? "yes": "no" );
Abc_Print( -2, "\t-i : toggles enabling additional check [default = %s]\n", pPars->fEnableCheck08? "yes": "no" );
Abc_Print( -2, "\t-f : toggles enabling additional check [default = %s]\n", pPars->fEnableCheck75? "yes": "no" ); Abc_Print( -2, "\t-f : toggles enabling additional check [default = %s]\n", pPars->fEnableCheck75? "yes": "no" );
Abc_Print( -2, "\t-u : toggles enabling additional check [default = %s]\n", pPars->fEnableCheck75u? "yes": "no" ); Abc_Print( -2, "\t-u : toggles enabling additional check [default = %s]\n", pPars->fEnableCheck75u? "yes": "no" );
Abc_Print( -2, "\t-i : toggles using cofactoring variables [default = %s]\n", pPars->fUseCofVars? "yes": "no" );
Abc_Print( -2, "\t-k : toggles matching based on precomputed DSD manager [default = %s]\n", pPars->fUseDsdTune? "yes": "no" ); Abc_Print( -2, "\t-k : toggles matching based on precomputed DSD manager [default = %s]\n", pPars->fUseDsdTune? "yes": "no" );
Abc_Print( -2, "\t-z : toggles deriving LUTs when mapping into LUT structures [default = %s]\n", pPars->fDeriveLuts? "yes": "no" ); Abc_Print( -2, "\t-z : toggles deriving LUTs when mapping into LUT structures [default = %s]\n", pPars->fDeriveLuts? "yes": "no" );
Abc_Print( -2, "\t-t : toggles optimizing average rather than maximum level [default = %s]\n", pPars->fDoAverage? "yes": "no" ); Abc_Print( -2, "\t-t : toggles optimizing average rather than maximum level [default = %s]\n", pPars->fDoAverage? "yes": "no" );
...@@ -32255,7 +32253,7 @@ usage: ...@@ -32255,7 +32253,7 @@ usage:
Abc_Print( -2, "\t-L num : the fanout limit for coarsening XOR/MUX (num >= 2) [default = %d]\n", pPars->nCoarseLimit ); Abc_Print( -2, "\t-L num : the fanout limit for coarsening XOR/MUX (num >= 2) [default = %d]\n", pPars->nCoarseLimit );
Abc_Print( -2, "\t-E num : the area/edge tradeoff parameter (0 <= num <= 100) [default = %d]\n", pPars->nAreaTuner ); Abc_Print( -2, "\t-E num : the area/edge tradeoff parameter (0 <= num <= 100) [default = %d]\n", pPars->nAreaTuner );
Abc_Print( -2, "\t-D num : sets the delay constraint for the mapping [default = %s]\n", Buffer ); Abc_Print( -2, "\t-D num : sets the delay constraint for the mapping [default = %s]\n", Buffer );
Abc_Print( -2, "\t-M num : LUT size for the cofactoring (0 <= num <= 100) [default = %d]\n", pPars->nLutSizeMux ); Abc_Print( -2, "\t-M num : LUT size when cofactoring is performed (0 <= num <= 100) [default = %d]\n", pPars->nLutSizeMux );
// Abc_Print( -2, "\t-a : toggles area-oriented mapping [default = %s]\n", pPars->fAreaOnly? "yes": "no" ); // Abc_Print( -2, "\t-a : toggles area-oriented mapping [default = %s]\n", pPars->fAreaOnly? "yes": "no" );
Abc_Print( -2, "\t-e : toggles edge vs node minimization [default = %s]\n", pPars->fOptEdge? "yes": "no" ); Abc_Print( -2, "\t-e : toggles edge vs node minimization [default = %s]\n", pPars->fOptEdge? "yes": "no" );
Abc_Print( -2, "\t-k : toggles coarsening the subject graph [default = %s]\n", pPars->fCoarsen? "yes": "no" ); Abc_Print( -2, "\t-k : toggles coarsening the subject graph [default = %s]\n", pPars->fCoarsen? "yes": "no" );
...@@ -131,6 +131,7 @@ struct If_Par_t_ ...@@ -131,6 +131,7 @@ struct If_Par_t_
int fEnableCheck75u;// enable additional checking int fEnableCheck75u;// enable additional checking
int fUseDsd; // compute DSD of the cut functions int fUseDsd; // compute DSD of the cut functions
int fUseDsdTune; // use matching based on precomputed manager int fUseDsdTune; // use matching based on precomputed manager
int fUseCofVars; // use cofactoring variables
int fUseTtPerm; // compute truth tables of the cut functions int fUseTtPerm; // compute truth tables of the cut functions
int fDeriveLuts; // enables deriving LUT structures int fDeriveLuts; // enables deriving LUT structures
int fDoAverage; // optimize average rather than maximum level int fDoAverage; // optimize average rather than maximum level
...@@ -242,6 +243,7 @@ struct If_Man_t_ ...@@ -242,6 +243,7 @@ struct If_Man_t_
Vec_Wec_t * vTtIsops[IF_MAX_FUNC_LUTSIZE+1]; // mapping of truth table into DSD Vec_Wec_t * vTtIsops[IF_MAX_FUNC_LUTSIZE+1]; // mapping of truth table into DSD
Vec_Int_t * vTtDsds[IF_MAX_FUNC_LUTSIZE+1]; // mapping of truth table into DSD Vec_Int_t * vTtDsds[IF_MAX_FUNC_LUTSIZE+1]; // mapping of truth table into DSD
Vec_Str_t * vTtPerms[IF_MAX_FUNC_LUTSIZE+1]; // mapping of truth table into permutations Vec_Str_t * vTtPerms[IF_MAX_FUNC_LUTSIZE+1]; // mapping of truth table into permutations
Vec_Str_t * vTtVars[IF_MAX_FUNC_LUTSIZE+1]; // mapping of truth table into selected vars
Hash_IntMan_t * vPairHash; // hashing pairs of truth tables Hash_IntMan_t * vPairHash; // hashing pairs of truth tables
Vec_Int_t * vPairRes; // resulting truth table Vec_Int_t * vPairRes; // resulting truth table
Vec_Str_t * vPairPerms; // resulting permutation Vec_Str_t * vPairPerms; // resulting permutation
......
...@@ -754,7 +754,7 @@ void If_CutSort( If_Man_t * p, If_Set_t * pCutSet, If_Cut_t * pCut ) ...@@ -754,7 +754,7 @@ void If_CutSort( If_Man_t * p, If_Set_t * pCutSet, If_Cut_t * pCut )
if ( !pCut->fUseless && if ( !pCut->fUseless &&
(p->pPars->fUseDsd || p->pPars->fUseBat || (p->pPars->fUseDsd || p->pPars->fUseBat ||
p->pPars->pLutStruct || p->pPars->fUserRecLib || p->pPars->pLutStruct || p->pPars->fUserRecLib ||
p->pPars->fEnableCheck07 || p->pPars->fEnableCheck08 || p->pPars->fEnableCheck07 || p->pPars->fUseCofVars ||
p->pPars->fUseDsdTune || p->pPars->fEnableCheck75 || p->pPars->fUseDsdTune || p->pPars->fEnableCheck75 ||
p->pPars->fEnableCheck75u) ) p->pPars->fEnableCheck75u) )
{ {
......
...@@ -2410,7 +2410,8 @@ void Id_DsdManTuneStr1( If_DsdMan_t * p, char * pStruct, int nConfls, int fVerbo ...@@ -2410,7 +2410,8 @@ void Id_DsdManTuneStr1( If_DsdMan_t * p, char * pStruct, int nConfls, int fVerbo
pProgress = Extra_ProgressBarStart( stdout, Vec_PtrSize(&p->vObjs) ); pProgress = Extra_ProgressBarStart( stdout, Vec_PtrSize(&p->vObjs) );
If_DsdVecForEachObjStart( &p->vObjs, pObj, i, p->nObjsPrev ) If_DsdVecForEachObjStart( &p->vObjs, pObj, i, p->nObjsPrev )
{ {
Extra_ProgressBarUpdate( pProgress, i, NULL ); if ( (i & 0xFF) == 0 )
Extra_ProgressBarUpdate( pProgress, i, NULL );
nVars = If_DsdObjSuppSize(pObj); nVars = If_DsdObjSuppSize(pObj);
if ( nVars <= LutSize ) if ( nVars <= LutSize )
continue; continue;
...@@ -2574,7 +2575,7 @@ void Id_DsdManTuneStr( If_DsdMan_t * p, char * pStruct, int nConfls, int nProcs, ...@@ -2574,7 +2575,7 @@ void Id_DsdManTuneStr( If_DsdMan_t * p, char * pStruct, int nConfls, int nProcs,
} }
for ( k = iCurrentObj; k < Vec_PtrSize(&p->vObjs); k++ ) for ( k = iCurrentObj; k < Vec_PtrSize(&p->vObjs); k++ )
{ {
if ( (k & 0x3FF) == 0 ) if ( (k & 0xFF) == 0 )
Extra_ProgressBarUpdate( pProgress, k, NULL ); Extra_ProgressBarUpdate( pProgress, k, NULL );
pObj = If_DsdVecObj( &p->vObjs, k ); pObj = If_DsdVecObj( &p->vObjs, k );
nVars = If_DsdObjSuppSize(pObj); nVars = If_DsdObjSuppSize(pObj);
......
...@@ -125,6 +125,17 @@ If_Man_t * If_ManStart( If_Par_t * pPars ) ...@@ -125,6 +125,17 @@ If_Man_t * If_ManStart( If_Par_t * pPars )
p->vPairRes = Vec_IntAlloc( 1000 ); p->vPairRes = Vec_IntAlloc( 1000 );
Vec_IntPush( p->vPairRes, -1 ); Vec_IntPush( p->vPairRes, -1 );
} }
if ( pPars->fUseCofVars )
{
for ( v = 6; v <= Abc_MaxInt(6,p->pPars->nLutSize); v++ )
{
p->vTtVars[v] = Vec_StrAlloc( 1000 );
Vec_StrPush( p->vTtVars[v], 0 );
Vec_StrPush( p->vTtVars[v], 0 );
}
for ( v = 0; v < 6; v++ )
p->vTtVars[v] = p->vTtVars[6];
}
if ( pPars->fUseBat ) if ( pPars->fUseBat )
{ {
// abctime clk = Abc_Clock(); // abctime clk = Abc_Clock();
...@@ -209,8 +220,8 @@ void If_ManStop( If_Man_t * p ) ...@@ -209,8 +220,8 @@ void If_ManStop( If_Man_t * p )
{ {
for ( i = 0; i <= 16; i++ ) for ( i = 0; i <= 16; i++ )
if ( p->nCutsUseless[i] ) if ( p->nCutsUseless[i] )
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 %2d = %9d (out of %9d) (%6.2f %%)\n", i, p->nCutsUseless[i], p->nCutsCount[i], 100.0*p->nCutsUseless[i]/Abc_MaxInt(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) ); Abc_Print( 1, "Useless cuts all = %9d (out of %9d) (%6.2f %%)\n", p->nCutsUselessAll, p->nCutsCountAll, 100.0*p->nCutsUselessAll/Abc_MaxInt(p->nCutsCountAll,1) );
} }
// if ( p->pPars->fVerbose && p->nCuts5 ) // if ( p->pPars->fVerbose && p->nCuts5 )
// Abc_Print( 1, "Statistics about 5-cuts: Total = %d Non-decomposable = %d (%.2f %%)\n", p->nCuts5, p->nCuts5-p->nCuts5a, 100.0*(p->nCuts5-p->nCuts5a)/p->nCuts5 ); // Abc_Print( 1, "Statistics about 5-cuts: Total = %d Non-decomposable = %d (%.2f %%)\n", p->nCuts5, p->nCuts5-p->nCuts5a, 100.0*(p->nCuts5-p->nCuts5a)/p->nCuts5 );
...@@ -235,6 +246,8 @@ void If_ManStop( If_Man_t * p ) ...@@ -235,6 +246,8 @@ void If_ManStop( If_Man_t * p )
Vec_IntFreeP( &p->vTtDsds[i] ); Vec_IntFreeP( &p->vTtDsds[i] );
for ( i = 6; i <= Abc_MaxInt(6,p->pPars->nLutSize); i++ ) for ( i = 6; i <= Abc_MaxInt(6,p->pPars->nLutSize); i++ )
Vec_StrFreeP( &p->vTtPerms[i] ); Vec_StrFreeP( &p->vTtPerms[i] );
for ( i = 6; i <= Abc_MaxInt(6,p->pPars->nLutSize); i++ )
Vec_StrFreeP( &p->vTtVars[i] );
Vec_IntFreeP( &p->vCutData ); Vec_IntFreeP( &p->vCutData );
Vec_IntFreeP( &p->vPairRes ); Vec_IntFreeP( &p->vPairRes );
Vec_StrFreeP( &p->vPairPerms ); Vec_StrFreeP( &p->vPairPerms );
......
...@@ -270,6 +270,25 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep ...@@ -270,6 +270,25 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
p->nCutsCountAll++; p->nCutsCountAll++;
p->nCutsCount[pCut->nLeaves]++; p->nCutsCount[pCut->nLeaves]++;
} }
else if ( p->pPars->fUseCofVars )
{
extern int Abc_TtCheckCondDepTest( word * pTruth, int nVars, int nSuppLim );
int iCofVar = -1, truthId = Abc_Lit2Var(pCut->iCutFunc);
if ( truthId >= Vec_StrSize(p->vTtVars[pCut->nLeaves]) || Vec_StrEntry(p->vTtVars[pCut->nLeaves], truthId) == (char)-1 )
{
while ( truthId >= Vec_StrSize(p->vTtVars[pCut->nLeaves]) )
Vec_StrPush( p->vTtVars[pCut->nLeaves], (char)-1 );
iCofVar = Abc_TtCheckCondDep( If_CutTruthWR(p, pCut), pCut->nLeaves, p->pPars->nLutSize / 2 );
Vec_StrWriteEntry( p->vTtVars[pCut->nLeaves], truthId, (char)iCofVar );
}
iCofVar = Vec_StrEntry(p->vTtVars[pCut->nLeaves], truthId);
assert( iCofVar >= 0 && iCofVar <= (int)pCut->nLeaves );
pCut->fUseless = (int)(iCofVar == (int)pCut->nLeaves && pCut->nLeaves > 0);
p->nCutsUselessAll += pCut->fUseless;
p->nCutsUseless[pCut->nLeaves] += pCut->fUseless;
p->nCutsCountAll++;
p->nCutsCount[pCut->nLeaves]++;
}
} }
// compute the application-specific cost and depth // compute the application-specific cost and depth
......
...@@ -1011,6 +1011,75 @@ static inline int Abc_Tt6SupportAndSize( word t, int nVars, int * pSuppSize ) ...@@ -1011,6 +1011,75 @@ static inline int Abc_Tt6SupportAndSize( word t, int nVars, int * pSuppSize )
return Supp; return Supp;
} }
/**Function*************************************************************
Synopsis [Checks if there is a var whose both cofs have supp <= nSuppLim.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static inline int Abc_TtCheckCondDep2( word * pTruth, int nVars, int nSuppLim )
{
int v, d, nWords = Abc_TtWordNum(nVars);
if ( nVars <= nSuppLim + 1 )
return 0;
for ( v = 0; v < nVars; v++ )
{
int nDep0 = 0, nDep1 = 0;
for ( d = 0; d < nVars; d++ )
{
if ( v == d )
continue;
if ( v < d )
{
nDep0 += !Abc_TtCheckEqualCofs( pTruth, nWords, v, d, 0, 2 );
nDep1 += !Abc_TtCheckEqualCofs( pTruth, nWords, v, d, 1, 3 );
}
else // if ( v > d )
{
nDep0 += !Abc_TtCheckEqualCofs( pTruth, nWords, d, v, 0, 1 );
nDep1 += !Abc_TtCheckEqualCofs( pTruth, nWords, d, v, 2, 3 );
}
if ( nDep0 > nSuppLim || nDep1 > nSuppLim )
break;
}
if ( d == nVars )
return v;
}
return nVars;
}
static inline int Abc_TtCheckCondDep( word * pTruth, int nVars, int nSuppLim )
{
int nVarsMax = 12;
word Cof0[64], Cof1[64]; // pow( 2, nVarsMax-6 )
int v, d, nWords = Abc_TtWordNum(nVars);
assert( nVars <= nVarsMax );
if ( nVars <= nSuppLim + 1 )
return 0;
for ( v = 0; v < nVars; v++ )
{
int nDep0 = 0, nDep1 = 0;
Abc_TtCofactor0p( Cof0, pTruth, nWords, v );
Abc_TtCofactor1p( Cof1, pTruth, nWords, v );
for ( d = 0; d < nVars; d++ )
{
if ( v == d )
continue;
nDep0 += Abc_TtHasVar( Cof0, nVars, d );
nDep1 += Abc_TtHasVar( Cof1, nVars, d );
if ( nDep0 > nSuppLim || nDep1 > nSuppLim )
break;
}
if ( d == nVars )
return v;
}
return nVars;
}
/**Function************************************************************* /**Function*************************************************************
......
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