ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
nwkMerge.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Nwk_LMPars_t_
 
struct  Nwk_Edg_t_
 
struct  Nwk_Vrt_t_
 
struct  Nwk_Grf_t_
 

Macros

#define NWK_MAX_LIST   16
 INCLUDES ///.
 
#define Nwk_GraphForEachEdge(p, pEdge, k)
 MACRO DEFINITIONS ///.
 
#define Nwk_ListForEachVertex(p, List, pVrt)
 
#define Nwk_VertexForEachAdjacent(p, pVrt, pNext, k)
 

Typedefs

typedef struct Nwk_LMPars_t_ Nwk_LMPars_t
 BASIC TYPES ///.
 
typedef struct Nwk_Edg_t_ Nwk_Edg_t
 
typedef struct Nwk_Vrt_t_ Nwk_Vrt_t
 
typedef struct Nwk_Grf_t_ Nwk_Grf_t
 

Functions

ABC_DLL Nwk_Grf_tNwk_ManGraphAlloc (int nVertsMax)
 INLINED FUNCTIONS ///.
 
ABC_DLL void Nwk_ManGraphFree (Nwk_Grf_t *p)
 
ABC_DLL void Nwk_ManGraphReportMemoryUsage (Nwk_Grf_t *p)
 
ABC_DLL void Nwk_ManGraphHashEdge (Nwk_Grf_t *p, int iLut1, int iLut2)
 
ABC_DLL void Nwk_ManGraphSolve (Nwk_Grf_t *p)
 
ABC_DLL int Nwk_ManLutMergeGraphTest (char *pFileName)
 

Macro Definition Documentation

◆ Nwk_GraphForEachEdge

#define Nwk_GraphForEachEdge ( p,
pEdge,
k )
Value:
for ( k = 0; k < p->nEdgeHash; k++ ) \
for ( pEdge = p->pEdgeHash[k]; pEdge; pEdge = pEdge->pNext )
Cube * p
Definition exorList.c:222

MACRO DEFINITIONS ///.

Definition at line 111 of file nwkMerge.h.

111#define Nwk_GraphForEachEdge( p, pEdge, k ) \
112 for ( k = 0; k < p->nEdgeHash; k++ ) \
113 for ( pEdge = p->pEdgeHash[k]; pEdge; pEdge = pEdge->pNext )

◆ Nwk_ListForEachVertex

#define Nwk_ListForEachVertex ( p,
List,
pVrt )
Value:
for ( pVrt = List? p->pVerts[List] : NULL; pVrt; \
pVrt = pVrt->iNext? p->pVerts[pVrt->iNext] : NULL )

Definition at line 115 of file nwkMerge.h.

115#define Nwk_ListForEachVertex( p, List, pVrt ) \
116 for ( pVrt = List? p->pVerts[List] : NULL; pVrt; \
117 pVrt = pVrt->iNext? p->pVerts[pVrt->iNext] : NULL )

◆ NWK_MAX_LIST

#define NWK_MAX_LIST   16

INCLUDES ///.

CFile****************************************************************

FileName [nwkMerge.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Logic network representation.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
nwkMerge.h,v 1.1 2008/05/14 22:13:09 wudenni Exp

] PARAMETERS ///

Definition at line 38 of file nwkMerge.h.

◆ Nwk_VertexForEachAdjacent

#define Nwk_VertexForEachAdjacent ( p,
pVrt,
pNext,
k )
Value:
for ( k = 0; (k < pVrt->nEdges) && (((pNext) = p->pVerts[pVrt->pEdges[k]]), 1); k++ )

Definition at line 119 of file nwkMerge.h.

119#define Nwk_VertexForEachAdjacent( p, pVrt, pNext, k ) \
120 for ( k = 0; (k < pVrt->nEdges) && (((pNext) = p->pVerts[pVrt->pEdges[k]]), 1); k++ )

Typedef Documentation

◆ Nwk_Edg_t

typedef struct Nwk_Edg_t_ Nwk_Edg_t

Definition at line 60 of file nwkMerge.h.

◆ Nwk_Grf_t

typedef struct Nwk_Grf_t_ Nwk_Grf_t

Definition at line 80 of file nwkMerge.h.

◆ Nwk_LMPars_t

typedef struct Nwk_LMPars_t_ Nwk_LMPars_t

BASIC TYPES ///.

Definition at line 45 of file nwkMerge.h.

◆ Nwk_Vrt_t

typedef struct Nwk_Vrt_t_ Nwk_Vrt_t

Definition at line 69 of file nwkMerge.h.

Function Documentation

◆ Nwk_ManGraphAlloc()

ABC_DLL Nwk_Grf_t * Nwk_ManGraphAlloc ( int nVertsMax)
extern

INLINED FUNCTIONS ///.

ITERATORS /// FUNCTION DECLARATIONS ///

INLINED FUNCTIONS ///.

CFile****************************************************************

FileName [nwkMerge.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Netlist representation.]

Synopsis [LUT merging algorithm.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
nwkMerge.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

] FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Allocates the graph.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file nwkMerge.c.

47{
48 Nwk_Grf_t * p;
49 p = ABC_ALLOC( Nwk_Grf_t, 1 );
50 memset( p, 0, sizeof(Nwk_Grf_t) );
51 p->nVertsMax = nVertsMax;
52 p->nEdgeHash = Abc_PrimeCudd( 3 * nVertsMax );
53 p->pEdgeHash = ABC_CALLOC( Nwk_Edg_t *, p->nEdgeHash );
54 p->pMemEdges = Aig_MmFixedStart( sizeof(Nwk_Edg_t), p->nEdgeHash );
55 p->vPairs = Vec_IntAlloc( 1000 );
56 return p;
57}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
Aig_MmFixed_t * Aig_MmFixedStart(int nEntrySize, int nEntriesMax)
FUNCTION DEFINITIONS ///.
Definition aigMem.c:96
struct Nwk_Edg_t_ Nwk_Edg_t
Definition nwkMerge.h:60
struct Nwk_Grf_t_ Nwk_Grf_t
Definition nwkMerge.h:80
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Nwk_ManGraphFree()

ABC_DLL void Nwk_ManGraphFree ( Nwk_Grf_t * p)
extern

Function*************************************************************

Synopsis [Deallocates the graph.]

Description []

SideEffects []

SeeAlso []

Definition at line 70 of file nwkMerge.c.

71{
72 if ( p->vPairs ) Vec_IntFree( p->vPairs );
73 if ( p->pMemEdges ) Aig_MmFixedStop( p->pMemEdges, 0 );
74 if ( p->pMemVerts ) Aig_MmFlexStop( p->pMemVerts, 0 );
75 ABC_FREE( p->pVerts );
76 ABC_FREE( p->pEdgeHash );
77 ABC_FREE( p->pMapLut2Id );
78 ABC_FREE( p->pMapId2Lut );
79 ABC_FREE( p );
80}
#define ABC_FREE(obj)
Definition abc_global.h:267
void Aig_MmFlexStop(Aig_MmFlex_t *p, int fVerbose)
Definition aigMem.c:337
void Aig_MmFixedStop(Aig_MmFixed_t *p, int fVerbose)
Definition aigMem.c:132
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Nwk_ManGraphHashEdge()

ABC_DLL void Nwk_ManGraphHashEdge ( Nwk_Grf_t * p,
int iLut1,
int iLut2 )
extern

Function*************************************************************

Synopsis [Finds or adds the edge to the graph.]

Description []

SideEffects []

SeeAlso []

Definition at line 119 of file nwkMerge.c.

120{
121 Nwk_Edg_t * pEntry;
122 unsigned Key;
123 if ( iLut1 == iLut2 )
124 return;
125 if ( iLut1 > iLut2 )
126 {
127 Key = iLut1;
128 iLut1 = iLut2;
129 iLut2 = Key;
130 }
131 assert( iLut1 < iLut2 );
132 if ( p->nObjs < iLut2 )
133 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 )
137 return;
138 pEntry = (Nwk_Edg_t *)Aig_MmFixedEntryFetch( p->pMemEdges );
139 pEntry->iNode1 = iLut1;
140 pEntry->iNode2 = iLut2;
141 pEntry->pNext = p->pEdgeHash[Key];
142 p->pEdgeHash[Key] = pEntry;
143 p->nEdges++;
144}
char * Aig_MmFixedEntryFetch(Aig_MmFixed_t *p)
Definition aigMem.c:161
int iNode1
Definition nwkMerge.h:63
Nwk_Edg_t * pNext
Definition nwkMerge.h:65
int iNode2
Definition nwkMerge.h:64
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Nwk_ManGraphReportMemoryUsage()

ABC_DLL void Nwk_ManGraphReportMemoryUsage ( Nwk_Grf_t * p)
extern

Function*************************************************************

Synopsis [Prepares the graph for solving the problem.]

Description []

SideEffects []

SeeAlso []

Definition at line 93 of file nwkMerge.c.

94{
95 p->nMemBytes1 =
96 sizeof(Nwk_Grf_t) +
97 sizeof(void *) * p->nEdgeHash +
98 sizeof(int) * (p->nObjs + p->nVertsMax) +
99 sizeof(Nwk_Edg_t) * p->nEdges;
100 p->nMemBytes2 =
101 sizeof(Nwk_Vrt_t) * p->nVerts +
102 sizeof(int) * 2 * p->nEdges;
103 printf( "Memory usage stats: Preprocessing = %.2f MB. Solving = %.2f MB.\n",
104 1.0 * p->nMemBytes1 / (1<<20), 1.0 * p->nMemBytes2 / (1<<20) );
105}
struct Nwk_Vrt_t_ Nwk_Vrt_t
Definition nwkMerge.h:69
Here is the caller graph for this function:

◆ Nwk_ManGraphSolve()

ABC_DLL void Nwk_ManGraphSolve ( Nwk_Grf_t * p)
extern

Function*************************************************************

Synopsis [Solves the problem by extracting one edge at a time.]

Description []

SideEffects []

SeeAlso []

Definition at line 621 of file nwkMerge.c.

622{
623 Nwk_Vrt_t * pVertex, * pNext;
624 int i, j;
626 while ( 1 )
627 {
628 // find the next vertex to extract
629 assert( p->pLists1[0] == 0 );
630 for ( i = 1; i <= NWK_MAX_LIST; i++ )
631 if ( p->pLists1[i] )
632 {
633// printf( "%d ", i );
634// printf( "ListA = %2d. Length = %5d.\n", i, Nwk_ManGraphListLength(p,p->pLists1[i]) );
635 pVertex = p->pVerts[ p->pLists1[i] ];
636 assert( pVertex->nEdges == 1 );
637 pNext = p->pVerts[ pVertex->pEdges[0] ];
638 Nwk_ManGraphUpdate( p, pVertex, pNext );
639 break;
640 }
641 if ( i < NWK_MAX_LIST + 1 )
642 continue;
643 // find the next vertex to extract
644 assert( p->pLists2[0] == 0 );
645 assert( p->pLists2[1] == 0 );
646 for ( j = 2; j <= NWK_MAX_LIST; j++ )
647 if ( p->pLists2[j] )
648 {
649// printf( "***%d ", j );
650// printf( "ListB = %2d. Length = %5d.\n", j, Nwk_ManGraphListLength(p,p->pLists2[j]) );
651 pVertex = Nwk_ManGraphListFindMin( p, p->pLists2[j] );
652 assert( pVertex->nEdges == j || j == NWK_MAX_LIST );
653 pNext = Nwk_ManGraphListFindMinEdge( p, pVertex );
654 Nwk_ManGraphUpdate( p, pVertex, pNext );
655 break;
656 }
657 if ( j == NWK_MAX_LIST + 1 )
658 break;
659 }
661}
void Nwk_ManGraphPrepare(Nwk_Grf_t *p)
Definition nwkMerge.c:276
void Nwk_ManGraphUpdate(Nwk_Grf_t *p, Nwk_Vrt_t *pVertex, Nwk_Vrt_t *pNext)
Definition nwkMerge.c:460
Nwk_Vrt_t * Nwk_ManGraphListFindMinEdge(Nwk_Grf_t *p, Nwk_Vrt_t *pVert)
Definition nwkMerge.c:567
void Nwk_ManGraphSortPairs(Nwk_Grf_t *p)
Definition nwkMerge.c:363
Nwk_Vrt_t * Nwk_ManGraphListFindMin(Nwk_Grf_t *p, int List)
Definition nwkMerge.c:590
#define NWK_MAX_LIST
INCLUDES ///.
Definition nwkMerge.h:38
int pEdges[0]
Definition nwkMerge.h:76
int nEdges
Definition nwkMerge.h:75
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Nwk_ManLutMergeGraphTest()

ABC_DLL int Nwk_ManLutMergeGraphTest ( char * pFileName)
extern

Function*************************************************************

Synopsis [Solves the graph coming from file.]

Description []

SideEffects []

SeeAlso []

Definition at line 703 of file nwkMerge.c.

704{
705 int nPairs;
706 Nwk_Grf_t * p;
707 abctime clk = Abc_Clock();
708 p = Nwk_ManLutMergeReadGraph( pFileName );
709 ABC_PRT( "Reading", Abc_Clock() - clk );
710 clk = Abc_Clock();
712 printf( "GRAPH: Nodes = %6d. Edges = %6d. Pairs = %6d. ",
713 p->nVerts, p->nEdges, Vec_IntSize(p->vPairs)/2 );
714 ABC_PRT( "Solving", Abc_Clock() - clk );
715 nPairs = Vec_IntSize(p->vPairs)/2;
718 return nPairs;
719}
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_PRT(a, t)
Definition abc_global.h:255
void Nwk_ManGraphSolve(Nwk_Grf_t *p)
Definition nwkMerge.c:621
Nwk_Grf_t * Nwk_ManLutMergeReadGraph(char *pFileName)
Definition nwkMerge.c:674
void Nwk_ManGraphReportMemoryUsage(Nwk_Grf_t *p)
Definition nwkMerge.c:93
void Nwk_ManGraphFree(Nwk_Grf_t *p)
Definition nwkMerge.c:70
Here is the call graph for this function: