diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2015-02-10 08:03:01 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2015-02-10 08:03:01 -0800 |
commit | 44b31021d6c45582738fa912aca86b9ab9ac054e (patch) | |
tree | d31a81718945d4a7663add1223f71d5d4c88c7fd /src | |
parent | 089a8bbfc9861bb3dacc10710bd28e845b5c46f8 (diff) | |
download | abc-44b31021d6c45582738fa912aca86b9ab9ac054e.tar.gz abc-44b31021d6c45582738fa912aca86b9ab9ac054e.tar.bz2 abc-44b31021d6c45582738fa912aca86b9ab9ac054e.zip |
Adding resource limit to 'fx'.
Diffstat (limited to 'src')
-rw-r--r-- | src/base/abci/abc.c | 22 | ||||
-rw-r--r-- | src/base/cba/cbaPrsBuild.c | 6 |
2 files changed, 23 insertions, 5 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 7983c623..7367ac87 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -3756,10 +3756,11 @@ int Abc_CommandFastExtract( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Fxu_Data_t Params, * p = &Params; int c, fNewAlgo = 1; + int nPairsLimit = 1000000000; // set the defaults Abc_NtkSetDefaultFxParams( p ); Extra_UtilGetoptReset(); - while ( (c = Extra_UtilGetopt(argc, argv, "SDNWMsdzcnvwh")) != EOF ) + while ( (c = Extra_UtilGetopt(argc, argv, "SDNWMPsdzcnvwh")) != EOF ) { switch (c) { @@ -3818,6 +3819,17 @@ int Abc_CommandFastExtract( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( p->LitCountMax < 0 ) goto usage; break; + case 'P': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); + goto usage; + } + nPairsLimit = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nPairsLimit < 0 ) + goto usage; + break; case 's': p->fOnlyS ^= 1; break; @@ -3866,6 +3878,11 @@ int Abc_CommandFastExtract( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_Print( -1, "Fast extract can only be applied to a logic network with SOP local functions (run \"bdd; sop\").\n" ); return 1; } + if ( Abc_NtkGetCubePairNum(pNtk) > nPairsLimit ) + { + Abc_Print( -1, "Cannot perform \"fx\" because the number cube pairs exceeds the limit (%d).\n", nPairsLimit ); + return 1; + } // the nodes to be merged are linked into the special linked list if ( fNewAlgo ) @@ -3876,13 +3893,14 @@ int Abc_CommandFastExtract( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - Abc_Print( -2, "usage: fx [-SDNWM <num>] [-sdzcnvwh]\n"); + Abc_Print( -2, "usage: fx [-SDNWMP <num>] [-sdzcnvwh]\n"); Abc_Print( -2, "\t performs unate fast extract on the current network\n"); Abc_Print( -2, "\t-S <num> : max number of single-cube divisors to consider [default = %d]\n", p->nSingleMax ); Abc_Print( -2, "\t-D <num> : max number of double-cube divisors to consider [default = %d]\n", p->nPairsMax ); Abc_Print( -2, "\t-N <num> : max number of divisors to extract during this run [default = %d]\n", p->nNodesExt ); Abc_Print( -2, "\t-W <num> : lower bound on the weight of divisors to extract [default = %d]\n", p->WeightMin ); Abc_Print( -2, "\t-M <num> : upper bound on literal count of divisors to extract [default = %d]\n", p->LitCountMax ); + Abc_Print( -2, "\t-P <num> : skip \"fx\" if cube pair count exceeds this limit [default = %d]\n", nPairsLimit ); Abc_Print( -2, "\t-s : use only single-cube divisors [default = %s]\n", p->fOnlyS? "yes": "no" ); Abc_Print( -2, "\t-d : use only double-cube divisors [default = %s]\n", p->fOnlyD? "yes": "no" ); Abc_Print( -2, "\t-z : use zero-weight divisors [default = %s]\n", p->fUse0? "yes": "no" ); diff --git a/src/base/cba/cbaPrsBuild.c b/src/base/cba/cbaPrsBuild.c index d3969c72..4087b23e 100644 --- a/src/base/cba/cbaPrsBuild.c +++ b/src/base/cba/cbaPrsBuild.c @@ -153,10 +153,10 @@ void Prs_ManRemapBoxes( Cba_Man_t * pNew, Vec_Ptr_t * vDes, Prs_Ntk_t * pNtk, Ve int NtkId = Prs_BoxNtk( pNtk, iBox ); int NtkIdNew = Cba_ManNtkFindId( pNew, Prs_NtkStr(pNtk, NtkId) ); Prs_BoxSetNtk( pNtk, iBox, NtkIdNew ); - if ( NtkId < Cba_ManNtkNum(pNew) ) + if ( NtkIdNew < Cba_ManNtkNum(pNew) ) Prs_ManRemapOne( vSigs, Prs_ManNtk(vDes, NtkIdNew), vMap ); - else - Prs_ManRemapGate( vSigs ); + //else + // Prs_ManRemapGate( vSigs ); } } void Prs_ManCleanMap( Prs_Ntk_t * pNtk, Vec_Int_t * vMap ) |