66 unsigned uTruthBest = 0;
69 int Required, nNodesSaved;
70 int nNodesSaveCur = -1;
71 int i, GainCur = -1, GainBest = -1;
93 for ( pCut = pCut->
pNext; pCut; pCut = pCut->
pNext )
107 for ( i = 0; i < (int)pCut->
nLeaves; i++ )
110 if ( pFanin == NULL )
156 if ( pGraph != NULL && GainBest < GainCur )
159 nNodesSaveCur = nNodesSaved;
162 p->
fCompl = ((uPhase & (1<<4)) > 0);
172 if ( GainBest == -1 )
222 if ( fUseZeros || GainBest > 0 )
228 if ( fVeryVerbose && GainBest > 0 )
231 printf(
"Fanins = %d. ", p->
vFanins->nSize );
232 printf(
"Save = %d. ", nNodesSaveCur );
233 printf(
"Add = %d. ", nNodesSaveCur-GainBest );
234 printf(
"GAIN = %d. ", GainBest );
236 printf(
"Class = %d. ", p->
pMap[uTruthBest] );
260 int nNodesAdded, GainBest, i, k;
279 if ( nNodesAdded == -1 )
281 assert( nNodesSaved >= nNodesAdded );
321 if ( GainBest < nNodesSaved - nNodesAdded )
323 GainBest = nNodesSaved - nNodesAdded;
324 pGraphBest = pGraphCur;
327 if ( nNodesSaved - nNodesAdded > 0 )
330 pNode->
nGain += GainBest;
331 pNode->
nAdded += nNodesAdded;
336 if ( GainBest == -1 )
338 *pGainBest = GainBest;
415 for ( i = 0; i < (int)pCut->
nLeaves; i++ )
455 for ( pCut = pCut->
pNext; pCut; pCut = pCut->
pNext )
481 int i, Depth0, Depth1;
509 for ( i = 0; i < p->
vClasses->nSize; i++ )
560 for ( i = 0; i < p->
vClasses->nSize; i++ )
569 qsort( Perm, 222,
sizeof(
int), (
int (*)(
const void *,
const void *))
Rwr_ScoresCompare );
572 for ( i = 0; i < p->
vClasses->nSize; i++ )
575 if (
Gains[iNew] == 0 )
578 printf(
"CLASS %3d: Subgr = %3d. Total gain = %6d. ", iNew,
Vec_PtrSize(vSubgraphs),
Gains[iNew] );
579 uTruth = (unsigned)p->
pMapInv[iNew];
587 printf(
" %2d: S=%5d. A=%5d. G=%6d. ", k, pNode->
nScore, pNode->
nAdded, pNode->
nGain );
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
static int Dec_GraphNodeNum(Dec_Graph_t *pGraph)
static void Vec_PtrFill(Vec_Ptr_t *p, int nSize, void *Entry)
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
int Rwr_ScoresCompare(int *pNum1, int *pNum2)
static int Rwr_NodeGetDepth_rec(Abc_Obj_t *pObj, Vec_Ptr_t *vLeaves)
static unsigned * Cut_CutReadTruth(Cut_Cut_t *p)
void Rwr_ScoresClean(Rwr_Man_t *p)
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
ABC_DLL int Abc_NodeMffcLabelAig(Abc_Obj_t *pNode)
static abctime Abc_Clock()
int Dec_GraphToNetworkCount(Abc_Obj_t *pRoot, Dec_Graph_t *pGraph, int NodeMax, int LevelMax)
static int Abc_MaxInt(int a, int b)
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
static int Vec_PtrSize(Vec_Ptr_t *p)
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
static int Vec_PtrFind(Vec_Ptr_t *p, void *Entry)
static int Rwr_CutCountNumNodes(Abc_Obj_t *pObj, Cut_Cut_t *pCut)
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
void Dec_GraphPrint(FILE *pFile, Dec_Graph_t *pGraph, char *pNamesIn[], char *pNameOut)
FUNCTION DEFINITIONS ///.
ABC_DLL int Abc_ObjRequiredLevel(Abc_Obj_t *pObj)
void Rwr_ScoresReport(Rwr_Man_t *p)
static ABC_NAMESPACE_IMPL_START Dec_Graph_t * Rwr_CutEvaluate(Rwr_Man_t *p, Abc_Obj_t *pRoot, Cut_Cut_t *pCut, Vec_Ptr_t *vFaninsCur, int nNodesSaved, int LevelMax, int *pGainBest, int fPlaceEnable)
DECLARATIONS ///.
#define ABC_NAMESPACE_IMPL_END
ABC_DLL void * Abc_NodeGetCutsRecursive(void *p, Abc_Obj_t *pObj, int fDag, int fTree)
int Rwr_NodeRewrite(Rwr_Man_t *p, Cut_Man_t *pManCut, Abc_Obj_t *pNode, int fUpdateLevel, int fUseZeros, int fPlaceEnable)
FUNCTION DEFINITIONS ///.
void Ivy_TruthDsdComputePrint(unsigned uTruth)
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
void Rwr_CutCountNumNodes_rec(Abc_Obj_t *pObj, Cut_Cut_t *pCut, Vec_Ptr_t *vNodes)
#define ABC_NAMESPACE_IMPL_START
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
void Extra_PrintBinary(FILE *pFile, unsigned Sign[], int nBits)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
static void Vec_PtrClear(Vec_Ptr_t *p)
static Dec_Node_t * Dec_GraphNode(Dec_Graph_t *pGraph, int i)
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
static Vec_Ptr_t * Vec_VecEntry(Vec_Vec_t *p, int i)
void Rwr_CutIsBoolean_rec(Abc_Obj_t *pObj, Vec_Ptr_t *vLeaves, int fMarkA)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
static int Rwr_CutIsBoolean(Abc_Obj_t *pObj, Vec_Ptr_t *vLeaves)
static void Vec_PtrFree(Vec_Ptr_t *p)