mirror of https://github.com/YosysHQ/abc.git
Experiment with cost functions.
This commit is contained in:
parent
581c58b9c4
commit
0d0063f7de
|
|
@ -878,7 +878,7 @@ extern ABC_DLL void Abc_NodeMffcConeSupp( Abc_Obj_t * pNode, Vec_P
|
||||||
extern ABC_DLL int Abc_NodeDeref_rec( Abc_Obj_t * pNode );
|
extern ABC_DLL int Abc_NodeDeref_rec( Abc_Obj_t * pNode );
|
||||||
extern ABC_DLL int Abc_NodeRef_rec( Abc_Obj_t * pNode );
|
extern ABC_DLL int Abc_NodeRef_rec( Abc_Obj_t * pNode );
|
||||||
/*=== abcRefactor.c ==========================================================*/
|
/*=== abcRefactor.c ==========================================================*/
|
||||||
extern ABC_DLL int Abc_NtkRefactor( Abc_Ntk_t * pNtk, int nNodeSizeMax, int nConeSizeMax, int fUpdateLevel, int fUseZeros, int fUseDcs, int fVerbose );
|
extern ABC_DLL int Abc_NtkRefactor( Abc_Ntk_t * pNtk, int nNodeSizeMax, int nMinSaved, int nConeSizeMax, int fUpdateLevel, int fUseZeros, int fUseDcs, int fVerbose );
|
||||||
/*=== abcRewrite.c ==========================================================*/
|
/*=== abcRewrite.c ==========================================================*/
|
||||||
extern ABC_DLL int Abc_NtkRewrite( Abc_Ntk_t * pNtk, int fUpdateLevel, int fUseZeros, int fVerbose, int fVeryVerbose, int fPlaceEnable );
|
extern ABC_DLL int Abc_NtkRewrite( Abc_Ntk_t * pNtk, int fUpdateLevel, int fUseZeros, int fVerbose, int fVeryVerbose, int fPlaceEnable );
|
||||||
/*=== abcSat.c ==========================================================*/
|
/*=== abcSat.c ==========================================================*/
|
||||||
|
|
|
||||||
|
|
@ -7464,22 +7464,24 @@ int Abc_CommandRefactor( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc), * pDup;
|
Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc), * pDup;
|
||||||
int c, RetValue;
|
int c, RetValue;
|
||||||
int nNodeSizeMax;
|
int nNodeSizeMax;
|
||||||
|
int nMinSaved;
|
||||||
int nConeSizeMax;
|
int nConeSizeMax;
|
||||||
int fUpdateLevel;
|
int fUpdateLevel;
|
||||||
int fUseZeros;
|
int fUseZeros;
|
||||||
int fUseDcs;
|
int fUseDcs;
|
||||||
int fVerbose;
|
int fVerbose;
|
||||||
extern int Abc_NtkRefactor( Abc_Ntk_t * pNtk, int nNodeSizeMax, int nConeSizeMax, int fUpdateLevel, int fUseZeros, int fUseDcs, int fVerbose );
|
extern int Abc_NtkRefactor( Abc_Ntk_t * pNtk, int nNodeSizeMax, int nMinSaved, int nConeSizeMax, int fUpdateLevel, int fUseZeros, int fUseDcs, int fVerbose );
|
||||||
|
|
||||||
// set defaults
|
// set defaults
|
||||||
nNodeSizeMax = 10;
|
nNodeSizeMax = 10;
|
||||||
|
nMinSaved = 1;
|
||||||
nConeSizeMax = 16;
|
nConeSizeMax = 16;
|
||||||
fUpdateLevel = 1;
|
fUpdateLevel = 1;
|
||||||
fUseZeros = 0;
|
fUseZeros = 0;
|
||||||
fUseDcs = 0;
|
fUseDcs = 0;
|
||||||
fVerbose = 0;
|
fVerbose = 0;
|
||||||
Extra_UtilGetoptReset();
|
Extra_UtilGetoptReset();
|
||||||
while ( ( c = Extra_UtilGetopt( argc, argv, "Nlzvh" ) ) != EOF )
|
while ( ( c = Extra_UtilGetopt( argc, argv, "NMClzvh" ) ) != EOF )
|
||||||
{
|
{
|
||||||
switch ( c )
|
switch ( c )
|
||||||
{
|
{
|
||||||
|
|
@ -7494,6 +7496,17 @@ int Abc_CommandRefactor( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
if ( nNodeSizeMax < 0 )
|
if ( nNodeSizeMax < 0 )
|
||||||
goto usage;
|
goto usage;
|
||||||
break;
|
break;
|
||||||
|
case 'M':
|
||||||
|
if ( globalUtilOptind >= argc )
|
||||||
|
{
|
||||||
|
Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" );
|
||||||
|
goto usage;
|
||||||
|
}
|
||||||
|
nMinSaved = atoi(argv[globalUtilOptind]);
|
||||||
|
globalUtilOptind++;
|
||||||
|
if ( nMinSaved < 0 )
|
||||||
|
goto usage;
|
||||||
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
if ( globalUtilOptind >= argc )
|
if ( globalUtilOptind >= argc )
|
||||||
{
|
{
|
||||||
|
|
@ -7523,6 +7536,10 @@ int Abc_CommandRefactor( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
goto usage;
|
goto usage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( fUseZeros )
|
||||||
|
nMinSaved = 0;
|
||||||
|
if ( nMinSaved == 0 )
|
||||||
|
fUseZeros = 1;
|
||||||
|
|
||||||
if ( pNtk == NULL )
|
if ( pNtk == NULL )
|
||||||
{
|
{
|
||||||
|
|
@ -7553,7 +7570,7 @@ int Abc_CommandRefactor( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
|
|
||||||
// modify the current network
|
// modify the current network
|
||||||
pDup = Abc_NtkDup( pNtk );
|
pDup = Abc_NtkDup( pNtk );
|
||||||
RetValue = Abc_NtkRefactor( pNtk, nNodeSizeMax, nConeSizeMax, fUpdateLevel, fUseZeros, fUseDcs, fVerbose );
|
RetValue = Abc_NtkRefactor( pNtk, nNodeSizeMax, nMinSaved, nConeSizeMax, fUpdateLevel, fUseZeros, fUseDcs, fVerbose );
|
||||||
if ( RetValue == -1 )
|
if ( RetValue == -1 )
|
||||||
{
|
{
|
||||||
Abc_FrameReplaceCurrentNetwork( pAbc, pDup );
|
Abc_FrameReplaceCurrentNetwork( pAbc, pDup );
|
||||||
|
|
@ -7571,9 +7588,10 @@ int Abc_CommandRefactor( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
usage:
|
usage:
|
||||||
Abc_Print( -2, "usage: refactor [-N <num>] [-lzvh]\n" );
|
Abc_Print( -2, "usage: refactor [-NM <num>] [-lzvh]\n" );
|
||||||
Abc_Print( -2, "\t performs technology-independent refactoring of the AIG\n" );
|
Abc_Print( -2, "\t performs technology-independent refactoring of the AIG\n" );
|
||||||
Abc_Print( -2, "\t-N <num> : the max support of the collapsed node [default = %d]\n", nNodeSizeMax );
|
Abc_Print( -2, "\t-N <num> : the max support of the collapsed node [default = %d]\n", nNodeSizeMax );
|
||||||
|
Abc_Print( -2, "\t-M <num> : the min number of nodes saved after one step (0 <= num) [default = %d]\n", nMinSaved );
|
||||||
// Abc_Print( -2, "\t-C <num> : the max support of the containing cone [default = %d]\n", nConeSizeMax );
|
// Abc_Print( -2, "\t-C <num> : the max support of the containing cone [default = %d]\n", nConeSizeMax );
|
||||||
Abc_Print( -2, "\t-l : toggle preserving the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" );
|
Abc_Print( -2, "\t-l : toggle preserving the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" );
|
||||||
Abc_Print( -2, "\t-z : toggle using zero-cost replacements [default = %s]\n", fUseZeros? "yes": "no" );
|
Abc_Print( -2, "\t-z : toggle using zero-cost replacements [default = %s]\n", fUseZeros? "yes": "no" );
|
||||||
|
|
@ -7701,22 +7719,24 @@ int Abc_CommandResubstitute( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
int nCutsMax;
|
int nCutsMax;
|
||||||
int nNodesMax;
|
int nNodesMax;
|
||||||
int nLevelsOdc;
|
int nLevelsOdc;
|
||||||
|
int nMinSaved;
|
||||||
int fUpdateLevel;
|
int fUpdateLevel;
|
||||||
int fUseZeros;
|
int fUseZeros;
|
||||||
int fVerbose;
|
int fVerbose;
|
||||||
int fVeryVerbose;
|
int fVeryVerbose;
|
||||||
extern int Abc_NtkResubstitute( Abc_Ntk_t * pNtk, int nCutsMax, int nNodesMax, int nLevelsOdc, int fUpdateLevel, int fVerbose, int fVeryVerbose );
|
extern int Abc_NtkResubstitute( Abc_Ntk_t * pNtk, int nCutsMax, int nNodesMax, int nMinSaved, int nLevelsOdc, int fUpdateLevel, int fVerbose, int fVeryVerbose );
|
||||||
|
|
||||||
// set defaults
|
// set defaults
|
||||||
nCutsMax = 8;
|
nCutsMax = 8;
|
||||||
nNodesMax = 1;
|
nNodesMax = 1;
|
||||||
nLevelsOdc = 0;
|
nLevelsOdc = 0;
|
||||||
|
nMinSaved = 1;
|
||||||
fUpdateLevel = 1;
|
fUpdateLevel = 1;
|
||||||
fUseZeros = 0;
|
fUseZeros = 0;
|
||||||
fVerbose = 0;
|
fVerbose = 0;
|
||||||
fVeryVerbose = 0;
|
fVeryVerbose = 0;
|
||||||
Extra_UtilGetoptReset();
|
Extra_UtilGetoptReset();
|
||||||
while ( ( c = Extra_UtilGetopt( argc, argv, "KNFlzvwh" ) ) != EOF )
|
while ( ( c = Extra_UtilGetopt( argc, argv, "KNMFlzvwh" ) ) != EOF )
|
||||||
{
|
{
|
||||||
switch ( c )
|
switch ( c )
|
||||||
{
|
{
|
||||||
|
|
@ -7742,6 +7762,17 @@ int Abc_CommandResubstitute( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
if ( nNodesMax < 0 )
|
if ( nNodesMax < 0 )
|
||||||
goto usage;
|
goto usage;
|
||||||
break;
|
break;
|
||||||
|
case 'M':
|
||||||
|
if ( globalUtilOptind >= argc )
|
||||||
|
{
|
||||||
|
Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" );
|
||||||
|
goto usage;
|
||||||
|
}
|
||||||
|
nMinSaved = atoi(argv[globalUtilOptind]);
|
||||||
|
globalUtilOptind++;
|
||||||
|
if ( nMinSaved < 0 )
|
||||||
|
goto usage;
|
||||||
|
break;
|
||||||
case 'F':
|
case 'F':
|
||||||
if ( globalUtilOptind >= argc )
|
if ( globalUtilOptind >= argc )
|
||||||
{
|
{
|
||||||
|
|
@ -7771,6 +7802,10 @@ int Abc_CommandResubstitute( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
goto usage;
|
goto usage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( fUseZeros )
|
||||||
|
nMinSaved = 0;
|
||||||
|
if ( nMinSaved == 0 )
|
||||||
|
fUseZeros = 1;
|
||||||
|
|
||||||
if ( pNtk == NULL )
|
if ( pNtk == NULL )
|
||||||
{
|
{
|
||||||
|
|
@ -7799,7 +7834,7 @@ int Abc_CommandResubstitute( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
}
|
}
|
||||||
|
|
||||||
// modify the current network
|
// modify the current network
|
||||||
if ( !Abc_NtkResubstitute( pNtk, nCutsMax, nNodesMax, nLevelsOdc, fUpdateLevel, fVerbose, fVeryVerbose ) )
|
if ( !Abc_NtkResubstitute( pNtk, nCutsMax, nNodesMax, nMinSaved, nLevelsOdc, fUpdateLevel, fVerbose, fVeryVerbose ) )
|
||||||
{
|
{
|
||||||
Abc_Print( -1, "Refactoring has failed.\n" );
|
Abc_Print( -1, "Refactoring has failed.\n" );
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -7807,10 +7842,11 @@ int Abc_CommandResubstitute( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
usage:
|
usage:
|
||||||
Abc_Print( -2, "usage: resub [-KN <num>] [-lzvwh]\n" );
|
Abc_Print( -2, "usage: resub [-KNMF <num>] [-lzvwh]\n" );
|
||||||
Abc_Print( -2, "\t performs technology-independent restructuring of the AIG\n" );
|
Abc_Print( -2, "\t performs technology-independent restructuring of the AIG\n" );
|
||||||
Abc_Print( -2, "\t-K <num> : the max cut size (%d <= num <= %d) [default = %d]\n", RS_CUT_MIN, RS_CUT_MAX, nCutsMax );
|
Abc_Print( -2, "\t-K <num> : the max cut size (%d <= num <= %d) [default = %d]\n", RS_CUT_MIN, RS_CUT_MAX, nCutsMax );
|
||||||
Abc_Print( -2, "\t-N <num> : the max number of nodes to add (0 <= num <= 3) [default = %d]\n", nNodesMax );
|
Abc_Print( -2, "\t-N <num> : the max number of nodes to add (0 <= num <= 3) [default = %d]\n", nNodesMax );
|
||||||
|
Abc_Print( -2, "\t-M <num> : the min number of nodes saved after one step (0 <= num) [default = %d]\n", nMinSaved );
|
||||||
Abc_Print( -2, "\t-F <num> : the number of fanout levels for ODC computation [default = %d]\n", nLevelsOdc );
|
Abc_Print( -2, "\t-F <num> : the number of fanout levels for ODC computation [default = %d]\n", nLevelsOdc );
|
||||||
Abc_Print( -2, "\t-l : toggle preserving the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" );
|
Abc_Print( -2, "\t-l : toggle preserving the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" );
|
||||||
Abc_Print( -2, "\t-z : toggle using zero-cost replacements [default = %s]\n", fUseZeros? "yes": "no" );
|
Abc_Print( -2, "\t-z : toggle using zero-cost replacements [default = %s]\n", fUseZeros? "yes": "no" );
|
||||||
|
|
@ -14788,7 +14824,7 @@ int Abc_CommandDRewrite( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
// set defaults
|
// set defaults
|
||||||
Dar_ManDefaultRwrParams( pPars );
|
Dar_ManDefaultRwrParams( pPars );
|
||||||
Extra_UtilGetoptReset();
|
Extra_UtilGetoptReset();
|
||||||
while ( ( c = Extra_UtilGetopt( argc, argv, "CNflzrvwh" ) ) != EOF )
|
while ( ( c = Extra_UtilGetopt( argc, argv, "CNMflzrvwh" ) ) != EOF )
|
||||||
{
|
{
|
||||||
switch ( c )
|
switch ( c )
|
||||||
{
|
{
|
||||||
|
|
@ -14814,6 +14850,17 @@ int Abc_CommandDRewrite( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
if ( pPars->nSubgMax < 0 )
|
if ( pPars->nSubgMax < 0 )
|
||||||
goto usage;
|
goto usage;
|
||||||
break;
|
break;
|
||||||
|
case 'M':
|
||||||
|
if ( globalUtilOptind >= argc )
|
||||||
|
{
|
||||||
|
Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" );
|
||||||
|
goto usage;
|
||||||
|
}
|
||||||
|
pPars->nMinSaved = atoi(argv[globalUtilOptind]);
|
||||||
|
globalUtilOptind++;
|
||||||
|
if ( pPars->nMinSaved < 0 )
|
||||||
|
goto usage;
|
||||||
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
pPars->fFanout ^= 1;
|
pPars->fFanout ^= 1;
|
||||||
break;
|
break;
|
||||||
|
|
@ -14838,6 +14885,10 @@ int Abc_CommandDRewrite( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
goto usage;
|
goto usage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( pPars->fUseZeros )
|
||||||
|
pPars->nMinSaved = 0;
|
||||||
|
if ( pPars->nMinSaved == 0 )
|
||||||
|
pPars->fUseZeros = 1;
|
||||||
if ( pNtk == NULL )
|
if ( pNtk == NULL )
|
||||||
{
|
{
|
||||||
Abc_Print( -1, "Empty network.\n" );
|
Abc_Print( -1, "Empty network.\n" );
|
||||||
|
|
@ -14859,10 +14910,11 @@ int Abc_CommandDRewrite( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
usage:
|
usage:
|
||||||
Abc_Print( -2, "usage: drw [-C num] [-N num] [-lfzrvwh]\n" );
|
Abc_Print( -2, "usage: drw [-C num] [-NM num] [-lfzrvwh]\n" );
|
||||||
Abc_Print( -2, "\t performs combinational AIG rewriting\n" );
|
Abc_Print( -2, "\t performs combinational AIG rewriting\n" );
|
||||||
Abc_Print( -2, "\t-C num : the max number of cuts at a node [default = %d]\n", pPars->nCutsMax );
|
Abc_Print( -2, "\t-C num : the max number of cuts at a node [default = %d]\n", pPars->nCutsMax );
|
||||||
Abc_Print( -2, "\t-N num : the max number of subgraphs tried [default = %d]\n", pPars->nSubgMax );
|
Abc_Print( -2, "\t-N num : the max number of subgraphs tried [default = %d]\n", pPars->nSubgMax );
|
||||||
|
Abc_Print( -2, "\t-M num : the min number of nodes saved after one step (0 <= num) [default = %d]\n", pPars->nMinSaved );
|
||||||
Abc_Print( -2, "\t-l : toggle preserving the number of levels [default = %s]\n", pPars->fUpdateLevel? "yes": "no" );
|
Abc_Print( -2, "\t-l : toggle preserving the number of levels [default = %s]\n", pPars->fUpdateLevel? "yes": "no" );
|
||||||
Abc_Print( -2, "\t-f : toggle representing fanouts [default = %s]\n", pPars->fFanout? "yes": "no" );
|
Abc_Print( -2, "\t-f : toggle representing fanouts [default = %s]\n", pPars->fFanout? "yes": "no" );
|
||||||
Abc_Print( -2, "\t-z : toggle using zero-cost replacements [default = %s]\n", pPars->fUseZeros? "yes": "no" );
|
Abc_Print( -2, "\t-z : toggle using zero-cost replacements [default = %s]\n", pPars->fUseZeros? "yes": "no" );
|
||||||
|
|
|
||||||
|
|
@ -557,7 +557,7 @@ int Abc_NtkIvyProve( Abc_Ntk_t ** ppNtk, void * pPars )
|
||||||
pNtk = Abc_NtkBalance( pNtkTemp = pNtk, 0, 0, 0 );
|
pNtk = Abc_NtkBalance( pNtkTemp = pNtk, 0, 0, 0 );
|
||||||
Abc_NtkDelete( pNtkTemp );
|
Abc_NtkDelete( pNtkTemp );
|
||||||
Abc_NtkRewrite( pNtk, 0, 0, 0, 0, 0 );
|
Abc_NtkRewrite( pNtk, 0, 0, 0, 0, 0 );
|
||||||
Abc_NtkRefactor( pNtk, 10, 16, 0, 0, 0, 0 );
|
Abc_NtkRefactor( pNtk, 10, 1, 16, 0, 0, 0, 0 );
|
||||||
//printf( "After rwsat = %d. ", Abc_NtkNodeNum(pNtk) );
|
//printf( "After rwsat = %d. ", Abc_NtkNodeNum(pNtk) );
|
||||||
//ABC_PRT( "Time", Abc_Clock() - clk );
|
//ABC_PRT( "Time", Abc_Clock() - clk );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ ABC_NAMESPACE_IMPL_START
|
||||||
/// DECLARATIONS ///
|
/// DECLARATIONS ///
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
extern int Abc_NtkRefactor( Abc_Ntk_t * pNtk, int nNodeSizeMax, int nConeSizeMax, int fUpdateLevel, int fUseZeros, int fUseDcs, int fVerbose );
|
extern int Abc_NtkRefactor( Abc_Ntk_t * pNtk, int nNodeSizeMax, int nMinSaved, int nConeSizeMax, int fUpdateLevel, int fUseZeros, int fUseDcs, int fVerbose );
|
||||||
extern Abc_Ntk_t * Abc_NtkFromFraig( Fraig_Man_t * pMan, Abc_Ntk_t * pNtk );
|
extern Abc_Ntk_t * Abc_NtkFromFraig( Fraig_Man_t * pMan, Abc_Ntk_t * pNtk );
|
||||||
|
|
||||||
static Abc_Ntk_t * Abc_NtkMiterFraig( Abc_Ntk_t * pNtk, int nBTLimit, ABC_INT64_T nInspLimit, int * pRetValue, int * pNumFails, ABC_INT64_T * pNumConfs, ABC_INT64_T * pNumInspects );
|
static Abc_Ntk_t * Abc_NtkMiterFraig( Abc_Ntk_t * pNtk, int nBTLimit, ABC_INT64_T nInspLimit, int * pRetValue, int * pNumFails, ABC_INT64_T * pNumConfs, ABC_INT64_T * pNumInspects );
|
||||||
|
|
@ -151,7 +151,7 @@ int Abc_NtkMiterProve( Abc_Ntk_t ** ppNtk, void * pPars )
|
||||||
break;
|
break;
|
||||||
if ( --Counter == 0 )
|
if ( --Counter == 0 )
|
||||||
break;
|
break;
|
||||||
Abc_NtkRefactor( pNtk, 10, 16, 0, 0, 0, 0 );
|
Abc_NtkRefactor( pNtk, 10, 1, 16, 0, 0, 0, 0 );
|
||||||
if ( (RetValue = Abc_NtkMiterIsConstant(pNtk)) >= 0 )
|
if ( (RetValue = Abc_NtkMiterIsConstant(pNtk)) >= 0 )
|
||||||
break;
|
break;
|
||||||
if ( --Counter == 0 )
|
if ( --Counter == 0 )
|
||||||
|
|
@ -340,7 +340,7 @@ Abc_Ntk_t * Abc_NtkMiterRwsat( Abc_Ntk_t * pNtk )
|
||||||
Abc_NtkRewrite( pNtk, 0, 0, 0, 0, 0 );
|
Abc_NtkRewrite( pNtk, 0, 0, 0, 0, 0 );
|
||||||
pNtk = Abc_NtkBalance( pNtkTemp = pNtk, 0, 0, 0 ); Abc_NtkDelete( pNtkTemp );
|
pNtk = Abc_NtkBalance( pNtkTemp = pNtk, 0, 0, 0 ); Abc_NtkDelete( pNtkTemp );
|
||||||
Abc_NtkRewrite( pNtk, 0, 0, 0, 0, 0 );
|
Abc_NtkRewrite( pNtk, 0, 0, 0, 0, 0 );
|
||||||
Abc_NtkRefactor( pNtk, 10, 16, 0, 0, 0, 0 );
|
Abc_NtkRefactor( pNtk, 10, 1, 16, 0, 0, 0, 0 );
|
||||||
return pNtk;
|
return pNtk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,14 +51,14 @@ void Abc_NtkSynthesize( Abc_Ntk_t ** ppNtk, int fMoreEffort )
|
||||||
pNtk = *ppNtk;
|
pNtk = *ppNtk;
|
||||||
|
|
||||||
Abc_NtkRewrite( pNtk, 0, 0, 0, 0, 0 );
|
Abc_NtkRewrite( pNtk, 0, 0, 0, 0, 0 );
|
||||||
Abc_NtkRefactor( pNtk, 10, 16, 0, 0, 0, 0 );
|
Abc_NtkRefactor( pNtk, 10, 1, 16, 0, 0, 0, 0 );
|
||||||
pNtk = Abc_NtkBalance( pNtkTemp = pNtk, 0, 0, 0 );
|
pNtk = Abc_NtkBalance( pNtkTemp = pNtk, 0, 0, 0 );
|
||||||
Abc_NtkDelete( pNtkTemp );
|
Abc_NtkDelete( pNtkTemp );
|
||||||
|
|
||||||
if ( fMoreEffort )
|
if ( fMoreEffort )
|
||||||
{
|
{
|
||||||
Abc_NtkRewrite( pNtk, 0, 0, 0, 0, 0 );
|
Abc_NtkRewrite( pNtk, 0, 0, 0, 0, 0 );
|
||||||
Abc_NtkRefactor( pNtk, 10, 16, 0, 0, 0, 0 );
|
Abc_NtkRefactor( pNtk, 10, 1, 16, 0, 0, 0, 0 );
|
||||||
pNtk = Abc_NtkBalance( pNtkTemp = pNtk, 0, 0, 0 );
|
pNtk = Abc_NtkBalance( pNtkTemp = pNtk, 0, 0, 0 );
|
||||||
Abc_NtkDelete( pNtkTemp );
|
Abc_NtkDelete( pNtkTemp );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ int Abc_NodeConeIsConst1( word * pTruth, int nVars )
|
||||||
SeeAlso []
|
SeeAlso []
|
||||||
|
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
Dec_Graph_t * Abc_NodeRefactor( Abc_ManRef_t * p, Abc_Obj_t * pNode, Vec_Ptr_t * vFanins, int fUpdateLevel, int fUseZeros, int fUseDcs, int fVerbose )
|
Dec_Graph_t * Abc_NodeRefactor( Abc_ManRef_t * p, Abc_Obj_t * pNode, Vec_Ptr_t * vFanins, int nMinSaved, int fUpdateLevel, int fUseZeros, int fUseDcs, int fVerbose )
|
||||||
{
|
{
|
||||||
extern int Dec_GraphToNetworkCount( Abc_Obj_t * pRoot, Dec_Graph_t * pGraph, int NodeMax, int LevelMax );
|
extern int Dec_GraphToNetworkCount( Abc_Obj_t * pRoot, Dec_Graph_t * pGraph, int NodeMax, int LevelMax );
|
||||||
int fVeryVerbose = 0;
|
int fVeryVerbose = 0;
|
||||||
|
|
@ -205,7 +205,8 @@ clk = Abc_Clock();
|
||||||
nNodesAdded = Dec_GraphToNetworkCount( pNode, pFForm, nNodesSaved, Required );
|
nNodesAdded = Dec_GraphToNetworkCount( pNode, pFForm, nNodesSaved, Required );
|
||||||
p->timeEval += Abc_Clock() - clk;
|
p->timeEval += Abc_Clock() - clk;
|
||||||
// quit if there is no improvement
|
// quit if there is no improvement
|
||||||
if ( nNodesAdded == -1 || (nNodesAdded == nNodesSaved && !fUseZeros) )
|
//if ( nNodesAdded == -1 || (nNodesAdded == nNodesSaved && !fUseZeros) )
|
||||||
|
if ( nNodesAdded == -1 || nNodesSaved - nNodesAdded < nMinSaved )
|
||||||
{
|
{
|
||||||
Dec_GraphFree( pFForm );
|
Dec_GraphFree( pFForm );
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -323,7 +324,7 @@ void Abc_NtkManRefPrintStats( Abc_ManRef_t * p )
|
||||||
SeeAlso []
|
SeeAlso []
|
||||||
|
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
int Abc_NtkRefactor( Abc_Ntk_t * pNtk, int nNodeSizeMax, int nConeSizeMax, int fUpdateLevel, int fUseZeros, int fUseDcs, int fVerbose )
|
int Abc_NtkRefactor( Abc_Ntk_t * pNtk, int nNodeSizeMax, int nMinSaved, int nConeSizeMax, int fUpdateLevel, int fUseZeros, int fUseDcs, int fVerbose )
|
||||||
{
|
{
|
||||||
extern int Dec_GraphUpdateNetwork( Abc_Obj_t * pRoot, Dec_Graph_t * pGraph, int fUpdateLevel, int nGain );
|
extern int Dec_GraphUpdateNetwork( Abc_Obj_t * pRoot, Dec_Graph_t * pGraph, int fUpdateLevel, int nGain );
|
||||||
ProgressBar * pProgress;
|
ProgressBar * pProgress;
|
||||||
|
|
@ -371,7 +372,7 @@ clk = Abc_Clock();
|
||||||
pManRef->timeCut += Abc_Clock() - clk;
|
pManRef->timeCut += Abc_Clock() - clk;
|
||||||
// evaluate this cut
|
// evaluate this cut
|
||||||
clk = Abc_Clock();
|
clk = Abc_Clock();
|
||||||
pFForm = Abc_NodeRefactor( pManRef, pNode, vFanins, fUpdateLevel, fUseZeros, fUseDcs, fVerbose );
|
pFForm = Abc_NodeRefactor( pManRef, pNode, vFanins, nMinSaved, fUpdateLevel, fUseZeros, fUseDcs, fVerbose );
|
||||||
pManRef->timeRes += Abc_Clock() - clk;
|
pManRef->timeRes += Abc_Clock() - clk;
|
||||||
if ( pFForm == NULL )
|
if ( pFForm == NULL )
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ extern abctime s_ResubTime;
|
||||||
SeeAlso []
|
SeeAlso []
|
||||||
|
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
int Abc_NtkResubstitute( Abc_Ntk_t * pNtk, int nCutMax, int nStepsMax, int nLevelsOdc, int fUpdateLevel, int fVerbose, int fVeryVerbose )
|
int Abc_NtkResubstitute( Abc_Ntk_t * pNtk, int nCutMax, int nStepsMax, int nMinSaved, int nLevelsOdc, int fUpdateLevel, int fVerbose, int fVeryVerbose )
|
||||||
{
|
{
|
||||||
extern int Dec_GraphUpdateNetwork( Abc_Obj_t * pRoot, Dec_Graph_t * pGraph, int fUpdateLevel, int nGain );
|
extern int Dec_GraphUpdateNetwork( Abc_Obj_t * pRoot, Dec_Graph_t * pGraph, int fUpdateLevel, int nGain );
|
||||||
ProgressBar * pProgress;
|
ProgressBar * pProgress;
|
||||||
|
|
@ -214,6 +214,11 @@ clk = Abc_Clock();
|
||||||
pManRes->timeRes += Abc_Clock() - clk;
|
pManRes->timeRes += Abc_Clock() - clk;
|
||||||
if ( pFForm == NULL )
|
if ( pFForm == NULL )
|
||||||
continue;
|
continue;
|
||||||
|
if ( pManRes->nLastGain < nMinSaved )
|
||||||
|
{
|
||||||
|
Dec_GraphFree( pFForm );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
pManRes->nTotalGain += pManRes->nLastGain;
|
pManRes->nTotalGain += pManRes->nLastGain;
|
||||||
/*
|
/*
|
||||||
if ( pManRes->nLeaves == 4 && pManRes->nMffc == 2 && pManRes->nLastGain == 1 )
|
if ( pManRes->nLeaves == 4 && pManRes->nMffc == 2 && pManRes->nLastGain == 1 )
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ struct Dar_RwrPar_t_
|
||||||
{
|
{
|
||||||
int nCutsMax; // the maximum number of cuts to try
|
int nCutsMax; // the maximum number of cuts to try
|
||||||
int nSubgMax; // the maximum number of subgraphs to try
|
int nSubgMax; // the maximum number of subgraphs to try
|
||||||
|
int nMinSaved; // the minumum number of nodes saved
|
||||||
int fFanout; // support fanout representation
|
int fFanout; // support fanout representation
|
||||||
int fUpdateLevel; // update level
|
int fUpdateLevel; // update level
|
||||||
int fUseZeros; // performs zero-cost replacement
|
int fUseZeros; // performs zero-cost replacement
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ void Dar_ManDefaultRwrParams( Dar_RwrPar_t * pPars )
|
||||||
memset( pPars, 0, sizeof(Dar_RwrPar_t) );
|
memset( pPars, 0, sizeof(Dar_RwrPar_t) );
|
||||||
pPars->nCutsMax = 8; // 8
|
pPars->nCutsMax = 8; // 8
|
||||||
pPars->nSubgMax = 5; // 5 is a "magic number"
|
pPars->nSubgMax = 5; // 5 is a "magic number"
|
||||||
|
pPars->nMinSaved = 1;
|
||||||
pPars->fFanout = 1;
|
pPars->fFanout = 1;
|
||||||
pPars->fUpdateLevel = 0;
|
pPars->fUpdateLevel = 0;
|
||||||
pPars->fUseZeros = 0;
|
pPars->fUseZeros = 0;
|
||||||
|
|
@ -177,7 +178,8 @@ p->timeCuts += Abc_Clock() - clk;
|
||||||
pCut->nLeaves = nLeavesOld;
|
pCut->nLeaves = nLeavesOld;
|
||||||
}
|
}
|
||||||
// check the best gain
|
// check the best gain
|
||||||
if ( !(p->GainBest > 0 || (p->GainBest == 0 && p->pPars->fUseZeros)) )
|
//if ( !(p->GainBest > 0 || (p->GainBest == 0 && p->pPars->fUseZeros)) )
|
||||||
|
if ( p->GainBest < p->pPars->nMinSaved )
|
||||||
{
|
{
|
||||||
// Aig_ObjOrderAdvance( pAig );
|
// Aig_ObjOrderAdvance( pAig );
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue