89 int Abc_NtkRefactor(
Abc_Ntk_t * pNtk,
int nNodeSizeMax,
int nConeSizeMax,
int fUpdateLevel,
int fUseZeros,
int fUseDcs,
int fVerbose )
137 pFForm =
Abc_NodeRefactor( pManRef, pNode, vFanins, fUpdateLevel, fUseZeros, fUseDcs, fVerbose );
139 if ( pFForm == NULL )
152 pManRef->timeTotal =
Abc_Clock() - clkStart;
172 printf(
"Abc_NtkRefactor: The network check has failed.\n" );
195 int fVeryVerbose = 0;
199 int nNodesSaved, nNodesAdded, i;
206 p->nNodesConsidered++;
216 DdNode * bNodeDc, * bNodeOn, * bNodeOnDc;
217 int nMints, nMintsDc;
220 bNodeDc =
Abc_NodeConeDcs( p->dd, p->dd->vars + vFanins->nSize, p->dd->vars, p->vLeaves, vFanins, p->vVisited );
Cudd_Ref( bNodeDc );
221 nMints = (1 << vFanins->nSize);
240 p->nNodesGained += p->nLastGain;
241 p->nNodesRefactored++;
250 pSop =
Abc_ConvertBddToSop( NULL, p->dd, bNodeFunc, bNodeFunc, vFanins->nSize, 0, p->vCube, -1 );
278 if ( nNodesAdded == -1 || (nNodesAdded == nNodesSaved && !fUseZeros) )
286 p->nLastGain = nNodesSaved - nNodesAdded;
287 p->nNodesGained += p->nLastGain;
288 p->nNodesRefactored++;
294 printf(
"Cone = %2d. ", vFanins->nSize );
297 printf(
"MFFC = %2d. ", nNodesSaved );
298 printf(
"Add = %2d. ", nNodesAdded );
299 printf(
"GAIN = %2d. ", p->nLastGain );
325 p->nNodeSizeMax = nNodeSizeMax;
326 p->nConeSizeMax = nConeSizeMax;
327 p->fVerbose = fVerbose;
369 printf(
"Refactoring statistics:\n" );
370 printf(
"Nodes considered = %8d.\n", p->nNodesConsidered );
371 printf(
"Nodes refactored = %8d.\n", p->nNodesRefactored );
372 printf(
"Gain = %8d. (%6.2f %%).\n", p->nNodesBeg-p->nNodesEnd, 100.0*(p->nNodesBeg-p->nNodesEnd)/p->nNodesBeg );
373 ABC_PRT(
"Cuts ", p->timeCut );
374 ABC_PRT(
"Resynthesis", p->timeRes );
375 ABC_PRT(
" BDD ", p->timeBdd );
376 ABC_PRT(
" DCs ", p->timeDcs );
377 ABC_PRT(
" SOP ", p->timeSop );
378 ABC_PRT(
" FF ", p->timeFact );
379 ABC_PRT(
" Eval ", p->timeEval );
380 ABC_PRT(
"AIG update ", p->timeNtk );
381 ABC_PRT(
"TOTAL ", p->timeTotal );
DdNode * Abc_NodeConeBdd(DdManager *dd, DdNode **pbVars, Abc_Obj_t *pRoot, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vVisited)
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
#define CUDD_UNIQUE_SLOTS
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
double Cudd_CountMinterm(DdManager *manager, DdNode *node, int nvars)
static int Dec_GraphNodeNum(Dec_Graph_t *pGraph)
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
static Dec_Graph_t * Abc_NodeRefactor(Abc_ManRef_t *p, Abc_Obj_t *pNode, Vec_Ptr_t *vFanins, int fUpdateLevel, int fUseZeros, int fUseDcs, int fVerbose)
ABC_DLL Vec_Ptr_t * Abc_NtkManCutReadCutLarge(Abc_ManCut_t *p)
#define Cudd_IsConstant(node)
void Dec_GraphUpdateNetwork(Abc_Obj_t *pRoot, Dec_Graph_t *pGraph, int fUpdateLevel, int nGain)
#define ABC_ALLOC(type, num)
ABC_DLL int Abc_NodeMffcLabelAig(Abc_Obj_t *pNode)
Dec_Graph_t * Dec_Factor(char *pSop)
FUNCTION DECLARATIONS ///.
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
static Vec_Str_t * Vec_StrAlloc(int nCap)
static abctime Abc_Clock()
int Dec_GraphToNetworkCount(Abc_Obj_t *pRoot, Dec_Graph_t *pGraph, int NodeMax, int LevelMax)
static Dec_Graph_t * Dec_GraphCreateConst1()
ABC_DLL void Abc_NtkStopReverseLevels(Abc_Ntk_t *pNtk)
ABC_DLL Vec_Ptr_t * Abc_NodeFindCut(Abc_ManCut_t *p, Abc_Obj_t *pRoot, int fContain)
ABC_DLL void Abc_NtkReassignIds(Abc_Ntk_t *pNtk)
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
#define Cudd_IsComplement(node)
char * Abc_ConvertBddToSop(Mem_Flex_t *pMan, DdManager *dd, DdNode *bFuncOn, DdNode *bFuncOnDc, int nFanins, int fAllPrimes, Vec_Str_t *vCube, int fMode)
ABC_DLL int Abc_ObjRequiredLevel(Abc_Obj_t *pObj)
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
static void Vec_StrFree(Vec_Str_t *p)
static Dec_Graph_t * Dec_GraphCreateConst0()
#define ABC_NAMESPACE_IMPL_END
ABC_DLL int Abc_NodeMffcSize(Abc_Obj_t *pNode)
FUNCTION DEFINITIONS ///.
DdManager * Cudd_Init(unsigned int numVars, unsigned int numVarsZ, unsigned int numSlots, unsigned int cacheSize, unsigned long maxMemory)
int Abc_NtkRefactor(Abc_Ntk_t *pNtk, int nNodeSizeMax, int nConeSizeMax, int fUpdateLevel, int fUseZeros, int fUseDcs, int fVerbose)
FUNCTION DEFINITIONS ///.
DdNode * Cudd_bddOr(DdManager *dd, DdNode *f, DdNode *g)
ABC_DLL void Abc_NtkStartReverseLevels(Abc_Ntk_t *pNtk, int nMaxLevelIncrease)
DdNode * Abc_NodeConeDcs(DdManager *dd, DdNode **pbVarsX, DdNode **pbVarsY, Vec_Ptr_t *vLeaves, Vec_Ptr_t *vRoots, Vec_Ptr_t *vVisited)
#define Abc_NtkForEachNode(pNtk, pNode, i)
static int Abc_NodeIsPersistant(Abc_Obj_t *pNode)
#define ABC_NAMESPACE_IMPL_START
DdNode * Cudd_bddIsop(DdManager *dd, DdNode *L, DdNode *U)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
static void Abc_NtkManRefPrintStats(Abc_ManRef_t *p)
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
static Abc_ManRef_t * Abc_NtkManRefStart(int nNodeSizeMax, int nConeSizeMax, int fUseDcs, int fVerbose)
DdNode * Cudd_bddAnd(DdManager *dd, DdNode *f, DdNode *g)
ABC_DLL Abc_ManCut_t * Abc_NtkManCutStart(int nNodeSizeMax, int nConeSizeMax, int nNodeFanStop, int nConeFanStop)
static void Dec_GraphFree(Dec_Graph_t *pGraph)
#define ABC_INFINITY
MACRO DEFINITIONS ///.
int Cudd_zddVarsFromBddVars(DdManager *dd, int multiplicity)
ABC_DLL void Abc_NtkManCutStop(Abc_ManCut_t *p)
static Dec_Node_t * Dec_GraphNode(Dec_Graph_t *pGraph, int i)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
static void Abc_NtkManRefStop(Abc_ManRef_t *p)
typedefABC_NAMESPACE_IMPL_START struct Abc_ManRef_t_ Abc_ManRef_t
DECLARATIONS ///.
int Cudd_DagSize(DdNode *node)
static void Vec_PtrFree(Vec_Ptr_t *p)