diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index dbe69d9ba..53e30af05 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -10548,7 +10548,7 @@ int Abc_CommandLutExact( Abc_Frame_t * pAbc, int argc, char ** argv ) Bmc_EsPar_t Pars, * pPars = &Pars; Bmc_EsParSetDefault( pPars ); Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "INKTSFMiaocgvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "INKTFMSYiaocgvh" ) ) != EOF ) { switch ( c ) { @@ -10596,15 +10596,6 @@ int Abc_CommandLutExact( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pPars->RuntimeLim < 0 ) goto usage; break; - case 'S': - if ( globalUtilOptind >= argc ) - { - Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); - goto usage; - } - pPars->pSymStr = argv[globalUtilOptind]; - globalUtilOptind++; - break; case 'F': if ( globalUtilOptind >= argc ) { @@ -10623,6 +10614,26 @@ int Abc_CommandLutExact( Abc_Frame_t * pAbc, int argc, char ** argv ) pPars->nMintNum = atoi(argv[globalUtilOptind]); globalUtilOptind++; break; + case 'S': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); + goto usage; + } + pPars->Seed = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->Seed < 0 ) + goto usage; + break; + case 'Y': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-Y\" should be followed by a string.\n" ); + goto usage; + } + pPars->pSymStr = argv[globalUtilOptind]; + globalUtilOptind++; + break; case 'i': pPars->fUseIncr ^= 1; break; @@ -10690,7 +10701,7 @@ int Abc_CommandLutExact( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - Abc_Print( -2, "usage: lutexact [-INKTFM ] [-S string] [-iaocgvh] \n" ); + Abc_Print( -2, "usage: lutexact [-INKTFMS ] [-Y string] [-iaocgvh] \n" ); Abc_Print( -2, "\t exact synthesis of I-input function using N K-input gates\n" ); Abc_Print( -2, "\t-I : the number of input variables [default = %d]\n", pPars->nVars ); Abc_Print( -2, "\t-N : the number of K-input nodes [default = %d]\n", pPars->nNodes ); @@ -10698,7 +10709,8 @@ usage: Abc_Print( -2, "\t-T : the runtime limit in seconds [default = %d]\n", pPars->RuntimeLim ); Abc_Print( -2, "\t-F : the number of random functions to try [default = unused]\n" ); Abc_Print( -2, "\t-M : the number of positive minterms in the random function [default = unused]\n" ); - Abc_Print( -2, "\t-S : charasteristic string of a symmetric function [default = %d]\n", pPars->pSymStr ); + Abc_Print( -2, "\t-S : the random seed for random function generation with -F [default = %d]\n", pPars->Seed ); + Abc_Print( -2, "\t-Y : charasteristic string of a symmetric function [default = %d]\n", pPars->pSymStr ); Abc_Print( -2, "\t-i : toggle using incremental solving [default = %s]\n", pPars->fUseIncr ? "yes" : "no" ); Abc_Print( -2, "\t-a : toggle using only AND-gates when K = 2 [default = %s]\n", pPars->fOnlyAnd ? "yes" : "no" ); Abc_Print( -2, "\t-o : toggle using additional optimizations [default = %s]\n", pPars->fFewerVars ? "yes" : "no" ); diff --git a/src/sat/bmc/bmc.h b/src/sat/bmc/bmc.h index 233930178..d7e71113a 100644 --- a/src/sat/bmc/bmc.h +++ b/src/sat/bmc/bmc.h @@ -67,6 +67,7 @@ struct Bmc_EsPar_t_ int RuntimeLim; int nRandFuncs; int nMintNum; + int Seed; int fVerbose; char * pTtStr; char * pSymStr; diff --git a/src/sat/bmc/bmcMaj.c b/src/sat/bmc/bmcMaj.c index 5e85536ae..cdd2cec49 100644 --- a/src/sat/bmc/bmcMaj.c +++ b/src/sat/bmc/bmcMaj.c @@ -1580,18 +1580,19 @@ int Exa3_ManExactSynthesis( Bmc_EsPar_t * pPars ) void Exa3_ManExactSynthesisRand( Bmc_EsPar_t * pPars ) { int i, k, nDecs = 0, nWords = Abc_TtWordNum(pPars->nVars); - word * pFun = ABC_ALLOC( word, nWords ); - Abc_Random(1); - printf( "\n" ); + word * pFun = ABC_ALLOC( word, nWords ); + unsigned Rand0 = Abc_Random(1); + for ( i = 0; i < pPars->Seed; i++ ) + Rand0 = Abc_Random(0); for ( i = 0; i < pPars->nRandFuncs; i++ ) { if ( pPars->nMintNum == 0 ) for ( k = 0; k < nWords; k++ ) - pFun[k] = Abc_RandomW(0); + pFun[k] = Rand0 ^ Abc_RandomW(0); else { Abc_TtClear( pFun, nWords ); for ( k = 0; k < pPars->nMintNum; k++ ) { int iMint = 0; - do iMint = Abc_Random(0) % (1 << pPars->nVars); + do iMint = (Rand0 ^ Abc_Random(0)) % (1 << pPars->nVars); while ( Abc_TtGetBit(pFun, iMint) ); Abc_TtSetBit( pFun, iMint ); } @@ -1607,7 +1608,7 @@ void Exa3_ManExactSynthesisRand( Bmc_EsPar_t * pPars ) nDecs += Exa3_ManExactSynthesis( pPars ); ABC_FREE( pPars->pTtStr ); } - printf( "Decomposable are %d (out of %d) functions (%.2f %%).\n", nDecs, pPars->nRandFuncs, 100.0*nDecs/pPars->nRandFuncs ); + printf( "\nDecomposable are %d (out of %d) functions (%.2f %%).\n", nDecs, pPars->nRandFuncs, 100.0*nDecs/pPars->nRandFuncs ); ABC_FREE( pFun ); }