102 sizeof(int) * 2 * p->
nEdges;
103 printf(
"Memory usage stats: Preprocessing = %.2f MB. Solving = %.2f MB.\n",
123 if ( iLut1 == iLut2 )
132 if ( p->
nObjs < iLut2 )
134 Key = (unsigned)(741457 * iLut1 + 4256249 * iLut2) % p->
nEdgeHash;
135 for ( pEntry = p->
pEdgeHash[Key]; pEntry; pEntry = pEntry->
pNext )
136 if ( pEntry->
iNode1 == iLut1 && pEntry->
iNode2 == iLut2 )
162 pHead = p->
pVerts[*pList];
167 *pList = pVertex->
Id;
184 if ( pVertex->
iPrev )
189 if ( pVertex->
iNext )
194 if ( *pList == pVertex->
Id )
195 *pList = pVertex->
iNext;
215 if ( pVertex->
nEdges == 1 )
248 if ( pVertex->
nEdges == 1 )
280 int * pnEdges, nBytes, i;
296 for ( i = 0; i <= p->
nObjs; i++ )
316 pnEdges[pEntry->
iNode1]++;
317 pnEdges[pEntry->
iNode2]++;
323 for ( i = 1; i <= p->
nVerts; i++ )
326 nBytes =
sizeof(
Nwk_Vrt_t) +
sizeof(
int) * pnEdges[i];
340 for ( i = 1; i <= p->
nVerts; i++ )
369 for ( i = 0; i <= p->
nObjs; i++ )
372 for ( i = 0; i < p->
vPairs->nSize; i += 2 )
375 pIdToPair[ p->
vPairs->pArray[i] ] = p->
vPairs->pArray[i+1];
379 for ( i = 0; i <= p->
nObjs; i++ )
380 if ( pIdToPair[i] >= 0 )
382 assert( i < pIdToPair[i] );
440 for ( k = 0; k < pThis->
nEdges; k++ )
441 if ( pThis->
pEdges[k] == pNext->
Id )
443 assert( k < pThis->nEdges );
445 for ( ; k < pThis->
nEdges; k++ )
470 if ( pChanged == pNext )
474 if ( pChanged->
nEdges > 1 )
477 if ( pOther == pVertex || pOther->
nEdges > 1 )
488 if ( pChanged->
nEdges > 0 )
494 if ( pChanged == pVertex )
498 if ( pChanged->
nEdges > 1 )
501 if ( pOther == pNext || pOther->
nEdges > 1 )
512 if ( pChanged->
nEdges > 0 )
516 if ( pVertex->
Id < pNext->
Id )
547 if ( fVerbose && Counter < 20 )
573 if ( pMinCost == NULL || pMinCost->
nEdges > pThis->
nEdges )
593 int k,
Counter = 10000, BestCost = 1000000;
596 for ( k = 0; k < pThis->
nEdges; k++ )
604 if ( --Counter == 0 )
679 int nNodes, nEdges, iNode1, iNode2;
681 pFile = fopen( pFileName,
"r" );
682 RetValue = fscanf( pFile,
"%s %d", Buffer, &nNodes );
683 RetValue = fscanf( pFile,
"%s %d", Buffer, &nEdges );
685 while ( fscanf( pFile,
"%s %d %d", Buffer, &iNode1, &iNode2 ) == 3 )
712 printf(
"GRAPH: Nodes = %6d. Edges = %6d. Pairs = %6d. ",
905 nCounter += !pFanin->MarkC;
975 Vec_Ptr_t * vStart, * vNext, * vCands1, * vCands2;
977 int i, k, nVertsMax, nCands;
1007 printf(
"Node %6d : Fanins = %d. Fanouts = %3d. Cand1 = %3d. Cand2 = %3d.\n",
1017 printf(
"Mergable LUTs = %6d. Total cands = %6d. ", p->
nVertsMax, nCands );
1025 printf(
"GRAPH: Nodes = %6d. Edges = %6d. Pairs = %6d. ",
void Nwk_ManGraphReportMemoryUsage(Nwk_Grf_t *p)
static void Nwk_ManGraphListInsert(Nwk_Grf_t *p, Nwk_Vrt_t *pVertex)
Vec_Int_t * Nwk_ManLutMerge(Nwk_Man_t *pNtk, void *pParsInit)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
static int Abc_PrimeCudd(unsigned int p)
static int Nwk_ObjFanoutNum(Nwk_Obj_t *p)
void Nwk_ManMarkFanins_rec(Nwk_Obj_t *pLut, int nLevMin)
typedefABC_NAMESPACE_HEADER_START struct Nwk_Obj_t_ Nwk_Obj_t
INCLUDES ///.
static void Nwk_ManGraphVertexRemoveEdge(Nwk_Vrt_t *pThis, Nwk_Vrt_t *pNext)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
#define Nwk_ListForEachVertex(p, List, pVrt)
int Nwk_ManCountTotalFanins(Nwk_Obj_t *pLut, Nwk_Obj_t *pCand)
void Aig_MmFixedStop(Aig_MmFixed_t *p, int fVerbose)
char * Aig_MmFlexEntryFetch(Aig_MmFlex_t *p, int nBytes)
static int Nwk_ObjId(Nwk_Obj_t *p)
#define Nwk_GraphForEachEdge(p, pEdge, k)
MACRO DEFINITIONS ///.
#define Nwk_ObjForEachFanout(pObj, pFanout, i)
void Nwk_ManGraphFree(Nwk_Grf_t *p)
static void Nwk_ManGraphListExtract(Nwk_Grf_t *p, Nwk_Vrt_t *pVertex)
int Nwk_ManGraphListLength(Nwk_Grf_t *p, int List)
void Nwk_ManGraphSolve(Nwk_Grf_t *p)
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
#define ABC_ALLOC(type, num)
static abctime Abc_Clock()
int pLists2[NWK_MAX_LIST+1]
static int Vec_PtrSize(Vec_Ptr_t *p)
Aig_MmFixed_t * Aig_MmFixedStart(int nEntrySize, int nEntriesMax)
FUNCTION DEFINITIONS ///.
int Nwk_ManLutMergeGraphTest(char *pFileName)
static void Nwk_ManGraphListAdd(Nwk_Grf_t *p, int *pList, Nwk_Vrt_t *pVertex)
static int Nwk_ObjFaninNum(Nwk_Obj_t *p)
struct Nwk_Edg_t_ Nwk_Edg_t
#define Nwk_VertexForEachAdjacent(p, pVrt, pNext, k)
static void Nwk_ObjSetTravIdCurrent(Nwk_Obj_t *pObj)
static void Nwk_ManGraphListDelete(Nwk_Grf_t *p, int *pList, Nwk_Vrt_t *pVertex)
int pLists1[NWK_MAX_LIST+1]
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
void Nwk_ManCollectOverlapCands(Nwk_Obj_t *pLut, Vec_Ptr_t *vCands, Nwk_LMPars_t *pPars)
void Nwk_ManGraphCheckLists(Nwk_Grf_t *p)
void Nwk_ManGraphHashEdge(Nwk_Grf_t *p, int iLut1, int iLut2)
static int Nwk_ObjIsTravIdCurrent(Nwk_Obj_t *pObj)
ABC_NAMESPACE_IMPL_START Nwk_Grf_t * Nwk_ManGraphAlloc(int nVertsMax)
DECLARATIONS ///.
struct Nwk_Grf_t_ Nwk_Grf_t
#define ABC_NAMESPACE_IMPL_END
static void Nwk_ObjSetTravIdPrevious(Nwk_Obj_t *pObj)
char * Aig_MmFixedEntryFetch(Aig_MmFixed_t *p)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Nwk_Vrt_t * Nwk_ManGraphListFindMinEdge(Nwk_Grf_t *p, Nwk_Vrt_t *pVert)
ABC_DLL void Nwk_ManIncrementTravId(Nwk_Man_t *pNtk)
DECLARATIONS ///.
void Nwk_ManGraphUpdate(Nwk_Grf_t *p, Nwk_Vrt_t *pVertex, Nwk_Vrt_t *pNext)
void Nwk_ManGraphSortPairs(Nwk_Grf_t *p)
#define NWK_MAX_LIST
INCLUDES ///.
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Nwk_Grf_t * Nwk_ManLutMergeReadGraph(char *pFileName)
static int Nwk_ObjIsNode(Nwk_Obj_t *p)
#define ABC_NAMESPACE_IMPL_START
void Nwk_ManMarkFanouts_rec(Nwk_Obj_t *pLut, int nLevMax, int nFanMax)
static int Vec_IntSize(Vec_Int_t *p)
struct Nwk_Vrt_t_ Nwk_Vrt_t
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
#define Nwk_ObjForEachFanin(pObj, pFanin, i)
void Nwk_ManCollectNonOverlapCands(Nwk_Obj_t *pLut, Vec_Ptr_t *vStart, Vec_Ptr_t *vNext, Vec_Ptr_t *vCands, Nwk_LMPars_t *pPars)
void Nwk_ManGraphPrepare(Nwk_Grf_t *p)
Aig_MmFlex_t * Aig_MmFlexStart()
void Aig_MmFlexStop(Aig_MmFlex_t *p, int fVerbose)
#define ABC_CALLOC(type, num)
static int Nwk_ObjLevel(Nwk_Obj_t *pObj)
static void Vec_PtrClear(Vec_Ptr_t *p)
Nwk_Vrt_t * Nwk_ManGraphListFindMin(Nwk_Grf_t *p, int List)
static void Vec_IntFree(Vec_Int_t *p)
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
void Nwk_ManCollectCircle(Vec_Ptr_t *vStart, Vec_Ptr_t *vNext, int nFanMax)
static void Vec_IntClear(Vec_Int_t *p)
static void Vec_PtrShrink(Vec_Ptr_t *p, int nSizeNew)
Aig_MmFixed_t * pMemEdges
static void Vec_PtrFree(Vec_Ptr_t *p)
#define Nwk_ManForEachNode(p, pObj, i)