Adding resource limits to 'fraig_restore'.

This commit is contained in:
Alan Mishchenko 2015-06-27 19:39:02 -07:00
parent 9b1de5b166
commit 9eb3a3b349
3 changed files with 48 additions and 15 deletions

View File

@ -650,7 +650,7 @@ extern ABC_DLL Abc_Ntk_t * Abc_NtkFraig( Abc_Ntk_t * pNtk, void * pParams
extern ABC_DLL void * Abc_NtkToFraig( Abc_Ntk_t * pNtk, void * pParams, int fAllNodes, int fExdc );
extern ABC_DLL Abc_Ntk_t * Abc_NtkFraigTrust( Abc_Ntk_t * pNtk );
extern ABC_DLL int Abc_NtkFraigStore( Abc_Ntk_t * pNtk );
extern ABC_DLL Abc_Ntk_t * Abc_NtkFraigRestore();
extern ABC_DLL Abc_Ntk_t * Abc_NtkFraigRestore( int nPatsRand, int nPatsDyna, int nBTLimit );
extern ABC_DLL void Abc_NtkFraigStoreClean();
/*=== abcFunc.c ==========================================================*/
extern ABC_DLL int Abc_NtkSopToBdd( Abc_Ntk_t * pNtk );

View File

@ -13673,18 +13673,49 @@ int Abc_CommandFraigRestore( Abc_Frame_t * pAbc, int argc, char ** argv )
{
Abc_Ntk_t * pNtk, * pNtkRes;
int c;
int fDuplicate;
int nPatsRand = 0; // the number of words of random simulation info
int nPatsDyna = 0; // the number of words of dynamic simulation info
int nBTLimit = 1000; // the max number of backtracks to perform
pNtk = Abc_FrameReadNtk(pAbc);
// set defaults
fDuplicate = 0;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "dh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "RDCh" ) ) != EOF )
{
switch ( c )
{
case 'd':
fDuplicate ^= 1;
case 'R':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-R\" should be followed by an integer.\n" );
goto usage;
}
nPatsRand = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
if ( nPatsRand < 0 )
goto usage;
break;
case 'D':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" );
goto usage;
}
nPatsDyna = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
if ( nPatsDyna < 0 )
goto usage;
break;
case 'C':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" );
goto usage;
}
nBTLimit = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
if ( nBTLimit < 0 )
goto usage;
break;
case 'h':
goto usage;
@ -13700,7 +13731,7 @@ int Abc_CommandFraigRestore( Abc_Frame_t * pAbc, int argc, char ** argv )
}
// get the new network
pNtkRes = Abc_NtkFraigRestore();
pNtkRes = Abc_NtkFraigRestore( nPatsRand, nPatsDyna, nBTLimit );
if ( pNtkRes == NULL )
{
Abc_Print( -1, "Fraig restoring has failed.\n" );
@ -13711,10 +13742,12 @@ int Abc_CommandFraigRestore( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0;
usage:
Abc_Print( -2, "usage: fraig_restore [-h]\n" );
Abc_Print( -2, "\t makes the current network by fraiging the AIG database\n" );
// Abc_Print( -2, "\t-d : toggle duplication of logic [default = %s]\n", fDuplicate? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
Abc_Print( -2, "usage: fraig_restore [-RDC num] [-h]\n" );
Abc_Print( -2, "\t makes the current network by fraiging the AIG database\n" );
Abc_Print( -2, "\t-R num : number of random patterns (127 < num < 32769) [default = design-dependent]\n" );
Abc_Print( -2, "\t-D num : number of systematic patterns (127 < num < 32769) [default = design-dependent]\n" );
Abc_Print( -2, "\t-C num : number of backtracks for one SAT problem [default = %d]\n", nBTLimit );
Abc_Print( -2, "\t-h : print the command usage\n");
return 1;
}

View File

@ -691,7 +691,7 @@ int Abc_NtkFraigStore( Abc_Ntk_t * pNtkAdd )
SeeAlso []
***********************************************************************/
Abc_Ntk_t * Abc_NtkFraigRestore()
Abc_Ntk_t * Abc_NtkFraigRestore( int nPatsRand, int nPatsDyna, int nBTLimit )
{
extern Abc_Ntk_t * Abc_NtkFraigPartitioned( Vec_Ptr_t * vStore, void * pParams );
Fraig_Params_t Params;
@ -729,9 +729,9 @@ Abc_Ntk_t * Abc_NtkFraigRestore()
// set parameters for fraiging
Fraig_ParamsSetDefault( &Params );
Params.nPatsRand = nWordsMin * 32; // the number of words of random simulation info
Params.nPatsDyna = nWordsMin * 32; // the number of words of dynamic simulation info
Params.nBTLimit = 1000; // the max number of backtracks to perform
Params.nPatsRand = nPatsRand ? nPatsRand : nWordsMin * 32; // the number of words of random simulation info
Params.nPatsDyna = nPatsDyna ? nPatsDyna : nWordsMin * 32; // the number of words of dynamic simulation info
Params.nBTLimit = nBTLimit; // the max number of backtracks to perform
Params.fFuncRed = 1; // performs only one level hashing
Params.fFeedBack = 1; // enables solver feedback
Params.fDist1Pats = 1; // enables distance-1 patterns