diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2015-06-27 19:39:02 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2015-06-27 19:39:02 -0700 |
commit | 9eb3a3b3493034b8e20a9cbf36578290ee4b40e6 (patch) | |
tree | 9f02dc7726ea29bd14be42d9d436353cd83f7997 /src/base | |
parent | 9b1de5b166e9832bf2e9aa15ca4fe29e5017f94f (diff) | |
download | abc-9eb3a3b3493034b8e20a9cbf36578290ee4b40e6.tar.gz abc-9eb3a3b3493034b8e20a9cbf36578290ee4b40e6.tar.bz2 abc-9eb3a3b3493034b8e20a9cbf36578290ee4b40e6.zip |
Adding resource limits to 'fraig_restore'.
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/abc/abc.h | 2 | ||||
-rw-r--r-- | src/base/abci/abc.c | 53 | ||||
-rw-r--r-- | src/base/abci/abcFraig.c | 8 |
3 files changed, 48 insertions, 15 deletions
diff --git a/src/base/abc/abc.h b/src/base/abc/abc.h index fa5a61a1..3374b453 100644 --- a/src/base/abc/abc.h +++ b/src/base/abc/abc.h @@ -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 ); diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 88fd8393..c6e252a0 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -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; } diff --git a/src/base/abci/abcFraig.c b/src/base/abci/abcFraig.c index 4621f508..cbb675a3 100644 --- a/src/base/abci/abcFraig.c +++ b/src/base/abci/abcFraig.c @@ -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 |