102 if ( pNtk->
pExdc == NULL )
103 printf(
"Warning: Networks has no EXDC.\n" );
130 printf(
"Abc_NtkFraigSweep: The network check has failed.\n" );
164 pNodeAig = pNode->
pCopy;
166 if ( pNodeAig == NULL )
206 pNodeAig = pNode->
pCopy;
208 if ( pNodeAig == NULL )
218 pNode->
pNext = *ppSlot;
231 if ( pList == NULL || pList->
pNext == NULL )
236 for ( pNode = pList; pNode; pNode = pNode->
pNext )
241 printf(
"Class %2d : {", c );
242 for ( pNode = pList; pNode; pNode = pNode->
pNext )
246 printf(
"(%c)", pNode->
fPhase?
'-' :
'+' );
247 printf(
"(%d)", pNode->
Level );
253 if ( fVerbose || fVeryVerbose )
255 printf(
"Sweeping stats for network \"%s\":\n", pNtk->
pName );
256 printf(
"Internal nodes = %d. Different functions (up to compl) = %d.\n",
Abc_NtkNodeNum(pNtk),
stmm_count(tStrash2Net) );
257 printf(
"Non-trivial classes = %d. Nodes in non-trivial classes = %d.\n",
stmm_count(tResult), Counter );
311 float Arrival1, Arrival2;
318 pListDir = pListInv = NULL;
319 for ( pNode = pChain, pNext = pChain->
pNext;
321 pNode = pNext, pNext = pNode? pNode->
pNext : NULL )
326 pNode->
pNext = pListDir;
331 pNode->
pNext = pListInv;
338 for ( pNode = pListDir; pNode; pNode = pNode->
pNext )
344 if ( Arrival1 > Arrival2 ||
345 (Arrival1 == Arrival2 && pNodeMin->
Level > pNode->
Level) ||
346 (Arrival1 == Arrival2 && pNodeMin->
Level == pNode->
Level &&
352 for ( pNode = pListDir; pNode; pNode = pNode->
pNext )
353 if ( pNode != pNodeMin )
358 for ( pNode = pListInv; pNode; pNode = pNode->
pNext )
364 if ( Arrival1 > Arrival2 ||
365 (Arrival1 == Arrival2 && pNodeMin->
Level > pNode->
Level) ||
366 (Arrival1 == Arrival2 && pNodeMin->
Level == pNode->
Level &&
372 for ( pNode = pListInv; pNode; pNode = pNode->
pNext )
373 if ( pNode != pNodeMin )
400 for ( pNode = pChain->
pNext; pNode; pNode = pNode->
pNext )
408 pListDir = pListInv = NULL;
409 for ( pNode = pChain, pNext = pChain->
pNext;
411 pNode = pNext, pNext = pNode? pNode->
pNext : NULL )
413 if ( pNode == pNodeMin )
418 pNode->
pNext = pListDir;
423 pNode->
pNext = pListInv;
429 for ( pNode = pListDir; pNode; pNode = pNode->
pNext )
433 if ( pListInv == NULL )
440 for ( pNode = pListInv; pNode; pNode = pNode->
pNext )
485 printf(
"Cleanup removed %d dangling nodes.\n", Counter );
519 printf(
"Cleanup removed %d dangling nodes.\n", Counter );
556 printf(
"Abc_NtkCleanup: The network check has failed.\n" );
583 fprintf( stdout,
"Converting to BDD has failed.\n" );
606 if ( pFanout == NULL )
653 printf(
"Sweep removed %d nodes.\n", nNodesOld -
Abc_NtkNodeNum(pNtk) );
677 printf(
"Node %s should be among",
Abc_ObjName(pFanin) );
678 printf(
" the fanins of node %s...\n",
Abc_ObjName(pNode) );
707 printf(
"These nodes will be deleted: \n" );
804 Abc_Obj_t * pFanin, * pLatch, * pLatchPivot = NULL;
812 if ( RetValue == -1 )
819 if ( pLatchPivot == NULL )
821 pLatchPivot = pLatch;
920 printf(
"Cleanup removed %4d dangling objects.\n", Counter );
926 printf(
"Cleanup removed %4d redundant latches.\n", Counter );
936 printf(
"Cleanup added %4d additional PIs.\n", Counter );
940 printf(
"Cleanup removed %4d autonomous objects.\n", Counter );
944 printf(
"Abc_NtkCleanupSeq: The network check has failed.\n" );
963 int i, k, fChanges = 1,
Counter = 0;
968 fprintf( stdout,
"Converting to SOP has failed.\n" );
1008 printf(
"Removed %d single input nodes.\n",
Counter );
ABC_DLL int Abc_ObjPointerCompare(void **pp1, void **pp2)
int Abc_NodeRemoveNonCurrentObjects(Abc_Ntk_t *pNtk)
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
static stmm_table * Abc_NtkFraigEquiv(Abc_Ntk_t *pNtk, int fUseInv, int fVerbose, int fVeryVerbose)
static int Abc_NtkIsLogic(Abc_Ntk_t *pNtk)
static int Abc_LatchInit(Abc_Obj_t *pLatch)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
ABC_DLL void * Abc_FrameReadLibGen()
static ABC_NAMESPACE_IMPL_START void Abc_NtkFraigSweepUsingExdc(Fraig_Man_t *pMan, Abc_Ntk_t *pNtk)
DECLARATIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Fraig_ManStruct_t_ Fraig_Man_t
INCLUDES ///.
ABC_DLL float Abc_NtkDelayTrace(Abc_Ntk_t *pNtk, Abc_Obj_t *pOut, Abc_Obj_t *pIn, int fPrint)
void Cudd_RecursiveDeref(DdManager *table, DdNode *n)
static void Abc_NtkFraigTransform(Abc_Ntk_t *pNtk, stmm_table *tEquiv, int fUseInv, int fVerbose)
stmm_table * stmm_init_table(stmm_compare_func_type compare, stmm_hash_func_type hash)
static int Abc_ObjIsBo(Abc_Obj_t *pObj)
ABC_DLL int Abc_NtkMinimumBase(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
ABC_DLL int Abc_NodeIsConst0(Abc_Obj_t *pNode)
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
void Fraig_ManFree(Fraig_Man_t *pMan)
static int Abc_NodeDroppingCost(Abc_Obj_t *pNode)
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
int stmm_insert(stmm_table *table, char *key, char *value)
ABC_DLL void Abc_ObjPrint(FILE *pFile, Abc_Obj_t *pObj)
Hop_Obj_t * Hop_Compose(Hop_Man_t *p, Hop_Obj_t *pRoot, Hop_Obj_t *pFunc, int iVar)
static void Abc_NodeSweep(Abc_Obj_t *pNode, int fVerbose)
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
#define stmm_count(table)
static int Vec_IntFind(Vec_Int_t *p, int Entry)
ABC_DLL void Abc_NtkDeleteObj_rec(Abc_Obj_t *pObj, int fOnlyNodes)
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
ABC_DLL int Abc_NtkRemoveDupFanins(Abc_Ntk_t *pNtk)
static int Abc_LatchIsInit0(Abc_Obj_t *pLatch)
#define Abc_NtkForEachCo(pNtk, pCo, i)
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
static int Vec_PtrSize(Vec_Ptr_t *p)
static void * Vec_PtrPop(Vec_Ptr_t *p)
static Hop_Obj_t * Hop_Not(Hop_Obj_t *p)
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
ABC_DLL Vec_Ptr_t * Abc_NtkDfsSeq(Abc_Ntk_t *pNtk)
int Abc_NtkCleanup(Abc_Ntk_t *pNtk, int fVerbose)
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
void Hop_ManStop(Hop_Man_t *p)
Fraig_Node_t * Abc_NtkToFraigExdc(Fraig_Man_t *pMan, Abc_Ntk_t *pNtkMain, Abc_Ntk_t *pNtkExdc)
ABC_DLL int Abc_NodeIsBuf(Abc_Obj_t *pNode)
static void Vec_PtrUniqify(Vec_Ptr_t *p, int(*Vec_PtrSortCompare)()) ___unused
ABC_DLL void Abc_ObjPatchFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFaninOld, Abc_Obj_t *pFaninNew)
void Abc_NtkSetTravId_rec(Abc_Obj_t *pObj)
ABC_DLL Abc_Obj_t * Abc_NodeFindNonCoFanout(Abc_Obj_t *pNode)
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
static void Abc_NtkFraigMergeClassMapped(Abc_Ntk_t *pNtk, Abc_Obj_t *pChain, int fUseInv, int fVerbose)
int Abc_NtkCleanupSeq(Abc_Ntk_t *pNtk, int fLatchSweep, int fAutoSweep, int fVerbose)
Fraig_Node_t * Fraig_NodeAnd(Fraig_Man_t *p, Fraig_Node_t *p1, Fraig_Node_t *p2)
ABC_DLL void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
DdNode * Cudd_Cofactor(DdManager *dd, DdNode *f, DdNode *g)
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeInv(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
int stmm_ptrhash(const char *x, int size)
int Abc_NtkFraigSweep(Abc_Ntk_t *pNtk, int fUseInv, int fExdc, int fVerbose, int fVeryVerbose)
FUNCTION DEFINITIONS ///.
#define ABC_NAMESPACE_IMPL_END
void Fraig_ParamsSetDefault(Fraig_Params_t *pParams)
int Abc_NtkSweep(Abc_Ntk_t *pNtk, int fVerbose)
ABC_DLL int Abc_NtkToBdd(Abc_Ntk_t *pNtk)
ABC_DLL Vec_Ptr_t * Abc_NtkDfsSeqReverse(Abc_Ntk_t *pNtk)
int Abc_NtkReplaceAutonomousLogic(Abc_Ntk_t *pNtk)
int Abc_NtkSweepBufsInvs(Abc_Ntk_t *pNtk, int fVerbose)
#define Abc_NtkForEachLatch(pNtk, pObj, i)
static int Abc_LatchIsInit1(Abc_Obj_t *pLatch)
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
int Abc_NtkCleanupNodes(Abc_Ntk_t *pNtk, Vec_Ptr_t *vRoots, int fVerbose)
int stmm_find_or_add(stmm_table *table, char *key, char ***slot)
static void Abc_NtkFraigMergeClass(Abc_Ntk_t *pNtk, Abc_Obj_t *pChain, int fUseInv, int fVerbose)
int Abc_NtkLatchSweep(Abc_Ntk_t *pNtk)
#define Fraig_IsComplement(p)
GLOBAL VARIABLES ///.
int Abc_NtkCheckConstant_rec(Abc_Obj_t *pObj)
#define Abc_NtkForEachNode(pNtk, pNode, i)
ABC_DLL void Abc_ObjTransferFanout(Abc_Obj_t *pObjOld, Abc_Obj_t *pObjNew)
#define ABC_NAMESPACE_IMPL_START
int stmm_ptrcmp(const char *x, const char *y)
void stmm_free_table(stmm_table *table)
ABC_DLL float Abc_NodeReadArrivalWorst(Abc_Obj_t *pNode)
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
static void Abc_NodeConstantInput(Abc_Obj_t *pNode, Abc_Obj_t *pFanin, int fConst0)
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
static int Abc_NtkIsMappedLogic(Abc_Ntk_t *pNtk)
ABC_DLL int Abc_NodeIsInv(Abc_Obj_t *pNode)
ABC_DLL Abc_Obj_t * Abc_NodeFindCoFanout(Abc_Obj_t *pNode)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
#define Abc_ObjForEachFanin(pObj, pFanin, i)
static int Abc_NtkIsBddLogic(Abc_Ntk_t *pNtk)
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
DdNode * Cudd_bddIthVar(DdManager *dd, int i)
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
#define Fraig_NotCond(p, c)
#define Cudd_NotCond(node, c)
ABC_DLL int Abc_NtkToAig(Abc_Ntk_t *pNtk)
ABC_DLL int Abc_NodeIsConst1(Abc_Obj_t *pNode)
ABC_DLL Vec_Ptr_t * Abc_NtkDfsNodes(Abc_Ntk_t *pNtk, Abc_Obj_t **ppNodes, int nNodes)
ABC_DLL int Abc_NodeRemoveDupFanins(Abc_Obj_t *pNode)
#define stmm_foreach_item(table, gen, key, value)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
static int Abc_ObjIsComplement(Abc_Obj_t *p)
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
static void ** Vec_PtrArray(Vec_Ptr_t *p)
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
ABC_DLL int Abc_NodeMinimumBase(Abc_Obj_t *pNode)
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
ABC_DLL void Abc_NodeComplementInput(Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
static int Abc_NtkReduceNodes(Abc_Ntk_t *pNtk, Vec_Ptr_t *vNodes)
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
ABC_DLL void * Abc_NtkToFraig(Abc_Ntk_t *pNtk, void *pParams, int fAllNodes, int fExdc)
static void Vec_PtrFree(Vec_Ptr_t *p)