diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index dcb67140a..602c6846b 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -20888,14 +20888,14 @@ int Abc_CommandRewire( Abc_Frame_t * pAbc, int argc, char ** argv ) pFile = fopen( argv[globalUtilOptind], "rb" ); if ( pFile == NULL ) { - Abc_Print( -1, "Cannot open input file \"%s\". ", argv[globalUtilOptind] ); + Abc_Print( -1, "Cannot open input file \"%s\".\n", argv[globalUtilOptind] ); return 1; } fclose( pFile ); pExc = Gia_AigerRead( argv[globalUtilOptind], 0, 0, 0 ); if ( pExc == NULL ) { - Abc_Print( -1, "Reading Exc AIGER has failed.\n" ); + Abc_Print( -1, "Reading AIGER has failed.\n" ); return 1; } globalUtilOptind++; @@ -20927,6 +20927,11 @@ int Abc_CommandRewire( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_Print( -1, "Empty network.\n" ); return 1; } + if ( !Abc_NtkIsStrash(pNtk) ) + { + Abc_Print( -1, "Rewiring works only for the AIG representation (run \"strash\").\n" ); + return 1; + } if ( nMode >= 1 && Abc_FrameReadLibGen2() == NULL ) { Abc_Print( -1, "Library is not available.\n" ); @@ -46572,14 +46577,14 @@ int Abc_CommandAbc9Rewire( Abc_Frame_t * pAbc, int argc, char ** argv ) pFile = fopen( argv[globalUtilOptind], "rb" ); if ( pFile == NULL ) { - Abc_Print( -1, "Cannot open input file \"%s\". ", argv[globalUtilOptind] ); + Abc_Print( -1, "Cannot open input file \"%s\".\n", argv[globalUtilOptind] ); return 1; } fclose( pFile ); pExc = Gia_AigerRead( argv[globalUtilOptind], 0, 0, 0 ); if ( pExc == NULL ) { - Abc_Print( -1, "Reading Exc AIGER has failed.\n" ); + Abc_Print( -1, "Reading AIGER has failed.\n" ); return 1; } globalUtilOptind++; diff --git a/src/opt/rar/rewire_miaig.cpp b/src/opt/rar/rewire_miaig.cpp index dffb29fa7..813a8ef80 100644 --- a/src/opt/rar/rewire_miaig.cpp +++ b/src/opt/rar/rewire_miaig.cpp @@ -247,15 +247,18 @@ vi *moveVecToVi(Vec_Int_t *v) { void Miaig::setExc(Gia_Man_t *pExc) { int i; assert(Gia_ManCiNum(pExc) == nIns()); - assert(Gia_ManCoNum(pExc) == nOuts()); + assert(Gia_ManCoNum(pExc) == nOuts() || Gia_ManCoNum(pExc) == 1); + if (Gia_ManCoNum(pExc) != nOuts() && Gia_ManCoNum(pExc) == 1) { + printf("[Warning] The external careset has only a single output that will be applied to all other outputs.\n"); + } if (!_data->pExc) { _data->pExc = (word *)malloc(sizeof(word) * nWords() * nOuts()); } Miaig Exc(pExc); Exc.initializeTruth(); for (i = 0; i < nOuts(); ++i) { - word *pExc = Exc.objTruth(Exc.nObjs() - Exc.nOuts() + i, 0); - Tt_Dup(_data->pExc + nWords() * i, pExc, nWords()); + word *tExc = Exc.objTruth(Exc.nObjs() - Exc.nOuts() + std::min(i, Gia_ManCoNum(pExc)-1), 0); + Tt_Dup(_data->pExc + nWords() * i, tExc, nWords()); } } #endif // RW_ABC @@ -1219,6 +1222,7 @@ Miaig Miaig::rewire(int nIters, float levelGrowRatio, int nExpands, int nGrowth, for (int i = 0; nIters ? i < nIters : 1; i++) { if (nVerbose) printf("\rIteration %7d : %5g -> ", i + 1, ((&pRoot)->*Miaig_ObjectiveFunction)(0, nMappedMode)); if (nTimeOut && nTimeOut < 1.0 * (Time_Clock() - clkStart) / CLOCKS_PER_SEC) break; + if (PrevBest == 0) break; pNew = pRoot.dupMulti(nFaninMax, nGrowth); if (i % 2 == 0) {