diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2022-02-22 21:14:48 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2022-02-22 21:14:48 -0800 |
commit | bcf21e46778f63ab4ce490b57648421a2b4d7e28 (patch) | |
tree | f35738df6caf0fd31e6cc6560bc529b475246445 /src/base/abci/abcRefactor.c | |
parent | 31519bd6d6c9cff4691019f72e0faf72e37bde88 (diff) | |
download | abc-bcf21e46778f63ab4ce490b57648421a2b4d7e28.tar.gz abc-bcf21e46778f63ab4ce490b57648421a2b4d7e28.tar.bz2 abc-bcf21e46778f63ab4ce490b57648421a2b4d7e28.zip |
Intersection a bug in rewrite/refactor.
Diffstat (limited to 'src/base/abci/abcRefactor.c')
-rw-r--r-- | src/base/abci/abcRefactor.c | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/base/abci/abcRefactor.c b/src/base/abci/abcRefactor.c index 3cc6d793..8ec5944f 100644 --- a/src/base/abci/abcRefactor.c +++ b/src/base/abci/abcRefactor.c @@ -325,7 +325,7 @@ void Abc_NtkManRefPrintStats( Abc_ManRef_t * p ) ***********************************************************************/ int Abc_NtkRefactor( Abc_Ntk_t * pNtk, int nNodeSizeMax, int nConeSizeMax, int fUpdateLevel, int fUseZeros, int fUseDcs, int fVerbose ) { - extern void Dec_GraphUpdateNetwork( Abc_Obj_t * pRoot, Dec_Graph_t * pGraph, int fUpdateLevel, int nGain ); + extern int Dec_GraphUpdateNetwork( Abc_Obj_t * pRoot, Dec_Graph_t * pGraph, int fUpdateLevel, int nGain ); ProgressBar * pProgress; Abc_ManRef_t * pManRef; Abc_ManCut_t * pManCut; @@ -333,7 +333,7 @@ int Abc_NtkRefactor( Abc_Ntk_t * pNtk, int nNodeSizeMax, int nConeSizeMax, int f Vec_Ptr_t * vFanins; Abc_Obj_t * pNode; abctime clk, clkStart = Abc_Clock(); - int i, nNodes; + int i, nNodes, RetValue = 1; assert( Abc_NtkIsStrash(pNtk) ); // cleanup the AIG @@ -377,7 +377,12 @@ pManRef->timeRes += Abc_Clock() - clk; continue; // acceptable replacement found, update the graph clk = Abc_Clock(); - Dec_GraphUpdateNetwork( pNode, pFForm, fUpdateLevel, pManRef->nLastGain ); + if ( !Dec_GraphUpdateNetwork( pNode, pFForm, fUpdateLevel, pManRef->nLastGain ) ) + { + Dec_GraphFree( pFForm ); + RetValue = -1; + break; + } pManRef->timeNtk += Abc_Clock() - clk; Dec_GraphFree( pFForm ); } @@ -394,18 +399,21 @@ pManRef->timeTotal = Abc_Clock() - clkStart; // put the nodes into the DFS order and reassign their IDs Abc_NtkReassignIds( pNtk ); // Abc_AigCheckFaninOrder( pNtk->pManFunc ); - // fix the levels - if ( fUpdateLevel ) - Abc_NtkStopReverseLevels( pNtk ); - else - Abc_NtkLevel( pNtk ); - // check - if ( !Abc_NtkCheck( pNtk ) ) + if ( RetValue != -1 ) { - printf( "Abc_NtkRefactor: The network check has failed.\n" ); - return 0; + // fix the levels + if ( fUpdateLevel ) + Abc_NtkStopReverseLevels( pNtk ); + else + Abc_NtkLevel( pNtk ); + // check + if ( !Abc_NtkCheck( pNtk ) ) + { + printf( "Abc_NtkRefactor: The network check has failed.\n" ); + return 0; + } } - return 1; + return RetValue; } |