31#define Aig_ManForEachNodeInOrder( p, pObj ) \
32 for ( assert(p->pOrderData), p->iPrev = 0, p->iNext = p->pOrderData[1]; \
33 p->iNext && (((pObj) = Aig_ManObj(p, p->iNext)), 1); \
34 p->iNext = p->pOrderData[2*p->iPrev+1] )
58 pPars->fUpdateLevel = 0;
63 pPars->fVeryVerbose = 0;
86 int i, k, nNodesOld, nNodeBefore, nNodeAfter, Required;
90 if ( pPars->fUseZeros )
101 if (
p->pPars->fFanout )
103 if (
p->pPars->fUpdateLevel )
108 clkStart = Abc_Clock();
109 p->nNodesInit = Aig_ManNodeNum(pAig);
110 nNodesOld = Vec_PtrSize( pAig->vObjs );
118 if ( pAig->Time2Quit && !(i & 256) && Abc_Clock() > pAig->Time2Quit )
122 if ( !Aig_ObjIsNode(pObj) )
127 if ( pPars->fRecycle && ++Counter % 50000 == 0 &&
Aig_DagSize(pObj) < Vec_PtrSize(
p->vCutNodes)/100 )
142 Dar_ObjSetCuts( pObj, NULL );
144p->timeCuts += Abc_Clock() - clk;
150 if ( k < (
int)pObj->
nCuts )
156 pObjNew = Aig_NotCond( Aig_ManConst1(
p->pAig), pCut->
uTruth==0 );
161 pObjNew = Aig_NotCond( Aig_ManObj(
p->pAig, pCut->
pLeaves[0]), pCut->
uTruth==0x5555 );
164 Dar_ObjSetCuts( pObj, NULL );
176 int nLeavesOld = pCut->
nLeaves;
184 if (
p->GainBest <
p->pPars->nMinSaved )
191 Dar_ObjSetCuts( pObj, NULL );
193 nNodeBefore = Aig_ManNodeNum( pAig );
195 pObjNew = Aig_NotCond( pObjNew, Aig_ObjPhaseReal(pObjNew) ^ pObj->
fPhase );
196 assert( (
int)Aig_Regular(pObjNew)->Level <= Required );
200 nNodeAfter = Aig_ManNodeNum( pAig );
201 assert(
p->GainBest <= nNodeBefore - nNodeAfter );
203 p->ClassGains[
p->ClassBest] += nNodeBefore - nNodeAfter;
219p->timeTotal = Abc_Clock() - clkStart;
220p->timeOther =
p->timeTotal -
p->timeCuts -
p->timeEval;
228 if (
p->pPars->fFanout )
230 if (
p->pPars->fUpdateLevel )
237 Vec_IntFree( pAig->vProbs );
246 printf(
"Aig_ManRewrite: The network check has failed.\n" );
267 int i, k, nCuts = 0, nCutsK = 0;
306 pPars->nCutsMax = nCutsMax;
324 printf(
"Nodes = %6d. Total cuts = %6d. 4-input cuts = %6d.\n",
325 Aig_ManObjNum(pAig), nCuts, nCutsK );
326 printf(
"Cut size = %2d. Truth size = %2d. Total mem = %5.2f MB ",
328 ABC_PRT(
"Runtime", Abc_Clock() - clk );
336 pMemCuts =
p->pMemCuts;
#define ABC_INFINITY
MACRO DEFINITIONS ///.
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
void Aig_ManFanoutStart(Aig_Man_t *p)
FUNCTION DEFINITIONS ///.
int Aig_MmFixedReadMemUsage(Aig_MmFixed_t *p)
void Aig_ManFanoutStop(Aig_Man_t *p)
#define Aig_ManForEachObj(p, pObj, i)
void Aig_ManStartReverseLevels(Aig_Man_t *p, int nMaxLevelIncrease)
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
struct Aig_Obj_t_ Aig_Obj_t
void Aig_ManStopReverseLevels(Aig_Man_t *p)
#define Aig_ManForEachNode(p, pObj, i)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
int Aig_ManCleanup(Aig_Man_t *p)
void Aig_ObjReplace(Aig_Man_t *p, Aig_Obj_t *pObjOld, Aig_Obj_t *pObjNew, int fUpdateLevel)
int Aig_ObjRequiredLevel(Aig_Man_t *p, Aig_Obj_t *pObj)
int Aig_DagSize(Aig_Obj_t *pObj)
void Aig_MmFixedRestart(Aig_MmFixed_t *p)
void Aig_ManCheckPhase(Aig_Man_t *p)
struct Aig_MmFixed_t_ Aig_MmFixed_t
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void Dar_ManDefaultRwrParams(Dar_RwrPar_t *pPars)
FUNCTION DEFINITIONS ///.
int Dar_ManRewrite(Aig_Man_t *pAig, Dar_RwrPar_t *pPars)
int Dar_ManCutCount(Aig_Man_t *pAig, int *pnCutsK)
Aig_MmFixed_t * Dar_ManComputeCuts(Aig_Man_t *pAig, int nCutsMax, int fSkipTtMin, int fVerbose)
Dar_Cut_t * Dar_ObjComputeCuts(Dar_Man_t *p, Aig_Obj_t *pObj, int fSkipTtMin)
Dar_Cut_t * Dar_ObjPrepareCuts(Dar_Man_t *p, Aig_Obj_t *pObj)
void Dar_ManCutsRestart(Dar_Man_t *p, Aig_Obj_t *pRoot)
FUNCTION DECLARATIONS ///.
Dar_Cut_t * Dar_ObjComputeCuts_rec(Dar_Man_t *p, Aig_Obj_t *pObj)
void Dar_ManCutsFree(Dar_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Dar_Man_t_ Dar_Man_t
INCLUDES ///.
void Dar_ManStop(Dar_Man_t *p)
Dar_Man_t * Dar_ManStart(Aig_Man_t *pAig, Dar_RwrPar_t *pPars)
DECLARATIONS ///.
void Dar_LibEval(Dar_Man_t *p, Aig_Obj_t *pRoot, Dar_Cut_t *pCut, int Required, int *pnMffcSize)
struct Dar_Cut_t_ Dar_Cut_t
Aig_Obj_t * Dar_LibBuildBest(Dar_Man_t *p)
#define Dar_ObjForEachCut(pObj, pCut, i)
typedefABC_NAMESPACE_HEADER_START struct Dar_RwrPar_t_ Dar_RwrPar_t
INCLUDES ///.
void Dar_LibPrepare(int nSubgraphs)
Vec_Int_t * Saig_ManComputeSwitchProbs(Aig_Man_t *pAig, int nFrames, int nPref, int fProbOne)