Supporting structural choices in rewiring.

This commit is contained in:
Alan Mishchenko 2025-05-18 13:37:30 -07:00
parent 5daa0c347e
commit 0b1d7c6d0f
8 changed files with 268 additions and 19 deletions

View File

@ -1413,6 +1413,10 @@ extern Gia_Man_t * Gia_ManDemiterToDual( Gia_Man_t * p );
extern int Gia_ManDemiterDual( Gia_Man_t * p, Gia_Man_t ** pp0, Gia_Man_t ** pp1 );
extern int Gia_ManDemiterTwoWords( Gia_Man_t * p, Gia_Man_t ** pp0, Gia_Man_t ** pp1 );
extern void Gia_ManProdAdderGen( int nArgA, int nArgB, int Seed, int fSigned, int fCla );
typedef struct Gia_ChMan_t_ Gia_ChMan_t;
extern Gia_ChMan_t * Gia_ManDupChoicesStart( Gia_Man_t * pGia );
extern void Gia_ManDupChoicesAdd( Gia_ChMan_t * pMan, Gia_Man_t * pGia );
extern Gia_Man_t * Gia_ManDupChoicesFinish( Gia_ChMan_t * pMan );
/*=== giaEdge.c ==========================================================*/
extern void Gia_ManEdgeFromArray( Gia_Man_t * p, Vec_Int_t * vArray );
extern Vec_Int_t * Gia_ManEdgeToArray( Gia_Man_t * p );

View File

@ -22,6 +22,7 @@
#include "misc/tim/tim.h"
#include "misc/vec/vecWec.h"
#include "proof/cec/cec.h"
#include "misc/util/utilTruth.h"
ABC_NAMESPACE_IMPL_START
@ -6269,6 +6270,214 @@ Gia_Man_t * Gia_ManDupFanouts( Gia_Man_t * p )
return pNew;
}
/**Function*************************************************************
Synopsis [Reorders choice nodes.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Gia_ManPrintChoices( Gia_Man_t * p )
{
Gia_Obj_t * pObj; int i;
Gia_ManForEachAnd( p, pObj, i )
if ( p->pSibls[i] )
printf( "%d -> %d\n", i, p->pSibls[i] );
}
void Gia_ManReorderChoices_rec( Gia_Man_t * pNew, Gia_Man_t * p, Gia_Obj_t * pObj )
{
if ( ~pObj->Value )
return;
assert( Gia_ObjIsAnd(pObj) );
Gia_Obj_t * pSibl = Gia_ObjSiblObj(p, Gia_ObjId(p, pObj));
Gia_ManReorderChoices_rec( pNew, p, Gia_ObjFanin0(pObj) );
Gia_ManReorderChoices_rec( pNew, p, Gia_ObjFanin1(pObj) );
if ( pSibl ) Gia_ManReorderChoices_rec( pNew, p, pSibl );
pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
if ( pSibl ) {
int iObjNew = Abc_Lit2Var(pObj->Value);
int iNextNew = Abc_Lit2Var(pSibl->Value);
assert( iObjNew > iNextNew );
assert( Gia_ObjIsAnd(Gia_ManObj(pNew, iNextNew)) );
pNew->pSibls[iObjNew] = iNextNew;
}
}
Gia_Man_t * Gia_ManReorderChoices( Gia_Man_t * p )
{
assert( p->pSibls );
Gia_Obj_t * pObj; int i;
Gia_Man_t * pNew = Gia_ManStart( Gia_ManObjNum(p) );
pNew->pName = Abc_UtilStrsav( p->pName );
pNew->pSpec = Abc_UtilStrsav( p->pSpec );
pNew->pSibls = ABC_CALLOC( int, Gia_ManObjNum(p) );
Gia_ManFillValue(p);
Gia_ManForEachCi( p, pObj, i )
pObj->Value = Gia_ManAppendCi(pNew);
Gia_ManForEachCo( p, pObj, i )
Gia_ManReorderChoices_rec( pNew, p, Gia_ObjFanin0(pObj) );
Gia_ManForEachCo( p, pObj, i )
Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
extern int Gia_ManTestChoices( Gia_Man_t * p );
Gia_ManTestChoices( pNew );
//Gia_ManPrintChoices( pNew );
return pNew;
}
/**Function*************************************************************
Synopsis [Duplicates AIGs while creating choices.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
struct Gia_ChMan_t_
{
Gia_Man_t * pNew;
Vec_Mem_t * vTtMem;
Vec_Int_t * vSibls;
Vec_Int_t * vObj2Tt;
Vec_Int_t * vTt2Obj;
Vec_Int_t * vCoLits;
word * pTruth;
int nWords;
};
int Gia_ManDupChoicesMark_rec( Gia_Man_t * pGia, int iObj, Vec_Int_t * vObj2Tt, int iFunc )
{
if ( Abc_Lit2Var(Vec_IntEntry(vObj2Tt, iObj)) == iFunc )
return 1;
if ( Gia_ObjIsTravIdCurrentId(pGia, iObj) )
return 0;
Gia_ObjSetTravIdCurrentId(pGia, iObj);
Gia_Obj_t * pObj = Gia_ManObj(pGia, iObj);
if ( !Gia_ObjIsAnd(pObj) )
return 0;
if ( Gia_ManDupChoicesMark_rec( pGia, Gia_ObjFaninId0(pObj, iObj), vObj2Tt, iFunc ) )
return 1;
if ( Gia_ManDupChoicesMark_rec( pGia, Gia_ObjFaninId1(pObj, iObj), vObj2Tt, iFunc ) )
return 1;
return 0;
}
int Gia_ManDupChoicesMark( Gia_Man_t * pGia, int iLit0, int iLit1, Vec_Int_t * vObj2Tt, int iFunc )
{
Gia_ManIncrementTravId( pGia );
if ( Gia_ManDupChoicesMark_rec( pGia, Abc_Lit2Var(iLit0), vObj2Tt, iFunc ) )
return 1;
if ( Gia_ManDupChoicesMark_rec( pGia, Abc_Lit2Var(iLit1), vObj2Tt, iFunc ) )
return 1;
return 0;
}
void Gia_ManDupChoicesNode( Gia_ChMan_t * p, Gia_Man_t * pGia, int iObj )
{
Gia_Obj_t * pObj = Gia_ManObj( pGia, iObj );
assert( ~Gia_ObjFanin0(pObj)->Value && ~Gia_ObjFanin1(pObj)->Value );
int obLits[2] = { Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) };
int ttLits[2] = { Vec_IntEntry(p->vObj2Tt, Abc_Lit2Var(obLits[0])), Vec_IntEntry(p->vObj2Tt, Abc_Lit2Var(obLits[1])) };
int fCompl[2] = { Abc_LitIsCompl(ttLits[0]) ^ Abc_LitIsCompl(obLits[0]), Abc_LitIsCompl(ttLits[1]) ^ Abc_LitIsCompl(obLits[1]) };
word * pTruth[2] = { Vec_MemReadEntry(p->vTtMem, Abc_Lit2Var(ttLits[0])), Vec_MemReadEntry(p->vTtMem, Abc_Lit2Var(ttLits[1])) };
Abc_TtAndCompl( p->pTruth, pTruth[0], fCompl[0], pTruth[1], fCompl[1], p->nWords );
int fComp = (int)p->pTruth[0] & 1; if ( fComp ) Abc_TtNot( p->pTruth, p->nWords );
int nFuncs = Vec_MemEntryNum( p->vTtMem );
int iFunc = Vec_MemHashInsert( p->vTtMem, p->pTruth );
assert( iFunc <= nFuncs );
if ( iFunc == nFuncs ) { // new function
pObj->Value = Gia_ManHashAnd( p->pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
Vec_IntPush( p->vObj2Tt, Abc_Var2Lit(iFunc, fComp ^ Abc_LitIsCompl(pObj->Value)) );
Vec_IntPush( p->vTt2Obj, Abc_Lit2Var(pObj->Value) );
return;
}
int iRepr = Vec_IntEntry( p->vTt2Obj, iFunc );
pObj->Value = Abc_Var2Lit( iRepr, fComp ^ Abc_LitIsCompl(Vec_IntEntry(p->vObj2Tt, iRepr)) );
if ( iRepr <= Gia_ManCiNum(pGia) || Gia_ManDupChoicesMark(p->pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj), p->vObj2Tt, iFunc) )
return;
int nObjNew = Gia_ManObjNum(p->pNew);
int iLitNew = Gia_ManHashAnd( p->pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
if ( Abc_Lit2Var(iLitNew) == nObjNew )
Vec_IntPush( p->vObj2Tt, Abc_Var2Lit(iFunc, fComp ^ Abc_LitIsCompl(iLitNew)) );
}
void Gia_ManDupChoicesAdd( Gia_ChMan_t * p, Gia_Man_t * pGia )
{
Gia_Obj_t * pObj; int i;
assert( Gia_ManCiNum(p->pNew) == Gia_ManCiNum(pGia) );
assert( !p->vCoLits || Vec_IntSize(p->vCoLits) == Gia_ManCoNum(pGia) );
assert( Gia_ManRegNum(p->pNew) == Gia_ManRegNum(pGia) );
Gia_ManFillValue( pGia );
Gia_ManForEachCi( pGia, pObj, i )
pObj->Value = Gia_ManCiLit( p->pNew, i );
Gia_ManForEachAnd( pGia, pObj, i )
Gia_ManDupChoicesNode( p, pGia, i );
assert( Vec_IntSize(p->vObj2Tt) == Gia_ManObjNum(p->pNew) );
assert( Vec_IntSize(p->vTt2Obj) == Vec_MemEntryNum(p->vTtMem) );
}
Gia_ChMan_t * Gia_ManDupChoicesStart( Gia_Man_t * pGia )
{
Gia_ChMan_t * p = ABC_CALLOC( Gia_ChMan_t, 1 );
p->pNew = Gia_ManStart( 10*Gia_ManObjNum(pGia) );
p->pNew->pName = Abc_UtilStrsav( pGia->pName );
p->pNew->pSpec = Abc_UtilStrsav( pGia->pSpec );
p->vTtMem = Vec_MemAllocWithTTs( Gia_ManCiNum(pGia) );
p->vTt2Obj = Vec_IntStartNatural( 1 + Gia_ManCiNum(pGia) );
p->vObj2Tt = Vec_IntAlloc( 10*Gia_ManObjNum(pGia) );
p->nWords = Abc_TtWordNum( Gia_ManCiNum(pGia) );
p->pTruth = ABC_CALLOC( word, p->nWords );
Gia_Obj_t * pObj; int i;
for ( i = 0; i <= Gia_ManCiNum(pGia); i++ )
Vec_IntPush( p->vObj2Tt, Abc_Var2Lit(i, 0) );
Gia_ManForEachCi( pGia, pObj, i )
Gia_ManAppendCi(p->pNew);
Gia_ManSetRegNum( p->pNew, Gia_ManRegNum(pGia) );
Gia_ManHashStart( p->pNew );
Gia_ManDupChoicesAdd( p, pGia );
p->vCoLits = Vec_IntAlloc( Gia_ManCoNum(pGia) );
Gia_ManForEachCo( pGia, pObj, i )
Vec_IntPush( p->vCoLits, Gia_ObjFanin0Copy(pObj) );
return p;
}
Vec_Int_t * Gia_ManDupChoicesCreateSibls( Gia_ChMan_t * p )
{
int iObj, ttLit;
Vec_Int_t * vSibls = Vec_IntStart( Gia_ManObjNum(p->pNew) );
assert( Vec_IntSize(p->vTt2Obj) == Vec_MemEntryNum(p->vTtMem) );
Vec_IntForEachEntry( p->vObj2Tt, ttLit, iObj ) {
int iPrev = Vec_IntEntry(p->vTt2Obj, Abc_Lit2Var(ttLit));
assert( iPrev <= iObj );
if ( iPrev == iObj )
continue;
Vec_IntWriteEntry( vSibls, iPrev, iObj );
Vec_IntWriteEntry( p->vTt2Obj, Abc_Lit2Var(ttLit), iObj );
}
return vSibls;
}
Gia_Man_t * Gia_ManDupChoicesFinish( Gia_ChMan_t * p )
{
Gia_Man_t * pTemp, * pNew = p->pNew; int i, iLit;
p->vSibls = Gia_ManDupChoicesCreateSibls( p );
p->pNew->pSibls = Vec_IntReleaseArray( p->vSibls );
Vec_IntForEachEntry( p->vCoLits, iLit, i )
Gia_ManAppendCo( p->pNew, iLit );
Vec_MemFree( p->vTtMem );
Vec_IntFree( p->vSibls );
Vec_IntFree( p->vTt2Obj );
Vec_IntFree( p->vObj2Tt );
Vec_IntFree( p->vCoLits );
ABC_FREE( p->pTruth );
ABC_FREE( p );
pTemp = Gia_ManReorderChoices( pNew );
Gia_ManStop( pNew );
return pTemp;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////

View File

@ -46597,14 +46597,14 @@ usage:
***********************************************************************/
int Abc_CommandAbc9Rewire( Abc_Frame_t * pAbc, int argc, char ** argv )
{
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);
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 fChoices, int fVerbose);
FILE *pFile = NULL;
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;
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, fChoices = 0;
float nLevelGrowRatio = 0;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "IEGDFSTMALRCVch" ) ) != EOF ) {
while ( ( c = Extra_UtilGetopt( argc, argv, "IEGDFSTMALRCVcsh" ) ) != EOF ) {
switch ( c ) {
case 'I':
if ( globalUtilOptind >= argc )
@ -46733,6 +46733,9 @@ int Abc_CommandAbc9Rewire( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'c':
fCheck ^= 1;
break;
case 's':
fChoices ^= 1;
break;
case 'h':
default:
goto usage;
@ -46754,14 +46757,14 @@ int Abc_CommandAbc9Rewire( Abc_Frame_t * pAbc, int argc, char ** argv )
return 1;
}
pTemp = Gia_ManRewire( pAbc->pGia, pExc, nIters, nLevelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, nMode, nMappedMode, nDist, nSeed, fCheck, nVerbose );
pTemp = Gia_ManRewire( pAbc->pGia, pExc, nIters, nLevelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, nMode, nMappedMode, nDist, nSeed, fCheck, fChoices, nVerbose );
if ( pExc )
Gia_ManStop( pExc );
Abc_FrameUpdateGia( pAbc, pTemp );
return 0;
usage:
Abc_Print( -2, "usage: &rewire [-IEGDFLRMASTV <num>]\n" );
Abc_Print( -2, "usage: &rewire [-IEGDFLRMASTV <num>] [-csh]\n" );
Abc_Print( -2, "\t performs AIG re-wiring\n" );
Abc_Print( -2, "\t-I <num> : the number of iterations [default = %d]\n", nIters );
Abc_Print( -2, "\t-E <num> : the number of fanins to add to all nodes [default = %d]\n", nExpands );
@ -46777,6 +46780,7 @@ usage:
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-c : check the equivalence [default = %s]\n", fCheck ? "yes" : "no" );
Abc_Print( -2, "\t-s : toggle accumulating structural choices [default = %s]\n", fChoices ? "yes" : "no" );
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" );
return 1;

View File

@ -420,6 +420,32 @@ static inline Vec_Mem_t * Vec_MemAllocForTT( int nVars, int fCompl )
ABC_FREE( uTruth );
return vTtMem;
}
static inline Vec_Mem_t * Vec_MemAllocWithTTs( int nVars )
{
static word sTruths6[6] = {
ABC_CONST(0xAAAAAAAAAAAAAAAA),
ABC_CONST(0xCCCCCCCCCCCCCCCC),
ABC_CONST(0xF0F0F0F0F0F0F0F0),
ABC_CONST(0xFF00FF00FF00FF00),
ABC_CONST(0xFFFF0000FFFF0000),
ABC_CONST(0xFFFFFFFF00000000)
};
Vec_Mem_t * vTtMem = Vec_MemAllocForTTSimple( nVars );
int i, k, nWords = nVars <= 6 ? 1 : (1 << (nVars - 6));
word * pTruth = ABC_CALLOC( word, nWords );
int Value = Vec_MemHashInsert( vTtMem, pTruth ); assert( Value == 0 );
for ( i = 0; i < nVars; i++ ) {
if ( i < 6 )
for ( k = 0; k < nWords; k++ )
pTruth[k] = sTruths6[i];
else
for ( k = 0; k < nWords; k++ )
pTruth[k] = (k & (1 << (i-6))) ? ~(word)0 : 0;
Value = Vec_MemHashInsert( vTtMem, pTruth ); assert( Value == 1+i );
}
ABC_FREE( pTruth );
return vTtMem;
}
static inline void Vec_MemAddMuxTT( Vec_Mem_t * p, int nVars )
{
int Value, nWords = (nVars <= 6 ? 1 : (1 << (nVars - 6)));

View File

@ -26,17 +26,18 @@ ABC_NAMESPACE_IMPL_START
#endif // RW_ABC
#ifdef RW_ABC
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) {
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 fChoices, int fVerbose) {
Random_Num(nSeed == 0 ? Abc_Random(0) % 10 : nSeed);
Gia_ChMan_t *pChMan = fChoices ? Gia_ManDupChoicesStart(pGia) : NULL;
assert(Gia_ManCiNum(pGia) <= 58);
Rewire::Miaig pNtkMiaig(pGia);
if (pExc)
pNtkMiaig.setExc(pExc);
Rewire::Miaig pNew = pNtkMiaig.rewire(nIters, levelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, nMode, nMappedMode, nDist, fCheck, fVerbose);
Rewire::Miaig pNew = pNtkMiaig.rewire(nIters, levelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, nMode, nMappedMode, nDist, fCheck, pChMan, fVerbose);
pNew.setName(Gia_ManName(pGia));
return pNew.toGia();
return pChMan ? Gia_ManDupChoicesFinish(pChMan) : pNew.toGia();
}
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) {
@ -47,7 +48,7 @@ Abc_Ntk_t *Abc_ManRewireInt(Abc_Ntk_t *pNtk, Gia_Man_t *pExc, int nIters, float
Rewire::Miaig pNtkMiaig(pNtk);
if (pExc)
pNtkMiaig.setExc(pExc);
Rewire::Miaig pNew = pNtkMiaig.rewire(nIters, levelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, fMapped, nMappedMode, nDist, fCheck, fVerbose);
Rewire::Miaig pNew = pNtkMiaig.rewire(nIters, levelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, fMapped, nMappedMode, nDist, fCheck, NULL, fVerbose);
pNew.setName(Abc_NtkName(pNtk));
if (nMode > 0) {
pNew.countTransistors(1, nMappedMode);
@ -63,7 +64,7 @@ Mini_Aig_t *MiniAig_ManRewireInt(Mini_Aig_t *pAig, Gia_Man_t *pExc, int nIters,
Rewire::Miaig pNtkMiaig(pAig);
if (pExc)
pNtkMiaig.setExc(pExc);
Rewire::Miaig pNew = pNtkMiaig.rewire(nIters, levelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, nMode, nMappedMode, nDist, fCheck, fVerbose);
Rewire::Miaig pNew = pNtkMiaig.rewire(nIters, levelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, nMode, nMappedMode, nDist, fCheck, NULL, fVerbose);
return pNew.toMiniAig();
}
@ -1210,7 +1211,12 @@ Miaig Miaig::expandShareReduce(int nFaninAddLimitAll, int nDivs, int nDist, int
return pNew;
}
void randomAddBest(std::vector<Miaig> &pBests, Miaig pNew, int nBestSave) {
void randomAddBest(std::vector<Miaig> &pBests, Miaig pNew, int nBestSave, Gia_ChMan_t *pChMan) {
if ( pChMan ) {
Gia_Man_t * pGia = pNew.toGia();
Gia_ManDupChoicesAdd(pChMan, pGia);
Gia_ManStop( pGia );
}
if (pBests.size() < nBestSave) {
pBests.push_back(pNew);
} else {
@ -1228,7 +1234,7 @@ Miaig randomReadExcept(std::vector<Miaig> &pBests, Miaig &pExcept) {
return (pBests[iNum] == pExcept) ? pBests[(iNum + 1) % pBests.size()] : pBests[iNum];
}
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) {
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, Gia_ChMan_t *pChMan, int nVerbose) {
const int nRootSave = 8;
const int nBestSave = 4;
int nRestart = 5000;
@ -1272,7 +1278,7 @@ Miaig Miaig::rewire(int nIters, float levelGrowRatio, int nExpands, int nGrowth,
pBest = pNew.dup(0, fMapped), improved = 1;
iterNotImproveAfterRestart = 0;
} else if (PrevBest == newTarget) {
randomAddBest(pBests, pNew.dup(0), nBestSave);
randomAddBest(pBests, pNew.dup(0), nBestSave, pChMan);
}
// compare
if (maxLevel ? pNew.countLevel() > maxLevel : 0) {
@ -1288,7 +1294,7 @@ Miaig Miaig::rewire(int nIters, float levelGrowRatio, int nExpands, int nGrowth,
pRoots = {pNew};
}
} else if (rootTarget == newTarget) {
randomAddBest(pRoots, pNew, nRootSave);
randomAddBest(pRoots, pNew, nRootSave, pChMan);
} else {
pRoots = {pNew};
}

View File

@ -317,7 +317,7 @@ public:
Miaig reduce(word *pExc, int fCheck, 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, 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 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 fCheck, Gia_ChMan_t *pChMan, int nVerbose);
#ifdef RW_ABC
Gia_Man_t *toGia(void);
Abc_Ntk_t *toNtk(int fMapped = 0);

View File

@ -22,8 +22,8 @@
ABC_NAMESPACE_IMPL_START
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, pExc, nIters, levelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, nMode, nMappedMode, nDist, nSeed, fCheck, 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 fChoices, int fVerbose) {
return Gia_ManRewireInt(pGia, pExc, nIters, levelGrowRatio, nExpands, nGrowth, nDivs, nFaninMax, nTimeOut, nMode, nMappedMode, nDist, nSeed, fCheck, fChoices, 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) {

View File

@ -35,8 +35,8 @@
ABC_NAMESPACE_HEADER_START
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, 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_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 fChoices, 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 fChoices, 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, 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, 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);