Merge pull request #402 from chenjunhao0315/master

command rewire add external care
This commit is contained in:
alanminko 2025-04-10 21:02:10 +07:00 committed by GitHub
commit 1177cfabfb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 202 additions and 79 deletions

View File

@ -20773,15 +20773,17 @@ usage:
***********************************************************************/ ***********************************************************************/
int Abc_CommandRewire( Abc_Frame_t * pAbc, int argc, char ** argv ) int Abc_CommandRewire( Abc_Frame_t * pAbc, int argc, char ** argv )
{ {
extern Abc_Ntk_t *Abc_ManRewire(Abc_Ntk_t *pNtk, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fVerbose); extern Abc_Ntk_t *Abc_ManRewire(Abc_Ntk_t *pNtk, Gia_Man_t *pExc, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fCheck, int fVerbose);
Abc_Ntk_t *pNtk, *pTemp; Abc_Ntk_t *pNtk, *pTemp;
int c, nIters = 100000, nExpands = 128, nGrowth = 4, nDivs = -1, nFaninMax = 8, nSeed = 1, nTimeOut = 0, nVerbose = 1, nMode = 0, nMappedMode = 0, nDist = 0; Gia_Man_t *pExc = NULL;
FILE *pFile = NULL;
int c, nIters = 100000, nExpands = 128, nGrowth = 4, nDivs = -1, nFaninMax = 8, nSeed = 1, nTimeOut = 0, nVerbose = 1, nMode = 0, nMappedMode = 0, nDist = 0, fCheck = 0;
float nLevelGrowRatio = 0; float nLevelGrowRatio = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
pNtk = Abc_FrameReadNtk(pAbc); pNtk = Abc_FrameReadNtk(pAbc);
while ( ( c = Extra_UtilGetopt( argc, argv, "IEGDFSTMALRVh" ) ) != EOF ) { while ( ( c = Extra_UtilGetopt( argc, argv, "IEGDFSTMALRCVch" ) ) != EOF ) {
switch ( c ) { switch ( c ) {
case 'I': case 'I':
if ( globalUtilOptind >= argc ) if ( globalUtilOptind >= argc )
@ -20882,6 +20884,22 @@ int Abc_CommandRewire( Abc_Frame_t * pAbc, int argc, char ** argv )
nLevelGrowRatio = atof(argv[globalUtilOptind]); nLevelGrowRatio = atof(argv[globalUtilOptind]);
globalUtilOptind++; globalUtilOptind++;
break; break;
case 'C':
pFile = fopen( argv[globalUtilOptind], "rb" );
if ( pFile == NULL )
{
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 AIGER has failed.\n" );
return 1;
}
globalUtilOptind++;
break;
case 'V': case 'V':
if ( globalUtilOptind >= argc ) if ( globalUtilOptind >= argc )
{ {
@ -20891,6 +20909,9 @@ int Abc_CommandRewire( Abc_Frame_t * pAbc, int argc, char ** argv )
nVerbose = atoi(argv[globalUtilOptind]); nVerbose = atoi(argv[globalUtilOptind]);
globalUtilOptind++; globalUtilOptind++;
break; break;
case 'c':
fCheck ^= 1;
break;
case 'h': case 'h':
default: default:
goto usage; goto usage;
@ -20906,13 +20927,20 @@ int Abc_CommandRewire( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -1, "Empty network.\n" ); Abc_Print( -1, "Empty network.\n" );
return 1; return 1;
} }
if ( nMode == 0 && !Abc_NtkIsStrash(pNtk) )
{
Abc_Print( -1, "Rewiring works only for the AIG representation (run \"strash\").\n" );
return 1;
}
if ( nMode >= 1 && Abc_FrameReadLibGen2() == NULL ) if ( nMode >= 1 && Abc_FrameReadLibGen2() == NULL )
{ {
Abc_Print( -1, "Library is not available.\n" ); Abc_Print( -1, "Library is not available.\n" );
return 1; return 1;
} }
pTemp = Abc_ManRewire( pNtk, nIters, nLevelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, nMode, nMappedMode, nDist, nSeed, nVerbose ); pTemp = Abc_ManRewire( pNtk, pExc, nIters, nLevelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, nMode, nMappedMode, nDist, nSeed, fCheck, nVerbose );
if ( pExc )
Gia_ManStop( pExc );
Abc_FrameReplaceCurrentNetwork( pAbc, pTemp ); Abc_FrameReplaceCurrentNetwork( pAbc, pTemp );
return 0; return 0;
@ -20927,9 +20955,11 @@ usage:
Abc_Print( -2, "\t-R <num> : level constraint (0: unlimited, 1: preserve level) [default = %g]\n", nLevelGrowRatio); Abc_Print( -2, "\t-R <num> : level constraint (0: unlimited, 1: preserve level) [default = %g]\n", nLevelGrowRatio);
Abc_Print( -2, "\t-M <num> : optimization target [default = %s]\n", nMode ? "area" : "AIG node" ); Abc_Print( -2, "\t-M <num> : optimization target [default = %s]\n", nMode ? "area" : "AIG node" );
Abc_Print( -2, "\t-A <num> : mapper (0: amap, 1: &nf, 2: &simap) (experimental) [default = %d]\n", nMappedMode ); Abc_Print( -2, "\t-A <num> : mapper (0: amap, 1: &nf, 2: &simap) (experimental) [default = %d]\n", nMappedMode );
Abc_Print( -2, "\t-C <file> : AIGER specifying external cares\n");
Abc_Print( -2, "\t-S <num> : the random seed (0: random, >= 1: user defined) [default = %d]\n", nSeed ); Abc_Print( -2, "\t-S <num> : the random seed (0: random, >= 1: user defined) [default = %d]\n", nSeed );
Abc_Print( -2, "\t-T <num> : the timeout in seconds (0: unlimited) [default = %d]\n", nTimeOut ); Abc_Print( -2, "\t-T <num> : the timeout in seconds (0: unlimited) [default = %d]\n", nTimeOut );
Abc_Print( -2, "\t-V <num> : the verbosity level [default = %d]\n", nVerbose ); Abc_Print( -2, "\t-V <num> : the verbosity level [default = %d]\n", nVerbose );
Abc_Print( -2, "\t-c : check the equivalence [default = %s]\n", fCheck ? "yes" : "no" );
Abc_Print( -2, "\t-h : prints the command usage\n" ); Abc_Print( -2, "\t-h : prints the command usage\n" );
Abc_Print( -2, "\n\tThis command was contributed by Jiun-Hao Chen from National Taiwan University.\n" ); Abc_Print( -2, "\n\tThis command was contributed by Jiun-Hao Chen from National Taiwan University.\n" );
return 1; return 1;
@ -46435,13 +46465,14 @@ usage:
***********************************************************************/ ***********************************************************************/
int Abc_CommandAbc9Rewire( Abc_Frame_t * pAbc, int argc, char ** argv ) int Abc_CommandAbc9Rewire( Abc_Frame_t * pAbc, int argc, char ** argv )
{ {
extern Gia_Man_t *Gia_ManRewire(Gia_Man_t *pGia, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fVerbose); extern Gia_Man_t *Gia_ManRewire(Gia_Man_t *pGia, Gia_Man_t *pExc, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fCheck, int fVerbose);
Gia_Man_t *pTemp; FILE *pFile = NULL;
int c, nIters = 100000, nExpands = 128, nGrowth = 4, nDivs = -1, nFaninMax = 8, nSeed = 1, nTimeOut = 0, nVerbose = 1, nMode = 0, nMappedMode = 0, nDist = 0; Gia_Man_t *pTemp, *pExc = NULL;
int c, nIters = 100000, nExpands = 128, nGrowth = 4, nDivs = -1, nFaninMax = 8, nSeed = 1, nTimeOut = 0, nVerbose = 1, nMode = 0, nMappedMode = 0, nDist = 0, fCheck = 0;
float nLevelGrowRatio = 0; float nLevelGrowRatio = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "IEGDFSTMALRVh" ) ) != EOF ) { while ( ( c = Extra_UtilGetopt( argc, argv, "IEGDFSTMALRCVch" ) ) != EOF ) {
switch ( c ) { switch ( c ) {
case 'I': case 'I':
if ( globalUtilOptind >= argc ) if ( globalUtilOptind >= argc )
@ -46542,6 +46573,22 @@ int Abc_CommandAbc9Rewire( Abc_Frame_t * pAbc, int argc, char ** argv )
nLevelGrowRatio = atof(argv[globalUtilOptind]); nLevelGrowRatio = atof(argv[globalUtilOptind]);
globalUtilOptind++; globalUtilOptind++;
break; break;
case 'C':
pFile = fopen( argv[globalUtilOptind], "rb" );
if ( pFile == NULL )
{
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 AIGER has failed.\n" );
return 1;
}
globalUtilOptind++;
break;
case 'V': case 'V':
if ( globalUtilOptind >= argc ) if ( globalUtilOptind >= argc )
{ {
@ -46551,6 +46598,9 @@ int Abc_CommandAbc9Rewire( Abc_Frame_t * pAbc, int argc, char ** argv )
nVerbose = atoi(argv[globalUtilOptind]); nVerbose = atoi(argv[globalUtilOptind]);
globalUtilOptind++; globalUtilOptind++;
break; break;
case 'c':
fCheck ^= 1;
break;
case 'h': case 'h':
default: default:
goto usage; goto usage;
@ -46572,9 +46622,9 @@ int Abc_CommandAbc9Rewire( Abc_Frame_t * pAbc, int argc, char ** argv )
return 1; return 1;
} }
pTemp = Gia_ManRewire( pAbc->pGia, nIters, nLevelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, nMode, nMappedMode, nDist, nSeed, nVerbose ); pTemp = Gia_ManRewire( pAbc->pGia, pExc, nIters, nLevelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, nMode, nMappedMode, nDist, nSeed, fCheck, nVerbose );
if ( pTemp->pName == NULL ) if ( pExc )
pTemp->pName = Abc_UtilStrsav(Extra_FileNameWithoutPath(pAbc->pGia->pName)); Gia_ManStop( pExc );
Abc_FrameUpdateGia( pAbc, pTemp ); Abc_FrameUpdateGia( pAbc, pTemp );
return 0; return 0;
@ -46590,9 +46640,11 @@ usage:
Abc_Print( -2, "\t-R <num> : level constraint (0: unlimited, 1: preserve level) [default = %g]\n", nLevelGrowRatio); Abc_Print( -2, "\t-R <num> : level constraint (0: unlimited, 1: preserve level) [default = %g]\n", nLevelGrowRatio);
Abc_Print( -2, "\t-M <num> : optimization target [default = %s]\n", nMode ? "area" : "AIG node" ); Abc_Print( -2, "\t-M <num> : optimization target [default = %s]\n", nMode ? "area" : "AIG node" );
Abc_Print( -2, "\t-A <num> : mapper (0: amap, 1: &nf, 2: &simap) (experimental) [default = %d]\n", nMappedMode ); Abc_Print( -2, "\t-A <num> : mapper (0: amap, 1: &nf, 2: &simap) (experimental) [default = %d]\n", nMappedMode );
Abc_Print( -2, "\t-C <file> : AIGER specifying external cares\n");
Abc_Print( -2, "\t-S <num> : the random seed (0: random, >= 1: user defined) [default = %d]\n", nSeed ); Abc_Print( -2, "\t-S <num> : the random seed (0: random, >= 1: user defined) [default = %d]\n", nSeed );
Abc_Print( -2, "\t-T <num> : the timeout in seconds (0: unlimited) [default = %d]\n", nTimeOut ); Abc_Print( -2, "\t-T <num> : the timeout in seconds (0: unlimited) [default = %d]\n", nTimeOut );
Abc_Print( -2, "\t-V <num> : the verbosity level [default = %d]\n", nVerbose ); Abc_Print( -2, "\t-V <num> : the verbosity level [default = %d]\n", nVerbose );
Abc_Print( -2, "\t-c : check the equivalence [default = %s]\n", fCheck ? "yes" : "no" );
Abc_Print( -2, "\t-h : prints the command usage\n" ); Abc_Print( -2, "\t-h : prints the command usage\n" );
Abc_Print( -2, "\n\tThis command was contributed by Jiun-Hao Chen from National Taiwan University.\n" ); Abc_Print( -2, "\n\tThis command was contributed by Jiun-Hao Chen from National Taiwan University.\n" );
return 1; return 1;

View File

@ -26,22 +26,28 @@ ABC_NAMESPACE_IMPL_START
#endif // RW_ABC #endif // RW_ABC
#ifdef RW_ABC #ifdef RW_ABC
Gia_Man_t *Gia_ManRewireInt(Gia_Man_t *pGia, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fVerbose) { Gia_Man_t *Gia_ManRewireInt(Gia_Man_t *pGia, Gia_Man_t *pExc, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fCheck, int fVerbose) {
Random_Num(nSeed == 0 ? Abc_Random(0) % 10 : nSeed); Random_Num(nSeed == 0 ? Abc_Random(0) % 10 : nSeed);
assert(Gia_ManCiNum(pGia) <= 58);
Rewire::Miaig pNtkMiaig(pGia); Rewire::Miaig pNtkMiaig(pGia);
Rewire::Miaig pNew = pNtkMiaig.rewire(nIters, levelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, nMode, nMappedMode, nDist, fVerbose); if (pExc)
pNtkMiaig.setExc(pExc);
Rewire::Miaig pNew = pNtkMiaig.rewire(nIters, levelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, nMode, nMappedMode, nDist, fCheck, fVerbose);
pNew.setName(Gia_ManName(pGia)); pNew.setName(Gia_ManName(pGia));
return pNew.toGia(); return pNew.toGia();
} }
Abc_Ntk_t *Abc_ManRewireInt(Abc_Ntk_t *pNtk, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fVerbose) { Abc_Ntk_t *Abc_ManRewireInt(Abc_Ntk_t *pNtk, Gia_Man_t *pExc, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fCheck, int fVerbose) {
Random_Num(nSeed == 0 ? Abc_Random(0) % 10 : nSeed); Random_Num(nSeed == 0 ? Abc_Random(0) % 10 : nSeed);
assert(Abc_NtkCiNum(pNtk) <= 58);
int fMapped = nMode == 1; int fMapped = nMode == 1;
Rewire::Miaig pNtkMiaig(pNtk); Rewire::Miaig pNtkMiaig(pNtk);
Rewire::Miaig pNew = pNtkMiaig.rewire(nIters, levelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, fMapped, nMappedMode, nDist, fVerbose); if (pExc)
pNtkMiaig.setExc(pExc);
Rewire::Miaig pNew = pNtkMiaig.rewire(nIters, levelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, fMapped, nMappedMode, nDist, fCheck, fVerbose);
pNew.setName(Abc_NtkName(pNtk)); pNew.setName(Abc_NtkName(pNtk));
if (nMode == 2) { if (nMode == 2) {
pNew.countTransistors(1, nMappedMode); pNew.countTransistors(1, nMappedMode);
@ -50,11 +56,14 @@ Abc_Ntk_t *Abc_ManRewireInt(Abc_Ntk_t *pNtk, int nIters, float levelGrowRatio, i
return pNew.toNtk(nMode >= 1); return pNew.toNtk(nMode >= 1);
} }
Mini_Aig_t *MiniAig_ManRewireInt(Mini_Aig_t *pAig, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fVerbose) { Mini_Aig_t *MiniAig_ManRewireInt(Mini_Aig_t *pAig, Gia_Man_t *pExc, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fCheck, int fVerbose) {
Random_Num(nSeed == 0 ? Abc_Random(0) % 10 : nSeed); Random_Num(nSeed == 0 ? Abc_Random(0) % 10 : nSeed);
assert(Mini_AigPiNum(pAig) <= 58);
Rewire::Miaig pNtkMiaig(pAig); Rewire::Miaig pNtkMiaig(pAig);
Rewire::Miaig pNew = pNtkMiaig.rewire(nIters, levelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, nMode, nMappedMode, nDist, fVerbose); if (pExc)
pNtkMiaig.setExc(pExc);
Rewire::Miaig pNew = pNtkMiaig.rewire(nIters, levelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, nMode, nMappedMode, nDist, fCheck, fVerbose);
return pNew.toMiniAig(); return pNew.toMiniAig();
} }
@ -234,6 +243,24 @@ vi *moveVecToVi(Vec_Int_t *v) {
free(v); free(v);
return p; return p;
} }
void Miaig::setExc(Gia_Man_t *pExc) {
int i;
assert(Gia_ManCiNum(pExc) == nIns());
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 *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 #endif // RW_ABC
// technology mapping // technology mapping
@ -753,15 +780,24 @@ void Miaig::initializeTruth(void) {
Tt_Dup(objTruth(i, 2), objTruth(i, 0), nWords()); Tt_Dup(objTruth(i, 2), objTruth(i, 0), nWords());
} }
void Miaig::truthUpdate(vi *vTfo) { void Miaig::truthUpdate(vi *vTfo, word *pExc, int fCheck) {
int i, iTemp, nFails = 0; int i, iTemp, nFails = 0;
nTravIds()++; nTravIds()++;
if (!pExc) {
Vi_ForEachEntry(vTfo, iTemp, i) { Vi_ForEachEntry(vTfo, iTemp, i) {
truthSimNode(iTemp); truthSimNode(iTemp);
if (objIsPo(iTemp) && !Tt_Equal(objTruth(iTemp, 2), objTruth(iTemp, 0), nWords())) if (fCheck && objIsPo(iTemp) && !Tt_Equal(objTruth(iTemp, 2), objTruth(iTemp, 0), nWords()))
printf("Verification failed at output %d.\n", iTemp - (nObjs() - nOuts())), nFails++; printf("Verification failed at output %d.\n", iTemp - (nObjs() - nOuts())), nFails++;
} }
if (nFails) } else {
Vi_ForEachEntry(vTfo, iTemp, i) {
truthSimNode(iTemp);
if (fCheck && objIsPo(iTemp) && !Tt_EqualOnCare(pExc + objPoIdx(iTemp) * nWords(), objTruth(iTemp, 2), objTruth(iTemp, 0), nWords())) {
printf("Verification failed at output %d.\n", iTemp - (nObjs() - nOuts())), nFails++;
}
}
}
if (fCheck && nFails)
printf("Verification failed for %d outputs after updating node %d.\n", nFails, Vi_Read(vTfo, 0)); printf("Verification failed for %d outputs after updating node %d.\n", nFails, Vi_Read(vTfo, 0));
} }
@ -795,16 +831,24 @@ vi *Miaig::computeTfo(int iObj) {
return _data->vTfo; return _data->vTfo;
} }
word *Miaig::computeCareSet(int iObj) { word *Miaig::computeCareSet(int iObj, word *pExc) {
vi *vTfo = computeTfo(iObj); vi *vTfo = computeTfo(iObj);
int i, iTemp; int i, iTemp;
Tt_Not(objTruth(iObj, 1), objTruth(iObj, 0), nWords()); Tt_Not(objTruth(iObj, 1), objTruth(iObj, 0), nWords());
Tt_Clear(_data->pCare, nWords()); Tt_Clear(_data->pCare, nWords());
if (!pExc) {
Vi_ForEachEntryStart(vTfo, iTemp, i, 1) { Vi_ForEachEntryStart(vTfo, iTemp, i, 1) {
truthSimNode(iTemp); truthSimNode(iTemp);
if (objIsPo(iTemp)) if (objIsPo(iTemp))
Tt_OrXor(_data->pCare, objTruth(iTemp, 0), objTruth(iTemp, 1), nWords()); Tt_OrXor(_data->pCare, objTruth(iTemp, 0), objTruth(iTemp, 1), nWords());
} }
} else {
Vi_ForEachEntryStart(vTfo, iTemp, i, 1) {
truthSimNode(iTemp);
if (objIsPo(iTemp))
Tt_OrXorAnd(_data->pCare, objTruth(iTemp, 0), objTruth(iTemp, 1), pExc + objPoIdx(iTemp) * nWords(), nWords());
}
}
return _data->pCare; return _data->pCare;
} }
@ -916,13 +960,13 @@ int Miaig::findShared(int nNewNodesMax) {
return i; return i;
} }
int Miaig::checkConst(int iObj, word *pCare, int fVerbose) { int Miaig::checkConst(int iObj, word *pCare, word *pExc, int fCheck, int fVerbose) {
word *pFunc = objTruth(iObj, 0); word *pFunc = objTruth(iObj, 0);
if (!Tt_IntersectC(pCare, pFunc, 0, nWords())) { if (!Tt_IntersectC(pCare, pFunc, 0, nWords())) {
derefObj_rec(iObj, -1); derefObj_rec(iObj, -1);
Vi_Fill(_data->pvFans + iObj, 1, 0); // const0 Vi_Fill(_data->pvFans + iObj, 1, 0); // const0
refObj(iObj); refObj(iObj);
truthUpdate(_data->vTfo); truthUpdate(_data->vTfo, pExc, fCheck);
if (fVerbose) printf("Detected Const0 at node %d.\n", iObj); if (fVerbose) printf("Detected Const0 at node %d.\n", iObj);
return 1; return 1;
} }
@ -930,16 +974,16 @@ int Miaig::checkConst(int iObj, word *pCare, int fVerbose) {
derefObj_rec(iObj, -1); derefObj_rec(iObj, -1);
Vi_Fill(_data->pvFans + iObj, 1, 1); // const1 Vi_Fill(_data->pvFans + iObj, 1, 1); // const1
refObj(iObj); refObj(iObj);
truthUpdate(_data->vTfo); truthUpdate(_data->vTfo, pExc, fCheck);
if (fVerbose) printf("Detected Const1 at node %d.\n", iObj); if (fVerbose) printf("Detected Const1 at node %d.\n", iObj);
return 1; return 1;
} }
return 0; return 0;
} }
int Miaig::expandOne(int iObj, int nAddedMax, int nDist, int nExpandableLevel, int fVerbose) { int Miaig::expandOne(int iObj, int nAddedMax, int nDist, int nExpandableLevel, word *pExc, int fCheck, int fVerbose) {
int i, k, n, iLit, nAdded = 0; int i, k, n, iLit, nAdded = 0;
word *pCare = computeCareSet(iObj); word *pCare = computeCareSet(iObj, pExc);
assert(nAddedMax > 0); assert(nAddedMax > 0);
assert(nAddedMax <= Vi_Space(_data->pvFans + iObj)); assert(nAddedMax <= Vi_Space(_data->pvFans + iObj));
// mark node's fanins // mark node's fanins
@ -986,15 +1030,15 @@ int Miaig::expandOne(int iObj, int nAddedMax, int nDist, int nExpandableLevel, i
break; break;
} }
//printf( "Updating TFO of node %d: ", iObj ); Vi_Print(_data->vTfo); //printf( "Updating TFO of node %d: ", iObj ); Vi_Print(_data->vTfo);
truthUpdate(_data->vTfo); truthUpdate(_data->vTfo, pExc, fCheck);
//assert( objFaninNum(iObj) <= nFaninMax ); //assert( objFaninNum(iObj) <= nFaninMax );
return nAdded; return nAdded;
} }
int Miaig::reduceOne(int iObj, int fOnlyConst, int fOnlyBuffer, int fHeuristic, int fVerbose) { int Miaig::reduceOne(int iObj, int fOnlyConst, int fOnlyBuffer, int fHeuristic, word *pExc, int fCheck, int fVerbose) {
int n, k, iLit, nFans = objFaninNum(iObj); int n, k, iLit, nFans = objFaninNum(iObj);
word *pCare = computeCareSet(iObj); word *pCare = computeCareSet(iObj, pExc);
if (checkConst(iObj, pCare, fVerbose)) if (checkConst(iObj, pCare, pExc, fCheck, fVerbose))
return nFans; return nFans;
if (fOnlyConst) if (fOnlyConst)
return 0; return 0;
@ -1008,7 +1052,7 @@ int Miaig::reduceOne(int iObj, int fOnlyConst, int fOnlyBuffer, int fHeuristic,
derefObj(iObj); derefObj(iObj);
Vi_Fill(_data->pvFans + iObj, 1, iLit); Vi_Fill(_data->pvFans + iObj, 1, iLit);
refObj(iObj); refObj(iObj);
truthUpdate(_data->vTfo); truthUpdate(_data->vTfo, pExc, fCheck);
if (fVerbose) printf("Reducing node %d fanin count from %d to %d.\n", iObj, nFans, objFaninNum(iObj)); if (fVerbose) printf("Reducing node %d fanin count from %d to %d.\n", iObj, nFans, objFaninNum(iObj));
return nFans - 1; return nFans - 1;
} }
@ -1049,16 +1093,16 @@ int Miaig::reduceOne(int iObj, int fOnlyConst, int fOnlyBuffer, int fHeuristic,
Vi_ForEachEntry(_data->vOrderF, iLit, k) Vi_ForEachEntry(_data->vOrderF, iLit, k)
Vi_PushOrder(_data->pvFans + iObj, iLit); Vi_PushOrder(_data->pvFans + iObj, iLit);
refObj(iObj); refObj(iObj);
truthUpdate(_data->vTfo); truthUpdate(_data->vTfo, pExc, fCheck);
if (fVerbose) printf("Reducing node %d fanin count from %d to %d.\n", iObj, nFans, objFaninNum(iObj)); if (fVerbose) printf("Reducing node %d fanin count from %d to %d.\n", iObj, nFans, objFaninNum(iObj));
return nFans - Vi_Size(_data->vOrderF); return nFans - Vi_Size(_data->vOrderF);
} }
return 0; return 0;
} }
int Miaig::expandThenReduceOne(int iNode, int nFaninAddLimit, int nDist, int nExpandableLevel, int fVerbose) { int Miaig::expandThenReduceOne(int iNode, int nFaninAddLimit, int nDist, int nExpandableLevel, word *pExc, int fCheck, int fVerbose) {
expandOne(iNode, Abc_MinInt(Vi_Space(_data->pvFans + iNode), nFaninAddLimit), nDist, nExpandableLevel, fVerbose); expandOne(iNode, Abc_MinInt(Vi_Space(_data->pvFans + iNode), nFaninAddLimit), nDist, nExpandableLevel, pExc, fCheck, fVerbose);
reduceOne(iNode, 0, 0, 0, fVerbose); reduceOne(iNode, 0, 0, 0, pExc, fCheck, fVerbose);
return 0; return 0;
} }
@ -1071,7 +1115,7 @@ vi *Miaig::createRandomOrder(void) {
return _data->vOrder; return _data->vOrder;
} }
Miaig Miaig::expand(int nFaninAddLimitAll, int nDist, int nExpandableLevel, int fVerbose) { Miaig Miaig::expand(int nFaninAddLimitAll, int nDist, int nExpandableLevel, word *pExc, int fCheck, int fVerbose) {
int i, iNode, nAdded = 0; int i, iNode, nAdded = 0;
assert(nFaninAddLimitAll > 0); assert(nFaninAddLimitAll > 0);
vi *vOrder = createRandomOrder(); vi *vOrder = createRandomOrder();
@ -1081,7 +1125,7 @@ Miaig Miaig::expand(int nFaninAddLimitAll, int nDist, int nExpandableLevel, int
initializeLevels(); initializeLevels();
if (nDist) initializeDists(); if (nDist) initializeDists();
Vi_ForEachEntry(vOrder, iNode, i) { Vi_ForEachEntry(vOrder, iNode, i) {
nAdded += expandOne(iNode, Abc_MinInt(Vi_Space(_data->pvFans + iNode), nFaninAddLimitAll - nAdded), nDist, nExpandableLevel, fVerbose); nAdded += expandOne(iNode, Abc_MinInt(Vi_Space(_data->pvFans + iNode), nFaninAddLimitAll - nAdded), nDist, nExpandableLevel, pExc, fCheck, fVerbose);
if (nAdded >= nFaninAddLimitAll) if (nAdded >= nFaninAddLimitAll)
break; break;
} }
@ -1103,7 +1147,7 @@ Miaig Miaig::share(int nNewNodesMax) {
return pNew; return pNew;
} }
Miaig Miaig::reduce(int fVerbose) { Miaig Miaig::reduce(word *pExc, int fCheck, int fVerbose) {
int i, iNode; int i, iNode;
vi *vOrder = topoCollect(); vi *vOrder = topoCollect();
@ -1112,12 +1156,12 @@ Miaig Miaig::reduce(int fVerbose) {
initializeLevels(); initializeLevels();
// works best for final // works best for final
Vi_ForEachEntry(vOrder, iNode, i) Vi_ForEachEntry(vOrder, iNode, i)
reduceOne(iNode, 0, 0, 1, fVerbose); reduceOne(iNode, 0, 0, 1, pExc, fCheck, fVerbose);
verifyRefs(); verifyRefs();
return dupStrash(1, 1, 1); return dupStrash(1, 1, 1);
} }
Miaig Miaig::expandThenReduce(int nFaninAddLimit, int nDist, int nExpandableLevel, int fVerbose) { Miaig Miaig::expandThenReduce(int nFaninAddLimit, int nDist, int nExpandableLevel, word *pExc, int fCheck, int fVerbose) {
Miaig pTemp; Miaig pTemp;
int i, iNode; int i, iNode;
vi *vOrder = topoCollect(); vi *vOrder = topoCollect();
@ -1127,19 +1171,19 @@ Miaig Miaig::expandThenReduce(int nFaninAddLimit, int nDist, int nExpandableLeve
initializeLevels(); initializeLevels();
if (nDist) initializeDists(); if (nDist) initializeDists();
Vi_ForEachEntry(vOrder, iNode, i) { Vi_ForEachEntry(vOrder, iNode, i) {
expandThenReduceOne(iNode, nFaninAddLimit, nDist, nExpandableLevel, fVerbose); expandThenReduceOne(iNode, nFaninAddLimit, nDist, nExpandableLevel, pExc, fCheck, fVerbose);
} }
verifyRefs(); verifyRefs();
return dupDfs().dupStrash(1, 1, 1); return dupDfs().dupStrash(1, 1, 1);
} }
Miaig Miaig::expandShareReduce(int nFaninAddLimitAll, int nDivs, int nDist, int nExpandableLevel, int nVerbose) { Miaig Miaig::expandShareReduce(int nFaninAddLimitAll, int nDivs, int nDist, int nExpandableLevel, word *pExc, int fCheck, int nVerbose) {
// expand // expand
Miaig pNew = expand(nFaninAddLimitAll, nDist, nExpandableLevel, nVerbose); Miaig pNew = expand(nFaninAddLimitAll, nDist, nExpandableLevel, pExc, fCheck, nVerbose);
// share // share
pNew = pNew.share(nDivs == -1 ? pNew.nObjs() : nDivs); pNew = pNew.share(nDivs == -1 ? pNew.nObjs() : nDivs);
// reduce // reduce
pNew = pNew.reduce(nVerbose); pNew = pNew.reduce(pExc, fCheck, nVerbose);
return pNew; return pNew;
} }
@ -1156,7 +1200,7 @@ Miaig randomRead(std::vector<Miaig> &pBests) {
return pBests[Random_Num(0) % pBests.size()]; return pBests[Random_Num(0) % pBests.size()];
} }
Miaig Miaig::rewire(int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nVerbose) { Miaig Miaig::rewire(int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int fCheck, int nVerbose) {
const int nRootSave = 8; const int nRootSave = 8;
const int nBestSave = 4; const int nBestSave = 4;
int nRestart = 5000; int nRestart = 5000;
@ -1169,6 +1213,7 @@ Miaig Miaig::rewire(int nIters, float levelGrowRatio, int nExpands, int nGrowth,
float (Miaig::*Miaig_ObjectiveFunction)(int, int) = (nMode == 0) ? &Miaig::countAnd2 : &Miaig::countTransistors; float (Miaig::*Miaig_ObjectiveFunction)(int, int) = (nMode == 0) ? &Miaig::countAnd2 : &Miaig::countTransistors;
int maxLevel = levelGrowRatio != 0 ? this->countLevel() * levelGrowRatio : 0; int maxLevel = levelGrowRatio != 0 ? this->countLevel() * levelGrowRatio : 0;
int nExpandableLevel = maxLevel ? maxLevel - this->countLevel() : 0; int nExpandableLevel = maxLevel ? maxLevel - this->countLevel() : 0;
word *pExc = _data->pExc;
float PrevBest = ((&pBest)->*Miaig_ObjectiveFunction)(1, nMappedMode); float PrevBest = ((&pBest)->*Miaig_ObjectiveFunction)(1, nMappedMode);
int iterNotImproveAfterRestart = 0; int iterNotImproveAfterRestart = 0;
@ -1177,12 +1222,13 @@ Miaig Miaig::rewire(int nIters, float levelGrowRatio, int nExpands, int nGrowth,
for (int i = 0; nIters ? i < nIters : 1; i++) { for (int i = 0; nIters ? i < nIters : 1; i++) {
if (nVerbose) printf("\rIteration %7d : %5g -> ", i + 1, ((&pRoot)->*Miaig_ObjectiveFunction)(0, nMappedMode)); 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 (nTimeOut && nTimeOut < 1.0 * (Time_Clock() - clkStart) / CLOCKS_PER_SEC) break;
if (PrevBest == 0) break;
pNew = pRoot.dupMulti(nFaninMax, nGrowth); pNew = pRoot.dupMulti(nFaninMax, nGrowth);
if (i % 2 == 0) { if (i % 2 == 0) {
pNew = pNew.expandThenReduce(nGrowth, nDist, nExpandableLevel, nVerbose > 1); pNew = pNew.expandThenReduce(nGrowth, nDist, nExpandableLevel, pExc, fCheck, nVerbose > 1);
} }
pNew = pNew.expandShareReduce(nExpands, nDivs, nDist, nExpandableLevel, nVerbose > 1); pNew = pNew.expandShareReduce(nExpands, nDivs, nDist, nExpandableLevel, pExc, fCheck, nVerbose > 1);
++iterNotImproveAfterRestart; ++iterNotImproveAfterRestart;
// report // report
@ -1204,7 +1250,7 @@ Miaig Miaig::rewire(int nIters, float levelGrowRatio, int nExpands, int nGrowth,
} else if (rootTarget < newTarget) { } else if (rootTarget < newTarget) {
if (iterNotImproveAfterRestart > nRestart) { if (iterNotImproveAfterRestart > nRestart) {
pNew = randomRead(pBests).dupMulti(nFaninMax, nGrowth); pNew = randomRead(pBests).dupMulti(nFaninMax, nGrowth);
pNew = pNew.expand(nExpands, nDist, nExpandableLevel, nVerbose > 1); pNew = pNew.expand(nExpands, nDist, nExpandableLevel, pExc, fCheck, nVerbose > 1);
pNew = pNew.share(nDivs == -1 ? pNew.nObjs() : nDivs); pNew = pNew.share(nDivs == -1 ? pNew.nObjs() : nDivs);
pNew = pNew.dupStrash(1, 1, 0); pNew = pNew.dupStrash(1, 1, 0);
pRoots = {pNew}; pRoots = {pNew};

View File

@ -157,6 +157,7 @@ struct Miaig_Data {
word *pTruths[3]; // truth tables word *pTruths[3]; // truth tables
word *pCare; // careset word *pCare; // careset
word *pProd; // product word *pProd; // product
word *pExc; // Exc
vi *vOrder; // node order vi *vOrder; // node order
vi *vOrderF; // fanin order vi *vOrderF; // fanin order
vi *vOrderF2; // fanin order vi *vOrderF2; // fanin order
@ -181,6 +182,11 @@ public:
Miaig(Mini_Aig_t *pMiniAig); Miaig(Mini_Aig_t *pMiniAig);
#endif // RW_ABC #endif // RW_ABC
public:
#ifdef RW_ABC
void setExc(Gia_Man_t *pExc);
#endif // RW_ABC
public: public:
void addref(void); void addref(void);
void release(void); void release(void);
@ -200,6 +206,8 @@ public:
int objIsPi(int i); int objIsPi(int i);
int objIsPo(int i); int objIsPo(int i);
int objIsNode(int i); int objIsNode(int i);
int objPiIdx(int i); // No check isPi
int objPoIdx(int i); // No check isPo
void print(void); void print(void);
int appendObj(void); int appendObj(void);
void appendFanin(int i, int iLit); void appendFanin(int i, int iLit);
@ -238,14 +246,14 @@ private:
void reduceFanins(vi *v); void reduceFanins(vi *v);
int *createStops(void); int *createStops(void);
void collectSuper_rec(int iLit, int *pStop, vi *vSuper); void collectSuper_rec(int iLit, int *pStop, vi *vSuper);
int checkConst(int iObj, word *pCare, int fVerbose); int checkConst(int iObj, word *pCare, word *pExc, int fCheck, int fVerbose);
void truthSimNode(int i); void truthSimNode(int i);
word *truthSimNodeSubset(int i, int m); word *truthSimNodeSubset(int i, int m);
word *truthSimNodeSubset2(int i, vi *vFanins, int nFanins); word *truthSimNodeSubset2(int i, vi *vFanins, int nFanins);
void truthUpdate(vi *vTfo); void truthUpdate(vi *vTfo, word *pExc = NULL, int fCheck = 0);
int computeTfo_rec(int iObj); int computeTfo_rec(int iObj);
vi *computeTfo(int iObj); vi *computeTfo(int iObj);
word *computeCareSet(int iObj); word *computeCareSet(int iObj, word *pExc = NULL);
vi *createRandomOrder(void); vi *createRandomOrder(void);
void addPair(vi *vPair, int iFan1, int iFan2); void addPair(vi *vPair, int iFan1, int iFan2);
int findPair(vi *vPair); int findPair(vi *vPair);
@ -272,21 +280,21 @@ private:
int buildNodeCascade(Miaig &pNew, vi *vFanins, int fCprop, int fStrash); int buildNodeCascade(Miaig &pNew, vi *vFanins, int fCprop, int fStrash);
private: private:
int expandOne(int iObj, int nAddedMax, int nDist, int nExpandableLevel, int fVerbose); int expandOne(int iObj, int nAddedMax, int nDist, int nExpandableLevel, word *pExc, int fCheck, int fVerbose);
int reduceOne(int iObj, int fOnlyConst, int fOnlyBuffer, int fHeuristic, int fVerbose); int reduceOne(int iObj, int fOnlyConst, int fOnlyBuffer, int fHeuristic, word *pExc, int fCheck, int fVerbose);
int expandThenReduceOne(int iNode, int nFaninAddLimit, int nDist, int nExpandableLevel, int fVerbose); int expandThenReduceOne(int iNode, int nFaninAddLimit, int nDist, int nExpandableLevel, word *pExc, int fCheck, int fVerbose);
public: public:
Miaig dup(int fRemDangle, int fMapped = 0); Miaig dup(int fRemDangle, int fMapped = 0);
Miaig dupDfs(void); Miaig dupDfs(void);
Miaig dupStrash(int fCprop, int fStrash, int fCascade); Miaig dupStrash(int fCprop, int fStrash, int fCascade);
Miaig dupMulti(int nFaninMax_, int nGrowth); Miaig dupMulti(int nFaninMax_, int nGrowth);
Miaig expand(int nFaninAddLimitAll, int nDist, int nExpandableLevel, int nVerbose); Miaig expand(int nFaninAddLimitAll, int nDist, int nExpandableLevel, word *pExc, int fCheck, int nVerbose);
Miaig share(int nNewNodesMax); Miaig share(int nNewNodesMax);
Miaig reduce(int fVerbose); Miaig reduce(word *pExc, int fCheck, int fVerbose);
Miaig expandThenReduce(int nFaninAddLimit, int nDist, int nExpandableLevel, int fVerbose); Miaig expandThenReduce(int nFaninAddLimit, int nDist, int nExpandableLevel, word *pExc, int fCheck, int fVerbose);
Miaig expandShareReduce(int nFaninAddLimitAll, int nDivs, int nDist, int nExpandableLevel, int nVerbose); Miaig expandShareReduce(int nFaninAddLimitAll, int nDivs, int nDist, int nExpandableLevel, word *pExc, int fCheck, int nVerbose);
Miaig rewire(int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nVerbose); Miaig rewire(int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int fCheck, int nVerbose);
#ifdef RW_ABC #ifdef RW_ABC
Gia_Man_t *toGia(void); Gia_Man_t *toGia(void);
Abc_Ntk_t *toNtk(int fMapped = 0); Abc_Ntk_t *toNtk(int fMapped = 0);
@ -373,6 +381,7 @@ inline void Miaig::release(void) {
free(_data->pTruths[0]); free(_data->pTruths[0]);
if (_data->pCare) free(_data->pCare); if (_data->pCare) free(_data->pCare);
if (_data->pProd) free(_data->pProd); if (_data->pProd) free(_data->pProd);
if (_data->pExc) free(_data->pExc);
if (_data->pLevel) free(_data->pLevel); if (_data->pLevel) free(_data->pLevel);
if (_data->pDist) free(_data->pDist); if (_data->pDist) free(_data->pDist);
if (_data->pTable) free(_data->pTable); if (_data->pTable) free(_data->pTable);
@ -413,6 +422,16 @@ inline int Miaig::objIsNode(int i) {
return i > _data->nIns && i < _data->nObjs - _data->nOuts; return i > _data->nIns && i < _data->nObjs - _data->nOuts;
} }
inline int Miaig::objPiIdx(int i) {
// assert(objIsPi(i));
return i - 1;
}
inline int Miaig::objPoIdx(int i) {
// assert(objIsPo(i));
return i - (_data->nObjs - _data->nOuts);
}
inline int Miaig::appendObj(void) { inline int Miaig::appendObj(void) {
assert(_data->nObjs < _data->nObjsAlloc); assert(_data->nObjs < _data->nObjsAlloc);
return _data->nObjs++; return _data->nObjs++;

View File

@ -22,16 +22,16 @@
ABC_NAMESPACE_IMPL_START ABC_NAMESPACE_IMPL_START
Gia_Man_t *Gia_ManRewire(Gia_Man_t *pGia, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fVerbose) { Gia_Man_t *Gia_ManRewire(Gia_Man_t *pGia, Gia_Man_t *pExc, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fCheck, int fVerbose) {
return Gia_ManRewireInt(pGia, nIters, levelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, nMode, nMappedMode, nDist, nSeed, fVerbose); return Gia_ManRewireInt(pGia, pExc, nIters, levelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, nMode, nMappedMode, nDist, nSeed, fCheck, fVerbose);
} }
Abc_Ntk_t *Abc_ManRewire(Abc_Ntk_t *pNtk, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fVerbose) { Abc_Ntk_t *Abc_ManRewire(Abc_Ntk_t *pNtk, Gia_Man_t *pExc, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fCheck, int fVerbose) {
return Abc_ManRewireInt(pNtk, nIters, levelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, nMode, nMappedMode, nDist, nSeed, fVerbose); return Abc_ManRewireInt(pNtk, pExc, nIters, levelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, nMode, nMappedMode, nDist, nSeed, fCheck, fVerbose);
} }
Mini_Aig_t *MiniAig_ManRewire(Mini_Aig_t *pAig, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fVerbose) { Mini_Aig_t *MiniAig_ManRewire(Mini_Aig_t *pAig, Gia_Man_t *pExc, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fCheck, int fVerbose) {
return MiniAig_ManRewireInt(pAig, nIters, levelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, nMode, nMappedMode, nDist, nSeed, fVerbose); return MiniAig_ManRewireInt(pAig, pExc, nIters, levelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, nMode, nMappedMode, nDist, nSeed, fCheck, fVerbose);
} }
ABC_NAMESPACE_IMPL_END ABC_NAMESPACE_IMPL_END

View File

@ -35,12 +35,12 @@
ABC_NAMESPACE_HEADER_START ABC_NAMESPACE_HEADER_START
Gia_Man_t *Gia_ManRewire(Gia_Man_t *pGia, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fVerbose); Gia_Man_t *Gia_ManRewire(Gia_Man_t *pGia, Gia_Man_t *pExc, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fCheck, int fVerbose);
Gia_Man_t *Gia_ManRewireInt(Gia_Man_t *pGia, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fVerbose); Gia_Man_t *Gia_ManRewireInt(Gia_Man_t *pGia, Gia_Man_t *pExc, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fCheck, int fVerbose);
Abc_Ntk_t *Abc_ManRewire(Abc_Ntk_t *pNtk, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fVerbose); Abc_Ntk_t *Abc_ManRewire(Abc_Ntk_t *pNtk, Gia_Man_t *pExc, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fCheck, int fVerbose);
Abc_Ntk_t *Abc_ManRewireInt(Abc_Ntk_t *pNtk, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fVerbose); Abc_Ntk_t *Abc_ManRewireInt(Abc_Ntk_t *pNtk, Gia_Man_t *pExc, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fCheck, int fVerbose);
Mini_Aig_t *MiniAig_ManRewire(Mini_Aig_t *pAig, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fVerbose); Mini_Aig_t *MiniAig_ManRewire(Mini_Aig_t *pAig, Gia_Man_t *pExc, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fCheck, int fVerbose);
Mini_Aig_t *MiniAig_ManRewireInt(Mini_Aig_t *pAig, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fVerbose); Mini_Aig_t *MiniAig_ManRewireInt(Mini_Aig_t *pAig, Gia_Man_t *pExc, int nIters, float levelGrowRatio, int nExpands, int nGrowth, int nDivs, int nFaninMax, int nTimeOut, int nMode, int nMappedMode, int nDist, int nSeed, int fCheck, int fVerbose);
ABC_NAMESPACE_HEADER_END ABC_NAMESPACE_HEADER_END

View File

@ -152,6 +152,12 @@ static inline void Tt_OrXor(word *pOut, word *pIn1, word *pIn2, int nWords) {
pOut[w] |= pIn1[w] ^ pIn2[w]; pOut[w] |= pIn1[w] ^ pIn2[w];
} }
static inline void Tt_OrXorAnd(word *pOut, word *pIn1, word *pIn2, word *pIn3, int nWords) {
int w;
for (w = 0; w < nWords; w++)
pOut[w] |= (pIn1[w] ^ pIn2[w]) & pIn3[w];
}
static inline int Tt_WordNum(int n) { static inline int Tt_WordNum(int n) {
return n > 6 ? (1 << (n - 6)) : 1; return n > 6 ? (1 << (n - 6)) : 1;
} }