35 Vec_Ptr_t * vFaninsCur,
int nNodesSaved,
int LevelMax,
int * pGainBest,
unsigned uTruth );
64 if ( pManRwt == NULL )
67 if ( fUpdateLevel && p->fFanout == 0 )
86 nGain =
Ivy_NodeRewrite( p, pManRwt, pNode, fUpdateLevel, fUseZeroCost );
87 if ( nGain > 0 || (nGain == 0 && fUseZeroCost) )
129 printf(
"Cleanup after rewriting removed %d dangling nodes.\n", i );
131 printf(
"Ivy_ManRewritePre(): The check has failed.\n" );
155 int fVeryVerbose = 0;
161 unsigned uTruthBest = 0;
164 int Required, nNodesSaved;
165 int nNodesSaveCur = -1;
166 int i, c, GainCur = -1, GainBest = -1;
171 Required = fUpdateLevel?
Vec_IntEntry( pMan->vRequired, pNode->
Id ) : 1000000;
179 for ( c = 1; c < pStore->
nCuts; c++ )
181 pCut = pStore->
pCuts + c;
183 if ( pCut->
nSize != 4 )
186 for ( i = 0; i < (int)pCut->
nSize; i++ )
189 if ( i != pCut->
nSize )
204 for ( i = 0; i < (int)pCut->
nSize; i++ )
208 pFanin =
Ivy_NotCond(pFanin, ((uPhase & (1<<i)) > 0) );
235 if ( pGraph != NULL && GainBest < GainCur )
238 nNodesSaveCur = nNodesSaved;
241 p->
fCompl = ((uPhase & (1<<4)) > 0);
251 if ( GainBest == -1 )
283 if ( fUseZeroCost || GainBest > 0 )
287 if ( fVeryVerbose && GainBest > 0 )
289 printf(
"Node %6d : ",
Ivy_ObjId(pNode) );
290 printf(
"Fanins = %d. ", p->
vFanins->nSize );
291 printf(
"Save = %d. ", nNodesSaveCur );
292 printf(
"Add = %d. ", nNodesSaveCur-GainBest );
293 printf(
"GAIN = %d. ", GainBest );
295 printf(
"Class = %d. ", p->
pMap[uTruthBest] );
314 static unsigned uMasks[5] = { 0xAAAAAAAA, 0xCCCCCCCC, 0xF0F0F0F0, 0xFF00FF00, 0xFFFF0000 };
315 unsigned uTruth0, uTruth1;
317 for ( i = 0; i < nNums; i++ )
318 if ( pObj->
Id == pNums[i] )
329 return uTruth0 & uTruth1;
367 int nNodesAdded, GainBest, i, k;
382 if ( nNodesAdded == -1 )
384 assert( nNodesSaved >= nNodesAdded );
386 if ( GainBest < nNodesSaved - nNodesAdded )
388 GainBest = nNodesSaved - nNodesAdded;
389 pGraphBest = pGraphCur;
392 if ( GainBest == -1 )
394 *pGainBest = GainBest;
417 int i,
Counter, LevelNew, LevelOld;
434 if ( pAnd0 && pAnd1 )
449 if ( ++Counter > NodeMax )
465 if ( LevelNew > LevelMax )
468 pNode->
Level = LevelNew;
521 int nNodesNew, nNodesOld, Required;
522 Required = fUpdateLevel?
Vec_IntEntry( p->vRequired, pRoot->
Id ) : 1000000;
543 assert( nGain <= nNodesOld - nNodesNew );
562 int nNodesNew, nNodesOld, i, nRefsOld;
570 nRefsOld = pRoot->
nRefs;
573 pRoot->
nRefs = nRefsOld;
608 assert( nGain <= nNodesOld - nNodesNew );
void Rwt_ManStop(Rwt_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
void Rwt_ManAddTimeTotal(Rwt_Man_t *p, abctime Time)
void Ivy_ObjReplace(Ivy_Man_t *p, Ivy_Obj_t *pObjOld, Ivy_Obj_t *pObjNew, int fDeleteOld, int fFreeTop, int fUpdateLevel)
static Ivy_Obj_t * Ivy_ManConst1(Ivy_Man_t *p)
static int Dec_GraphNodeNum(Dec_Graph_t *pGraph)
static void Vec_PtrFill(Vec_Ptr_t *p, int nSize, void *Entry)
Ivy_Cut_t pCuts[IVY_CUT_LIMIT]
int Ivy_ObjMffcLabel(Ivy_Man_t *p, Ivy_Obj_t *pObj)
static int Dec_GraphIsConst(Dec_Graph_t *pGraph)
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
static int Ivy_ObjIsNone(Ivy_Obj_t *pObj)
Rwt_Man_t * Rwt_ManStart(int fPrecompute)
#define Ivy_ManForEachNode(p, pObj, i)
void Ivy_GraphUpdateNetwork3(Ivy_Man_t *p, Ivy_Obj_t *pRoot, Dec_Graph_t *pGraph, int fUpdateLevel, int nGain)
Ivy_Store_t * Ivy_NodeFindCutsAll(Ivy_Man_t *p, Ivy_Obj_t *pObj, int nLeaves)
static abctime Abc_Clock()
static void Ivy_ObjRefsInc(Ivy_Obj_t *pObj)
void Rwt_ManPrintStats(Rwt_Man_t *p)
static Ivy_Obj_t * Ivy_ObjFanin1(Ivy_Obj_t *pObj)
int Ivy_ManPropagateBuffers(Ivy_Man_t *p, int fUpdateLevel)
static int Ivy_NodeRewrite(Ivy_Man_t *pMan, Rwt_Man_t *p, Ivy_Obj_t *pNode, int fUpdateLevel, int fUseZeroCost)
void Ivy_ManResetLevels(Ivy_Man_t *p)
static Ivy_Obj_t * Ivy_ObjFanin0(Ivy_Obj_t *pObj)
int Rwt_ManReadCompl(Rwt_Man_t *p)
static int Dec_GraphIsComplement(Dec_Graph_t *pGraph)
static int Ivy_ManObjIdMax(Ivy_Man_t *p)
Ivy_Obj_t * Ivy_TableLookup(Ivy_Man_t *p, Ivy_Obj_t *pObj)
FUNCTION DEFINITIONS ///.
void Ivy_NodeFixBufferFanins(Ivy_Man_t *p, Ivy_Obj_t *pNode, int fUpdateLevel)
void Ivy_ManIncrementTravId(Ivy_Man_t *p)
DECLARATIONS ///.
static Dec_Node_t * Dec_GraphVar(Dec_Graph_t *pGraph)
Ivy_Obj_t * Ivy_GraphToNetwork(Ivy_Man_t *p, Dec_Graph_t *pGraph)
void * Rwt_ManReadDecs(Rwt_Man_t *p)
static int Ivy_ObjFaninC1(Ivy_Obj_t *pObj)
static Ivy_Obj_t * Ivy_ManObj(Ivy_Man_t *p, int i)
static Dec_Graph_t * Rwt_CutEvaluate(Ivy_Man_t *pMan, Rwt_Man_t *p, Ivy_Obj_t *pRoot, Vec_Ptr_t *vFaninsCur, int nNodesSaved, int LevelMax, int *pGainBest, unsigned uTruth)
static int Vec_IntEntry(Vec_Int_t *p, int i)
static int Ivy_ObjRefs(Ivy_Obj_t *pObj)
static void Ivy_ObjRefsDec(Ivy_Obj_t *pObj)
#define ABC_NAMESPACE_IMPL_END
int pArray[IVY_CUT_INPUT]
static Ivy_Obj_t * Ivy_Regular(Ivy_Obj_t *p)
static int Ivy_ObjIsTravIdCurrent(Ivy_Man_t *p, Ivy_Obj_t *pObj)
static int Ivy_ObjIsNode(Ivy_Obj_t *pObj)
static ABC_NAMESPACE_IMPL_START unsigned Ivy_NodeGetTruth(Ivy_Obj_t *pObj, int *pNums, int nNums)
DECLARATIONS ///.
unsigned Ivy_NodeGetTruth_rec(Ivy_Obj_t *pObj, int *pNums, int nNums)
void Ivy_ManStartFanout(Ivy_Man_t *p)
FUNCTION DEFINITIONS ///.
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Vec_Int_t * Ivy_ManRequiredLevels(Ivy_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Ivy_Man_t_ Ivy_Man_t
INCLUDES ///.
#define ABC_NAMESPACE_IMPL_START
#define Dec_GraphForEachNode(pGraph, pAnd, i)
void Ivy_ObjDelete_rec(Ivy_Man_t *p, Ivy_Obj_t *pObj, int fFreeTop)
static Ivy_Obj_t * Ivy_ObjCreateGhost(Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1, Ivy_Type_t Type, Ivy_Init_t Init)
static int Ivy_GraphToNetworkCount(Ivy_Man_t *p, Ivy_Obj_t *pRoot, Dec_Graph_t *pGraph, int NodeMax, int LevelMax)
#define Dec_GraphForEachLeaf(pGraph, pLeaf, i)
ITERATORS ///.
static Ivy_Obj_t * Ivy_NotCond(Ivy_Obj_t *p, int c)
static int Ivy_ObjIsBuf(Ivy_Obj_t *pObj)
void Rwt_ManAddTimeUpdate(Rwt_Man_t *p, abctime Time)
static int Dec_GraphIsVar(Dec_Graph_t *pGraph)
static void Vec_PtrClear(Vec_Ptr_t *p)
static Dec_Node_t * Dec_GraphNode(Dec_Graph_t *pGraph, int i)
static int Ivy_ObjIsCi(Ivy_Obj_t *pObj)
int Ivy_ManRewritePre(Ivy_Man_t *p, int fUpdateLevel, int fUseZeroCost, int fVerbose)
FUNCTION DEFINITIONS ///.
static int Ivy_ManNodeNum(Ivy_Man_t *p)
static Vec_Ptr_t * Vec_VecEntry(Vec_Vec_t *p, int i)
static void Vec_IntFree(Vec_Int_t *p)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
static void Ivy_GraphUpdateNetwork(Ivy_Man_t *p, Ivy_Obj_t *pRoot, Dec_Graph_t *pGraph, int fUpdateLevel, int nGain)
static int Ivy_ObjFaninC0(Ivy_Obj_t *pObj)
Ivy_Obj_t * Ivy_And(Ivy_Man_t *p, Ivy_Obj_t *p0, Ivy_Obj_t *p1)
int Ivy_ManCheck(Ivy_Man_t *p)
DECLARATIONS ///.
int Ivy_ManCleanup(Ivy_Man_t *p)
static int Ivy_ObjId(Ivy_Obj_t *pObj)
static void Dec_GraphComplement(Dec_Graph_t *pGraph)