diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2013-07-16 16:06:21 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2013-07-16 16:06:21 -0700 |
commit | 5f97612951b9547a23c64e2a669cd459dae0beda (patch) | |
tree | 9552d966c6e461584fbb599ef5e17fecf2545c9b /src/base | |
parent | e731d3b1f4fa1a1be528c5e1868409c1b19aedf7 (diff) | |
download | abc-5f97612951b9547a23c64e2a669cd459dae0beda.tar.gz abc-5f97612951b9547a23c64e2a669cd459dae0beda.tar.bz2 abc-5f97612951b9547a23c64e2a669cd459dae0beda.zip |
Imporvements to 'eliminate'.
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/abc/abcMinBase.c | 22 | ||||
-rw-r--r-- | src/base/abci/abc.c | 26 |
2 files changed, 40 insertions, 8 deletions
diff --git a/src/base/abc/abcMinBase.c b/src/base/abc/abcMinBase.c index 1c913eea..84cf5cb3 100644 --- a/src/base/abc/abcMinBase.c +++ b/src/base/abc/abcMinBase.c @@ -578,6 +578,22 @@ int Abc_NodeCollapse1( Abc_Obj_t * pFanin, Abc_Obj_t * pFanout, Vec_Ptr_t * vFan Abc_NtkDeleteObj_rec( pFanout, 1 ); return 1; } +int Abc_NodeIsExor( Abc_Obj_t * pNode ) +{ + Hop_Man_t * pMan; + word Truth; + if ( Abc_ObjFaninNum(pNode) < 3 || Abc_ObjFaninNum(pNode) > 6 ) + return 0; + pMan = (Hop_Man_t *)pNode->pNtk->pManFunc; + Truth = Hop_ManComputeTruth6( pMan, (Hop_Obj_t *)pNode->pData, Abc_ObjFaninNum(pNode) ); + if ( Truth == 0x6666666666666666 || Truth == 0x9999999999999999 || + Truth == 0x9696969696969696 || Truth == 0x6969696969696969 || + Truth == 0x6996699669966996 || Truth == 0x9669966996699669 || + Truth == 0x9669699696696996 || Truth == 0x6996966969969669 || + Truth == 0x6996966996696996 || Truth == 0x9669699669969669 ) + return 1; + return 0; +} int Abc_NtkEliminate1One( Abc_Ntk_t * pNtk, int ElimValue, int nMaxSize, int fReverse, int fVerbose ) { Vec_Ptr_t * vFanouts, * vFanins, * vNodes; @@ -607,6 +623,8 @@ int Abc_NtkEliminate1One( Abc_Ntk_t * pNtk, int ElimValue, int nMaxSize, int fRe continue; if ( Abc_ObjFaninNum(pNode) > nMaxSize ) continue; + if ( Abc_NodeIsExor(pNode) ) + continue; // skip nodes with more than one fanout // if ( Abc_ObjFanoutNum(pNode) != 1 ) // continue; @@ -642,10 +660,10 @@ int Abc_NtkEliminate1One( Abc_Ntk_t * pNtk, int ElimValue, int nMaxSize, int fRe ABC_FREE( pPermFanout ); return 1; } -int Abc_NtkEliminate1( Abc_Ntk_t * pNtk, int ElimValue, int nMaxSize, int fReverse, int fVerbose ) +int Abc_NtkEliminate1( Abc_Ntk_t * pNtk, int ElimValue, int nMaxSize, int nIterMax, int fReverse, int fVerbose ) { int i; - for ( i = 0; i < 3; i++ ) + for ( i = 0; i < nIterMax; i++ ) { int nNodes = Abc_NtkNodeNum(pNtk); // printf( "%d ", nNodes ); diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 73e96054..84736382 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -3746,23 +3746,25 @@ usage: int Abc_CommandEliminate( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); - int nMaxSize; int ElimValue; + int nMaxSize; + int nIterMax; int fGreedy; int fReverse; int fVerbose; int c; extern int Abc_NtkEliminate( Abc_Ntk_t * pNtk, int nMaxSize, int fReverse, int fVerbose ); - extern int Abc_NtkEliminate1( Abc_Ntk_t * pNtk, int ElimValue, int nMaxSize, int fReverse, int fVerbose ); + extern int Abc_NtkEliminate1( Abc_Ntk_t * pNtk, int ElimValue, int nMaxSize, int nIterMax, int fReverse, int fVerbose ); // set the defaults - nMaxSize = 30; ElimValue = -1; + nMaxSize = 12; + nIterMax = 1; fGreedy = 0; fReverse = 0; fVerbose = 0; Extra_UtilGetoptReset(); - while ( (c = Extra_UtilGetopt(argc, argv, "VNgrvh")) != EOF ) + while ( (c = Extra_UtilGetopt(argc, argv, "VNIgrvh")) != EOF ) { switch (c) { @@ -3788,6 +3790,17 @@ int Abc_CommandEliminate( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( nMaxSize <= 0 ) goto usage; break; + case 'I': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-I\" should be followed by a positive integer.\n" ); + goto usage; + } + nIterMax = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nIterMax <= 0 ) + goto usage; + break; case 'g': fGreedy ^= 1; break; @@ -3826,15 +3839,16 @@ int Abc_CommandEliminate( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( fGreedy ) Abc_NtkEliminate( pNtk, nMaxSize, fReverse, fVerbose ); else - Abc_NtkEliminate1( pNtk, ElimValue, nMaxSize, fReverse, fVerbose ); + Abc_NtkEliminate1( pNtk, ElimValue, nMaxSize, nIterMax, fReverse, fVerbose ); return 0; usage: - Abc_Print( -2, "usage: eliminate [-VN <num>] [-grvh]\n"); + Abc_Print( -2, "usage: eliminate [-VNI <num>] [-grvh]\n"); Abc_Print( -2, "\t traditional \"eliminate -1\", which collapses the node into its fanout\n"); Abc_Print( -2, "\t if the node's variable appears in the fanout's factored form only once\n"); Abc_Print( -2, "\t-V <num> : the \"value\" parameter used by \"eliminate\" in SIS [default = %d]\n", ElimValue ); Abc_Print( -2, "\t-N <num> : the maximum node support after collapsing [default = %d]\n", nMaxSize ); + Abc_Print( -2, "\t-I <num> : the maximum number of iterations [default = %d]\n", nIterMax ); Abc_Print( -2, "\t-g : toggle using greedy eliminate (without \"value\") [default = %s]\n", fGreedy? "yes": "no" ); Abc_Print( -2, "\t-r : use the reverse topological order [default = %s]\n", fReverse? "yes": "no" ); Abc_Print( -2, "\t-v : print verbose information [default = %s]\n", fVerbose? "yes": "no" ); |