abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
nwkMerge.h
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [nwkMerge.h]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Logic network representation.]
8 
9  Synopsis [External declarations.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 20, 2005.]
16 
17  Revision [$Id: nwkMerge.h,v 1.1 2008/05/14 22:13:09 wudenni Exp $]
18 
19 ***********************************************************************/
20 
21 #ifndef __NWK_MERGE_H__
22 #define __NWK_MERGE_H__
23 
24 
25 ////////////////////////////////////////////////////////////////////////
26 /// INCLUDES ///
27 ////////////////////////////////////////////////////////////////////////
28 
29 ////////////////////////////////////////////////////////////////////////
30 /// PARAMETERS ///
31 ////////////////////////////////////////////////////////////////////////
32 
33 
34 
36 
37 
38 #define NWK_MAX_LIST 16
39 
40 ////////////////////////////////////////////////////////////////////////
41 /// BASIC TYPES ///
42 ////////////////////////////////////////////////////////////////////////
43 
44 // the LUT merging parameters
45 typedef struct Nwk_LMPars_t_ Nwk_LMPars_t;
47 {
48  int nMaxLutSize; // the max LUT size for merging (N=5)
49  int nMaxSuppSize; // the max total support size after merging (S=5)
50  int nMaxDistance; // the max number of nodes separating LUTs
51  int nMaxLevelDiff; // the max difference in levels
52  int nMaxFanout; // the max number of fanouts to traverse
53  int fUseDiffSupp; // enables the use of nodes with different support
54  int fUseTfiTfo; // enables the use of TFO/TFO nodes as candidates
55  int fVeryVerbose; // enables additional verbose output
56  int fVerbose; // enables verbose output
57 };
58 
59 // edge of the graph
60 typedef struct Nwk_Edg_t_ Nwk_Edg_t;
61 struct Nwk_Edg_t_
62 {
63  int iNode1; // the first node
64  int iNode2; // the second node
65  Nwk_Edg_t * pNext; // the next edge
66 };
67 
68 // vertex of the graph
69 typedef struct Nwk_Vrt_t_ Nwk_Vrt_t;
70 struct Nwk_Vrt_t_
71 {
72  int Id; // the vertex number
73  int iPrev; // the previous vertex in the list
74  int iNext; // the next vertex in the list
75  int nEdges; // the number of edges
76  int pEdges[0]; // the array of edges
77 };
78 
79 // the connectivity graph
80 typedef struct Nwk_Grf_t_ Nwk_Grf_t;
81 struct Nwk_Grf_t_
82 {
83  // preliminary graph representation
84  int nObjs; // the number of objects
85  int nVertsMax; // the upper bound on the number of vertices
86  int nEdgeHash; // an approximate number of edges
87  Nwk_Edg_t ** pEdgeHash; // hash table for edges
88  Aig_MmFixed_t * pMemEdges; // memory for edges
89  // graph representation
90  int nEdges; // the number of edges
91  int nVerts; // the number of vertices
92  Nwk_Vrt_t ** pVerts; // the array of vertices
93  Aig_MmFlex_t * pMemVerts; // memory for vertices
94  // intermediate data
95  int pLists1[NWK_MAX_LIST+1]; // lists of nodes with one edge
96  int pLists2[NWK_MAX_LIST+1]; // lists of nodes with more than one edge
97  // the results of matching
98  Vec_Int_t * vPairs; // pairs matched in the graph
99  // object mappings
100  int * pMapLut2Id; // LUT numbers into vertex IDs
101  int * pMapId2Lut; // vertex IDs into LUT numbers
102  // other things
103  int nMemBytes1; // memory usage in bytes
104  int nMemBytes2; // memory usage in bytes
105 };
106 
107 ////////////////////////////////////////////////////////////////////////
108 /// MACRO DEFINITIONS ///
109 ////////////////////////////////////////////////////////////////////////
110 
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 )
114 
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 )
118 
119 #define Nwk_VertexForEachAdjacent( p, pVrt, pNext, k ) \
120  for ( k = 0; (k < pVrt->nEdges) && (((pNext) = p->pVerts[pVrt->pEdges[k]]), 1); k++ )
121 
122 ////////////////////////////////////////////////////////////////////////
123 /// INLINED FUNCTIONS ///
124 ////////////////////////////////////////////////////////////////////////
125 
126 ////////////////////////////////////////////////////////////////////////
127 /// ITERATORS ///
128 ////////////////////////////////////////////////////////////////////////
129 
130 ////////////////////////////////////////////////////////////////////////
131 /// FUNCTION DECLARATIONS ///
132 ////////////////////////////////////////////////////////////////////////
133 
134 /*=== nwkMerge.c ==========================================================*/
135 extern ABC_DLL Nwk_Grf_t * Nwk_ManGraphAlloc( int nVertsMax );
136 extern ABC_DLL void Nwk_ManGraphFree( Nwk_Grf_t * p );
138 extern ABC_DLL void Nwk_ManGraphHashEdge( Nwk_Grf_t * p, int iLut1, int iLut2 );
139 extern ABC_DLL void Nwk_ManGraphSolve( Nwk_Grf_t * p );
140 extern ABC_DLL int Nwk_ManLutMergeGraphTest( char * pFileName );
141 
142 
143 
145 
146 
147 
148 #endif
149 
150 ////////////////////////////////////////////////////////////////////////
151 /// END OF FILE ///
152 ////////////////////////////////////////////////////////////////////////
153 
int iNode1
Definition: nwkMerge.h:63
int nMemBytes1
Definition: nwkMerge.h:103
int fUseDiffSupp
Definition: nwkMerge.h:53
int iPrev
Definition: nwkMerge.h:73
ABC_DLL int Nwk_ManLutMergeGraphTest(char *pFileName)
Definition: nwkMerge.c:703
int nMaxFanout
Definition: nwkMerge.h:52
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int iNext
Definition: nwkMerge.h:74
Nwk_Vrt_t ** pVerts
Definition: nwkMerge.h:92
int Id
Definition: nwkMerge.h:72
int nEdgeHash
Definition: nwkMerge.h:86
int nMaxDistance
Definition: nwkMerge.h:50
int nEdges
Definition: nwkMerge.h:90
int pEdges[0]
Definition: nwkMerge.h:76
int nVertsMax
Definition: nwkMerge.h:85
int pLists2[NWK_MAX_LIST+1]
Definition: nwkMerge.h:96
Aig_MmFlex_t * pMemVerts
Definition: nwkMerge.h:93
#define ABC_DLL
Definition: abc_global.h:53
int nVerts
Definition: nwkMerge.h:91
DECLARATIONS ///.
Definition: aigMem.c:30
int nMaxSuppSize
Definition: nwkMerge.h:49
int nEdges
Definition: nwkMerge.h:75
int pLists1[NWK_MAX_LIST+1]
Definition: nwkMerge.h:95
ABC_DLL void Nwk_ManGraphSolve(Nwk_Grf_t *p)
Definition: nwkMerge.c:621
int nMemBytes2
Definition: nwkMerge.h:104
int nObjs
Definition: nwkMerge.h:84
ABC_DLL void Nwk_ManGraphHashEdge(Nwk_Grf_t *p, int iLut1, int iLut2)
Definition: nwkMerge.c:119
int fVeryVerbose
Definition: nwkMerge.h:55
int fUseTfiTfo
Definition: nwkMerge.h:54
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
Definition: abc_global.h:105
Nwk_Edg_t ** pEdgeHash
Definition: nwkMerge.h:87
int * pMapLut2Id
Definition: nwkMerge.h:100
int iNode2
Definition: nwkMerge.h:64
#define NWK_MAX_LIST
INCLUDES ///.
Definition: nwkMerge.h:38
#define ABC_NAMESPACE_HEADER_END
Definition: abc_global.h:106
Nwk_Edg_t * pNext
Definition: nwkMerge.h:65
int * pMapId2Lut
Definition: nwkMerge.h:101
ABC_DLL void Nwk_ManGraphFree(Nwk_Grf_t *p)
Definition: nwkMerge.c:70
int nMaxLutSize
Definition: nwkMerge.h:48
Vec_Int_t * vPairs
Definition: nwkMerge.h:98
ABC_DLL Nwk_Grf_t * Nwk_ManGraphAlloc(int nVertsMax)
INLINED FUNCTIONS ///.
Definition: nwkMerge.c:46
ABC_DLL void Nwk_ManGraphReportMemoryUsage(Nwk_Grf_t *p)
Definition: nwkMerge.c:93
int fVerbose
Definition: nwkMerge.h:56
int nMaxLevelDiff
Definition: nwkMerge.h:51
Aig_MmFixed_t * pMemEdges
Definition: nwkMerge.h:88