diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2020-12-07 17:15:31 -1000 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2020-12-07 17:15:31 -1000 |
commit | 5b8e56b2e51ea01a54f668d9ec139f37f7fec10f (patch) | |
tree | 47c40e9f3da8c97a8750dc4b0d35bf1c47ee9a65 /src/base/abci | |
parent | 206527045e3ce4bb1b1adb683b0f471865648ffb (diff) | |
download | abc-5b8e56b2e51ea01a54f668d9ec139f37f7fec10f.tar.gz abc-5b8e56b2e51ea01a54f668d9ec139f37f7fec10f.tar.bz2 abc-5b8e56b2e51ea01a54f668d9ec139f37f7fec10f.zip |
Adding timeout to several commands.
Diffstat (limited to 'src/base/abci')
-rw-r--r-- | src/base/abci/abc.c | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index f1a93979..fd108107 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -7067,14 +7067,25 @@ usage: ***********************************************************************/ int Abc_CommandRunEco( Abc_Frame_t * pAbc, int argc, char ** argv ) { - extern void Acb_NtkRunEco( char * pFileNames[4], int fCheck, int fRandom, int fInputs, int fVerbose, int fVeryVerbose ); + extern void Acb_NtkRunEco( char * pFileNames[4], int nTimeout, int fCheck, int fRandom, int fInputs, int fVerbose, int fVeryVerbose ); char * pFileNames[4] = {NULL}; - int c, fCheck = 0, fRandom = 0, fInputs = 0, fVerbose = 0, fVeryVerbose = 0; + int c, nTimeout = 0, fCheck = 0, fRandom = 0, fInputs = 0, fVerbose = 0, fVeryVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "crivwh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "Tcrivwh" ) ) != EOF ) { switch ( c ) { + case 'T': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); + goto usage; + } + nTimeout = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nTimeout < 0 ) + goto usage; + break; case 'c': fCheck ^= 1; break; @@ -7115,11 +7126,11 @@ int Abc_CommandRunEco( Abc_Frame_t * pAbc, int argc, char ** argv ) fclose( pFile ); pFileNames[c] = argv[globalUtilOptind+c]; } - Acb_NtkRunEco( pFileNames, fCheck, fRandom, fInputs, fVerbose, fVeryVerbose ); + Acb_NtkRunEco( pFileNames, nTimeout, fCheck, fRandom, fInputs, fVerbose, fVeryVerbose ); return 0; usage: - Abc_Print( -2, "usage: runeco [-crivwh] <implementation> <specification> <weights>\n" ); + Abc_Print( -2, "usage: runeco [-T num] [-crivwh] <implementation> <specification> <weights>\n" ); Abc_Print( -2, "\t performs computation of patch functions during ECO,\n" ); Abc_Print( -2, "\t as described in the following paper: A. Q. Dao et al\n" ); Abc_Print( -2, "\t \"Efficient computation of ECO patch functions\", Proc. DAC\'18\n" ); @@ -7127,6 +7138,7 @@ usage: Abc_Print( -2, "\t (currently only applicable to benchmarks from 2017 ICCAD CAD competition\n" ); Abc_Print( -2, "\t http://cad-contest-2017.el.cycu.edu.tw/Problem_A/default.html as follows:\n" ); Abc_Print( -2, "\t \"runeco unit1/F.v unit1/G.v unit1/weight.txt; cec -n out.v unit1/G.v\")\n" ); + Abc_Print( -2, "\t-T num : the timeout in seconds [default = %d]\n", nTimeout ); Abc_Print( -2, "\t-c : toggle checking that the problem has a solution [default = %s]\n", fCheck? "yes": "no" ); Abc_Print( -2, "\t-r : toggle using random permutation of support variables [default = %s]\n", fRandom? "yes": "no" ); Abc_Print( -2, "\t-i : toggle using primary inputs as support variables [default = %s]\n", fInputs? "yes": "no" ); @@ -7198,14 +7210,25 @@ usage: ***********************************************************************/ int Abc_CommandRunSim( Abc_Frame_t * pAbc, int argc, char ** argv ) { - extern void Acb_NtkRunSim( char * pFileName[4], int nWords, int nBeam, int LevL, int LevU, int fOrder, int fFancy, int fUseBuf, int fRandom, int fUseWeights, int fInputs, int fSkipMffc, int fVerbose, int fVeryVerbose ); + extern void Acb_NtkRunSim( char * pFileName[4], int nTimeout, int nWords, int nBeam, int LevL, int LevU, int fOrder, int fFancy, int fUseBuf, int fRandom, int fUseWeights, int fInputs, int fSkipMffc, int fVerbose, int fVeryVerbose ); char * pFileNames[4] = {NULL, NULL, "out.v", NULL}; - int c, nWords = 8, nBeam = 4, LevL = -1, LevU = -1, fOrder = 0, fFancy = 0, fUseBuf = 0, fRandom = 0, fUseWeights = 0, fInputs = 0, fSkipMffc = 0, fVerbose = 0, fVeryVerbose = 0; + int c, nTimeout = 0, nWords = 8, nBeam = 4, LevL = -1, LevU = -1, fOrder = 0, fFancy = 0, fUseBuf = 0, fRandom = 0, fUseWeights = 0, fInputs = 0, fSkipMffc = 0, fVerbose = 0, fVeryVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "WBLUofbruimvwh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "TWBLUofbruimvwh" ) ) != EOF ) { switch ( c ) { + case 'T': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); + goto usage; + } + nTimeout = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nTimeout < 0 ) + goto usage; + break; case 'W': if ( globalUtilOptind >= argc ) { @@ -7302,12 +7325,13 @@ int Abc_CommandRunSim( Abc_Frame_t * pAbc, int argc, char ** argv ) else fclose( pFile ); } - Acb_NtkRunSim( pFileNames, nWords, nBeam, LevL, LevU, fOrder, fFancy, fUseBuf, fRandom, fUseWeights, fInputs, fSkipMffc, fVerbose, fVeryVerbose ); + Acb_NtkRunSim( pFileNames, nTimeout, nWords, nBeam, LevL, LevU, fOrder, fFancy, fUseBuf, fRandom, fUseWeights, fInputs, fSkipMffc, fVerbose, fVeryVerbose ); return 0; usage: - Abc_Print( -2, "usage: runsim [-WBLU] [-ofbruimvwh] [-N <num>] <file1> <file2> <file3>\n" ); + Abc_Print( -2, "usage: runsim [-TWBLU] [-ofbruimvwh] [-N <num>] <file1> <file2> <file3>\n" ); Abc_Print( -2, "\t experimental simulation command\n" ); + Abc_Print( -2, "\t-T <num> : the timeout in seconds [default = %d]\n", nTimeout ); Abc_Print( -2, "\t-W <num> : the number of words of simulation info [default = %d]\n", nWords ); Abc_Print( -2, "\t-B <num> : the beam width parameter [default = %d]\n", nBeam ); Abc_Print( -2, "\t-L <num> : the lower bound on level [default = %d]\n", LevL ); |