abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
hop.h
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [hop.h]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Minimalistic And-Inverter Graph package.]
8 
9  Synopsis [External declarations.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - May 11, 2006.]
16 
17  Revision [$Id: hop.h,v 1.00 2006/05/11 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #ifndef ABC__aig__hop__hop_h
22 #define ABC__aig__hop__hop_h
23 
24 
25 ////////////////////////////////////////////////////////////////////////
26 /// INCLUDES ///
27 ////////////////////////////////////////////////////////////////////////
28 
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <string.h>
32 #include <assert.h>
33 
34 #include "misc/vec/vec.h"
35 
36 ////////////////////////////////////////////////////////////////////////
37 /// PARAMETERS ///
38 ////////////////////////////////////////////////////////////////////////
39 
40 
41 
43 
44 
45 ////////////////////////////////////////////////////////////////////////
46 /// BASIC TYPES ///
47 ////////////////////////////////////////////////////////////////////////
48 
49 typedef struct Hop_Man_t_ Hop_Man_t;
50 typedef struct Hop_Obj_t_ Hop_Obj_t;
51 typedef int Hop_Edge_t;
52 
53 // object types
54 typedef enum {
55  AIG_NONE, // 0: non-existent object
56  AIG_CONST1, // 1: constant 1
57  AIG_PI, // 2: primary input
58  AIG_PO, // 3: primary output
59  AIG_AND, // 4: AND node
60  AIG_EXOR, // 5: EXOR node
61  AIG_VOID // 6: unused object
62 } Hop_Type_t;
63 
64 // the AIG node
65 struct Hop_Obj_t_ // 6 words
66 {
67  union {
68  void * pData; // misc
69  int iData; }; // misc
70  union {
71  Hop_Obj_t * pNext; // strashing table
72  int PioNum; }; // the number of PI/PO
73  Hop_Obj_t * pFanin0; // fanin
74  Hop_Obj_t * pFanin1; // fanin
75  unsigned int Type : 3; // object type
76  unsigned int fPhase : 1; // value under 000...0 pattern
77  unsigned int fMarkA : 1; // multipurpose mask
78  unsigned int fMarkB : 1; // multipurpose mask
79  unsigned int nRefs : 26; // reference count (level)
80  int Id; // unique ID of the node
81 };
82 
83 // the AIG manager
84 struct Hop_Man_t_
85 {
86  // AIG nodes
87  Vec_Ptr_t * vPis; // the array of PIs
88  Vec_Ptr_t * vPos; // the array of POs
89  Vec_Ptr_t * vObjs; // the array of all nodes (optional)
90  Hop_Obj_t * pConst1; // the constant 1 node
91  Hop_Obj_t Ghost; // the ghost node
92  // AIG node counters
93  int nObjs[AIG_VOID];// the number of objects by type
94  int nCreated; // the number of created objects
95  int nDeleted; // the number of deleted objects
96  // stuctural hash table
97  Hop_Obj_t ** pTable; // structural hash table
98  int nTableSize; // structural hash table size
99  // various data members
100  void * pData; // the temporary data
101  int nTravIds; // the current traversal ID
102  int fRefCount; // enables reference counting
103  int fCatchExor; // enables EXOR nodes
104  // memory management
105  Vec_Ptr_t * vChunks; // allocated memory pieces
106  Vec_Ptr_t * vPages; // memory pages used by nodes
107  Hop_Obj_t * pListFree; // the list of free nodes
108  // timing statistics
111 };
112 
113 ////////////////////////////////////////////////////////////////////////
114 /// MACRO DEFINITIONS ///
115 ////////////////////////////////////////////////////////////////////////
116 extern void Hop_ManAddMemory( Hop_Man_t * p );
117 
118 static inline int Hop_BitWordNum( int nBits ) { return (nBits>>5) + ((nBits&31) > 0); }
119 static inline int Hop_TruthWordNum( int nVars ) { return nVars <= 5 ? 1 : (1 << (nVars - 5)); }
120 static inline int Hop_InfoHasBit( unsigned * p, int i ) { return (p[(i)>>5] & (1<<((i) & 31))) > 0; }
121 static inline void Hop_InfoSetBit( unsigned * p, int i ) { p[(i)>>5] |= (1<<((i) & 31)); }
122 static inline void Hop_InfoXorBit( unsigned * p, int i ) { p[(i)>>5] ^= (1<<((i) & 31)); }
123 static inline int Hop_Base2Log( unsigned n ) { int r; if ( n < 2 ) return n; for ( r = 0, n--; n; n >>= 1, r++ ) {}; return r; }
124 static inline int Hop_Base10Log( unsigned n ) { int r; if ( n < 2 ) return n; for ( r = 0, n--; n; n /= 10, r++ ) {}; return r; }
125 
126 static inline Hop_Obj_t * Hop_Regular( Hop_Obj_t * p ) { return (Hop_Obj_t *)((ABC_PTRUINT_T)(p) & ~01); }
127 static inline Hop_Obj_t * Hop_Not( Hop_Obj_t * p ) { return (Hop_Obj_t *)((ABC_PTRUINT_T)(p) ^ 01); }
128 static inline Hop_Obj_t * Hop_NotCond( Hop_Obj_t * p, int c ) { return (Hop_Obj_t *)((ABC_PTRUINT_T)(p) ^ (c)); }
129 static inline int Hop_IsComplement( Hop_Obj_t * p ) { return (int)((ABC_PTRUINT_T)(p) & 01); }
130 
131 static inline Hop_Obj_t * Hop_ManConst0( Hop_Man_t * p ) { return Hop_Not(p->pConst1); }
132 static inline Hop_Obj_t * Hop_ManConst1( Hop_Man_t * p ) { return p->pConst1; }
133 static inline Hop_Obj_t * Hop_ManGhost( Hop_Man_t * p ) { return &p->Ghost; }
134 static inline Hop_Obj_t * Hop_ManPi( Hop_Man_t * p, int i ) { return (Hop_Obj_t *)Vec_PtrEntry(p->vPis, i); }
135 static inline Hop_Obj_t * Hop_ManPo( Hop_Man_t * p, int i ) { return (Hop_Obj_t *)Vec_PtrEntry(p->vPos, i); }
136 static inline Hop_Obj_t * Hop_ManObj( Hop_Man_t * p, int i ) { return p->vObjs ? (Hop_Obj_t *)Vec_PtrEntry(p->vObjs, i) : NULL; }
137 
138 static inline Hop_Edge_t Hop_EdgeCreate( int Id, int fCompl ) { return (Id << 1) | fCompl; }
139 static inline int Hop_EdgeId( Hop_Edge_t Edge ) { return Edge >> 1; }
140 static inline int Hop_EdgeIsComplement( Hop_Edge_t Edge ) { return Edge & 1; }
141 static inline Hop_Edge_t Hop_EdgeRegular( Hop_Edge_t Edge ) { return (Edge >> 1) << 1; }
142 static inline Hop_Edge_t Hop_EdgeNot( Hop_Edge_t Edge ) { return Edge ^ 1; }
143 static inline Hop_Edge_t Hop_EdgeNotCond( Hop_Edge_t Edge, int fCond ) { return Edge ^ fCond; }
144 
145 static inline int Hop_ManPiNum( Hop_Man_t * p ) { return p->nObjs[AIG_PI]; }
146 static inline int Hop_ManPoNum( Hop_Man_t * p ) { return p->nObjs[AIG_PO]; }
147 static inline int Hop_ManAndNum( Hop_Man_t * p ) { return p->nObjs[AIG_AND]; }
148 static inline int Hop_ManExorNum( Hop_Man_t * p ) { return p->nObjs[AIG_EXOR]; }
149 static inline int Hop_ManNodeNum( Hop_Man_t * p ) { return p->nObjs[AIG_AND]+p->nObjs[AIG_EXOR];}
150 static inline int Hop_ManGetCost( Hop_Man_t * p ) { return p->nObjs[AIG_AND]+3*p->nObjs[AIG_EXOR]; }
151 static inline int Hop_ManObjNum( Hop_Man_t * p ) { return p->nCreated - p->nDeleted; }
152 
153 static inline Hop_Type_t Hop_ObjType( Hop_Obj_t * pObj ) { return (Hop_Type_t)pObj->Type; }
154 static inline int Hop_ObjIsNone( Hop_Obj_t * pObj ) { return pObj->Type == AIG_NONE; }
155 static inline int Hop_ObjIsConst1( Hop_Obj_t * pObj ) { assert(!Hop_IsComplement(pObj)); return pObj->Type == AIG_CONST1; }
156 static inline int Hop_ObjIsPi( Hop_Obj_t * pObj ) { return pObj->Type == AIG_PI; }
157 static inline int Hop_ObjIsPo( Hop_Obj_t * pObj ) { return pObj->Type == AIG_PO; }
158 static inline int Hop_ObjIsAnd( Hop_Obj_t * pObj ) { return pObj->Type == AIG_AND; }
159 static inline int Hop_ObjIsExor( Hop_Obj_t * pObj ) { return pObj->Type == AIG_EXOR; }
160 static inline int Hop_ObjIsNode( Hop_Obj_t * pObj ) { return pObj->Type == AIG_AND || pObj->Type == AIG_EXOR; }
161 static inline int Hop_ObjIsTerm( Hop_Obj_t * pObj ) { return pObj->Type == AIG_PI || pObj->Type == AIG_PO || pObj->Type == AIG_CONST1; }
162 static inline int Hop_ObjIsHash( Hop_Obj_t * pObj ) { return pObj->Type == AIG_AND || pObj->Type == AIG_EXOR; }
163 
164 static inline int Hop_ObjIsMarkA( Hop_Obj_t * pObj ) { return pObj->fMarkA; }
165 static inline void Hop_ObjSetMarkA( Hop_Obj_t * pObj ) { pObj->fMarkA = 1; }
166 static inline void Hop_ObjClearMarkA( Hop_Obj_t * pObj ) { pObj->fMarkA = 0; }
167 
168 static inline void Hop_ObjSetTravId( Hop_Obj_t * pObj, int TravId ) { pObj->pData = (void *)(ABC_PTRINT_T)TravId; }
169 static inline void Hop_ObjSetTravIdCurrent( Hop_Man_t * p, Hop_Obj_t * pObj ) { pObj->pData = (void *)(ABC_PTRINT_T)p->nTravIds; }
170 static inline void Hop_ObjSetTravIdPrevious( Hop_Man_t * p, Hop_Obj_t * pObj ) { pObj->pData = (void *)(ABC_PTRINT_T)(p->nTravIds - 1); }
171 static inline int Hop_ObjIsTravIdCurrent( Hop_Man_t * p, Hop_Obj_t * pObj ) { return (int)((int)(ABC_PTRINT_T)pObj->pData == p->nTravIds); }
172 static inline int Hop_ObjIsTravIdPrevious( Hop_Man_t * p, Hop_Obj_t * pObj ) { return (int)((int)(ABC_PTRINT_T)pObj->pData == p->nTravIds - 1); }
173 
174 static inline int Hop_ObjTravId( Hop_Obj_t * pObj ) { return (int)(ABC_PTRINT_T)pObj->pData; }
175 static inline int Hop_ObjPhase( Hop_Obj_t * pObj ) { return pObj->fPhase; }
176 static inline int Hop_ObjRefs( Hop_Obj_t * pObj ) { return pObj->nRefs; }
177 static inline void Hop_ObjRef( Hop_Obj_t * pObj ) { pObj->nRefs++; }
178 static inline void Hop_ObjDeref( Hop_Obj_t * pObj ) { assert( pObj->nRefs > 0 ); pObj->nRefs--; }
179 static inline void Hop_ObjClearRef( Hop_Obj_t * pObj ) { pObj->nRefs = 0; }
180 static inline int Hop_ObjFaninC0( Hop_Obj_t * pObj ) { return Hop_IsComplement(pObj->pFanin0); }
181 static inline int Hop_ObjFaninC1( Hop_Obj_t * pObj ) { return Hop_IsComplement(pObj->pFanin1); }
182 static inline Hop_Obj_t * Hop_ObjFanin0( Hop_Obj_t * pObj ) { return Hop_Regular(pObj->pFanin0); }
183 static inline Hop_Obj_t * Hop_ObjFanin1( Hop_Obj_t * pObj ) { return Hop_Regular(pObj->pFanin1); }
184 static inline Hop_Obj_t * Hop_ObjChild0( Hop_Obj_t * pObj ) { return pObj->pFanin0; }
185 static inline Hop_Obj_t * Hop_ObjChild1( Hop_Obj_t * pObj ) { return pObj->pFanin1; }
186 static inline Hop_Obj_t * Hop_ObjChild0Copy( Hop_Obj_t * pObj ) { assert( !Hop_IsComplement(pObj) ); return Hop_ObjFanin0(pObj)? Hop_NotCond((Hop_Obj_t *)Hop_ObjFanin0(pObj)->pData, Hop_ObjFaninC0(pObj)) : NULL; }
187 static inline Hop_Obj_t * Hop_ObjChild1Copy( Hop_Obj_t * pObj ) { assert( !Hop_IsComplement(pObj) ); return Hop_ObjFanin1(pObj)? Hop_NotCond((Hop_Obj_t *)Hop_ObjFanin1(pObj)->pData, Hop_ObjFaninC1(pObj)) : NULL; }
188 static inline int Hop_ObjChild0CopyI( Hop_Obj_t * pObj ) { assert( !Hop_IsComplement(pObj) ); return Hop_ObjFanin0(pObj)? Abc_LitNotCond(Hop_ObjFanin0(pObj)->iData, Hop_ObjFaninC0(pObj)) : -1; }
189 static inline int Hop_ObjChild1CopyI( Hop_Obj_t * pObj ) { assert( !Hop_IsComplement(pObj) ); return Hop_ObjFanin1(pObj)? Abc_LitNotCond(Hop_ObjFanin1(pObj)->iData, Hop_ObjFaninC1(pObj)) : -1; }
190 static inline int Hop_ObjLevel( Hop_Obj_t * pObj ) { return pObj->nRefs; }
191 static inline int Hop_ObjLevelNew( Hop_Obj_t * pObj ) { return 1 + Hop_ObjIsExor(pObj) + Abc_MaxInt(Hop_ObjFanin0(pObj)->nRefs, Hop_ObjFanin1(pObj)->nRefs); }
192 static inline int Hop_ObjPhaseCompl( Hop_Obj_t * pObj ) { return Hop_IsComplement(pObj)? !Hop_Regular(pObj)->fPhase : pObj->fPhase; }
193 static inline void Hop_ObjClean( Hop_Obj_t * pObj ) { memset( pObj, 0, sizeof(Hop_Obj_t) ); }
194 static inline int Hop_ObjWhatFanin( Hop_Obj_t * pObj, Hop_Obj_t * pFanin )
195 {
196  if ( Hop_ObjFanin0(pObj) == pFanin ) return 0;
197  if ( Hop_ObjFanin1(pObj) == pFanin ) return 1;
198  assert(0); return -1;
199 }
200 static inline int Hop_ObjFanoutC( Hop_Obj_t * pObj, Hop_Obj_t * pFanout )
201 {
202  if ( Hop_ObjFanin0(pFanout) == pObj ) return Hop_ObjFaninC0(pObj);
203  if ( Hop_ObjFanin1(pFanout) == pObj ) return Hop_ObjFaninC1(pObj);
204  assert(0); return -1;
205 }
206 
207 // create the ghost of the new node
208 static inline Hop_Obj_t * Hop_ObjCreateGhost( Hop_Man_t * p, Hop_Obj_t * p0, Hop_Obj_t * p1, Hop_Type_t Type )
209 {
210  Hop_Obj_t * pGhost;
211  assert( Type != AIG_AND || !Hop_ObjIsConst1(Hop_Regular(p0)) );
212  assert( p1 == NULL || !Hop_ObjIsConst1(Hop_Regular(p1)) );
213  assert( Type == AIG_PI || Hop_Regular(p0) != Hop_Regular(p1) );
214  pGhost = Hop_ManGhost(p);
215  pGhost->Type = Type;
216  if ( Hop_Regular(p0)->Id < Hop_Regular(p1)->Id )
217  {
218  pGhost->pFanin0 = p0;
219  pGhost->pFanin1 = p1;
220  }
221  else
222  {
223  pGhost->pFanin0 = p1;
224  pGhost->pFanin1 = p0;
225  }
226  return pGhost;
227 }
228 
229 // internal memory manager
231 {
232  Hop_Obj_t * pTemp;
233  if ( p->pListFree == NULL )
234  Hop_ManAddMemory( p );
235  pTemp = p->pListFree;
236  p->pListFree = *((Hop_Obj_t **)pTemp);
237  memset( pTemp, 0, sizeof(Hop_Obj_t) );
238  if ( p->vObjs )
239  {
240  assert( p->nCreated == Vec_PtrSize(p->vObjs) );
241  Vec_PtrPush( p->vObjs, pTemp );
242  }
243  pTemp->Id = p->nCreated++;
244  return pTemp;
245 }
246 static inline void Hop_ManRecycleMemory( Hop_Man_t * p, Hop_Obj_t * pEntry )
247 {
248  pEntry->Type = AIG_NONE; // distinquishes dead node from live node
249  *((Hop_Obj_t **)pEntry) = p->pListFree;
250  p->pListFree = pEntry;
251 }
252 
253 
254 ////////////////////////////////////////////////////////////////////////
255 /// ITERATORS ///
256 ////////////////////////////////////////////////////////////////////////
257 
258 // iterator over the primary inputs
259 #define Hop_ManForEachPi( p, pObj, i ) \
260  Vec_PtrForEachEntry( Hop_Obj_t *, p->vPis, pObj, i )
261 // iterator over the primary outputs
262 #define Hop_ManForEachPo( p, pObj, i ) \
263  Vec_PtrForEachEntry( Hop_Obj_t *, p->vPos, pObj, i )
264 // iterator over all objects, including those currently not used
265 #define Hop_ManForEachNode( p, pObj, i ) \
266  for ( i = 0; i < p->nTableSize; i++ ) \
267  if ( ((pObj) = p->pTable[i]) == NULL ) {} else
268 
269 ////////////////////////////////////////////////////////////////////////
270 /// FUNCTION DECLARATIONS ///
271 ////////////////////////////////////////////////////////////////////////
272 
273 /*=== hopBalance.c ========================================================*/
274 extern Hop_Man_t * Hop_ManBalance( Hop_Man_t * p, int fUpdateLevel );
275 extern Hop_Obj_t * Hop_NodeBalanceBuildSuper( Hop_Man_t * p, Vec_Ptr_t * vSuper, Hop_Type_t Type, int fUpdateLevel );
276 /*=== hopCheck.c ========================================================*/
277 extern int Hop_ManCheck( Hop_Man_t * p );
278 /*=== hopDfs.c ==========================================================*/
279 extern Vec_Ptr_t * Hop_ManDfs( Hop_Man_t * p );
280 extern Vec_Ptr_t * Hop_ManDfsNode( Hop_Man_t * p, Hop_Obj_t * pNode );
281 extern int Hop_ManCountLevels( Hop_Man_t * p );
282 extern void Hop_ManCreateRefs( Hop_Man_t * p );
283 extern int Hop_DagSize( Hop_Obj_t * pObj );
284 extern int Hop_ObjFanoutCount( Hop_Obj_t * pObj, Hop_Obj_t * pPivot );
285 extern void Hop_ConeUnmark_rec( Hop_Obj_t * pObj );
286 extern Hop_Obj_t * Hop_Transfer( Hop_Man_t * pSour, Hop_Man_t * pDest, Hop_Obj_t * pObj, int nVars );
287 extern Hop_Obj_t * Hop_Compose( Hop_Man_t * p, Hop_Obj_t * pRoot, Hop_Obj_t * pFunc, int iVar );
288 extern Hop_Obj_t * Hop_Complement( Hop_Man_t * p, Hop_Obj_t * pRoot, int iVar );
289 extern Hop_Obj_t * Hop_Remap( Hop_Man_t * p, Hop_Obj_t * pRoot, unsigned uSupp, int nVars );
290 extern Hop_Obj_t * Hop_Permute( Hop_Man_t * p, Hop_Obj_t * pRoot, int nRootVars, int * pPermute );
291 /*=== hopMan.c ==========================================================*/
292 extern Hop_Man_t * Hop_ManStart();
293 extern Hop_Man_t * Hop_ManDup( Hop_Man_t * p );
294 extern void Hop_ManStop( Hop_Man_t * p );
295 extern int Hop_ManCleanup( Hop_Man_t * p );
296 extern void Hop_ManPrintStats( Hop_Man_t * p );
297 /*=== hopMem.c ==========================================================*/
298 extern void Hop_ManStartMemory( Hop_Man_t * p );
299 extern void Hop_ManStopMemory( Hop_Man_t * p );
300 /*=== hopObj.c ==========================================================*/
301 extern Hop_Obj_t * Hop_ObjCreatePi( Hop_Man_t * p );
302 extern Hop_Obj_t * Hop_ObjCreatePo( Hop_Man_t * p, Hop_Obj_t * pDriver );
303 extern Hop_Obj_t * Hop_ObjCreate( Hop_Man_t * p, Hop_Obj_t * pGhost );
304 extern void Hop_ObjConnect( Hop_Man_t * p, Hop_Obj_t * pObj, Hop_Obj_t * pFan0, Hop_Obj_t * pFan1 );
305 extern void Hop_ObjDisconnect( Hop_Man_t * p, Hop_Obj_t * pObj );
306 extern void Hop_ObjDelete( Hop_Man_t * p, Hop_Obj_t * pObj );
307 extern void Hop_ObjDelete_rec( Hop_Man_t * p, Hop_Obj_t * pObj );
308 extern Hop_Obj_t * Hop_ObjRepr( Hop_Obj_t * pObj );
309 extern void Hop_ObjCreateChoice( Hop_Obj_t * pOld, Hop_Obj_t * pNew );
310 /*=== hopOper.c =========================================================*/
311 extern Hop_Obj_t * Hop_IthVar( Hop_Man_t * p, int i );
312 extern Hop_Obj_t * Hop_Oper( Hop_Man_t * p, Hop_Obj_t * p0, Hop_Obj_t * p1, Hop_Type_t Type );
313 extern Hop_Obj_t * Hop_And( Hop_Man_t * p, Hop_Obj_t * p0, Hop_Obj_t * p1 );
314 extern Hop_Obj_t * Hop_Or( Hop_Man_t * p, Hop_Obj_t * p0, Hop_Obj_t * p1 );
315 extern Hop_Obj_t * Hop_Exor( Hop_Man_t * p, Hop_Obj_t * p0, Hop_Obj_t * p1 );
316 extern Hop_Obj_t * Hop_Mux( Hop_Man_t * p, Hop_Obj_t * pC, Hop_Obj_t * p1, Hop_Obj_t * p0 );
317 extern Hop_Obj_t * Hop_Maj( Hop_Man_t * p, Hop_Obj_t * pA, Hop_Obj_t * pB, Hop_Obj_t * pC );
318 extern Hop_Obj_t * Hop_Miter( Hop_Man_t * p, Vec_Ptr_t * vPairs );
319 extern Hop_Obj_t * Hop_CreateAnd( Hop_Man_t * p, int nVars );
320 extern Hop_Obj_t * Hop_CreateOr( Hop_Man_t * p, int nVars );
321 extern Hop_Obj_t * Hop_CreateExor( Hop_Man_t * p, int nVars );
322 /*=== hopTable.c ========================================================*/
323 extern Hop_Obj_t * Hop_TableLookup( Hop_Man_t * p, Hop_Obj_t * pGhost );
324 extern void Hop_TableInsert( Hop_Man_t * p, Hop_Obj_t * pObj );
325 extern void Hop_TableDelete( Hop_Man_t * p, Hop_Obj_t * pObj );
326 extern int Hop_TableCountEntries( Hop_Man_t * p );
327 extern void Hop_TableProfile( Hop_Man_t * p );
328 /*=== hopTruth.c ========================================================*/
329 extern unsigned * Hop_ManConvertAigToTruth( Hop_Man_t * p, Hop_Obj_t * pRoot, int nVars, Vec_Int_t * vTruth, int fMsbFirst );
330 extern word Hop_ManComputeTruth6( Hop_Man_t * p, Hop_Obj_t * pObj, int nVars );
331 /*=== hopUtil.c =========================================================*/
332 extern void Hop_ManIncrementTravId( Hop_Man_t * p );
333 extern void Hop_ManCleanData( Hop_Man_t * p );
334 extern void Hop_ObjCleanData_rec( Hop_Obj_t * pObj );
335 extern void Hop_ObjCollectMulti( Hop_Obj_t * pFunc, Vec_Ptr_t * vSuper );
336 extern int Hop_ObjIsMuxType( Hop_Obj_t * pObj );
337 extern int Hop_ObjRecognizeExor( Hop_Obj_t * pObj, Hop_Obj_t ** ppFan0, Hop_Obj_t ** ppFan1 );
338 extern Hop_Obj_t * Hop_ObjRecognizeMux( Hop_Obj_t * pObj, Hop_Obj_t ** ppObjT, Hop_Obj_t ** ppObjE );
339 extern void Hop_ObjPrintEqn( FILE * pFile, Hop_Obj_t * pObj, Vec_Vec_t * vLevels, int Level );
340 extern void Hop_ObjPrintVerilog( FILE * pFile, Hop_Obj_t * pObj, Vec_Vec_t * vLevels, int Level );
341 extern void Hop_ObjPrintVerbose( Hop_Obj_t * pObj, int fHaig );
342 extern void Hop_ManPrintVerbose( Hop_Man_t * p, int fHaig );
343 extern void Hop_ManDumpBlif( Hop_Man_t * p, char * pFileName );
344 
345 
346 
348 
349 
350 
351 #endif
352 
353 ////////////////////////////////////////////////////////////////////////
354 /// END OF FILE ///
355 ////////////////////////////////////////////////////////////////////////
356 
char * memset()
int Hop_ObjFanoutCount(Hop_Obj_t *pObj, Hop_Obj_t *pPivot)
Definition: hopDfs.c:310
Hop_Obj_t * Hop_ObjRepr(Hop_Obj_t *pObj)
Definition: hopObj.c:241
int Hop_ManCheck(Hop_Man_t *p)
DECLARATIONS ///.
Definition: hopCheck.c:45
static Hop_Obj_t * Hop_ObjChild0(Hop_Obj_t *pObj)
Definition: hop.h:184
static Hop_Obj_t * Hop_ObjFanin1(Hop_Obj_t *pObj)
Definition: hop.h:183
static int Hop_ObjIsMarkA(Hop_Obj_t *pObj)
Definition: hop.h:164
Hop_Obj_t * pConst1
Definition: hop.h:90
static Hop_Edge_t Hop_EdgeNot(Hop_Edge_t Edge)
Definition: hop.h:142
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
int Hop_ManCleanup(Hop_Man_t *p)
Definition: hopMan.c:120
void Hop_ManCreateRefs(Hop_Man_t *p)
Definition: hopDfs.c:152
static void Hop_ObjSetMarkA(Hop_Obj_t *pObj)
Definition: hop.h:165
Hop_Man_t * Hop_ManDup(Hop_Man_t *p)
Vec_Ptr_t * Hop_ManDfs(Hop_Man_t *p)
Definition: hopDfs.c:68
Hop_Obj_t * Hop_Or(Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1)
Definition: hopOper.c:171
static int Hop_ObjRefs(Hop_Obj_t *pObj)
Definition: hop.h:176
static void Hop_InfoXorBit(unsigned *p, int i)
Definition: hop.h:122
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
static Hop_Obj_t * Hop_ManConst1(Hop_Man_t *p)
Definition: hop.h:132
Hop_Obj_t * Hop_And(Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1)
Definition: hopOper.c:104
int Hop_DagSize(Hop_Obj_t *pObj)
Definition: hopDfs.c:279
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Hop_TableInsert(Hop_Man_t *p, Hop_Obj_t *pObj)
Definition: hopTable.c:100
static Hop_Edge_t Hop_EdgeNotCond(Hop_Edge_t Edge, int fCond)
Definition: hop.h:143
void Hop_ManDumpBlif(Hop_Man_t *p, char *pFileName)
Definition: hopUtil.c:509
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Hop_ObjPhase(Hop_Obj_t *pObj)
Definition: hop.h:175
void Hop_ManIncrementTravId(Hop_Man_t *p)
DECLARATIONS ///.
Definition: hopUtil.c:45
static int Hop_ObjIsPi(Hop_Obj_t *pObj)
Definition: hop.h:156
Hop_Obj_t * Hop_Maj(Hop_Man_t *p, Hop_Obj_t *pA, Hop_Obj_t *pB, Hop_Obj_t *pC)
Definition: hopOper.c:242
Hop_Obj_t * Hop_ObjCreate(Hop_Man_t *p, Hop_Obj_t *pGhost)
Definition: hopObj.c:97
Hop_Obj_t * Hop_NodeBalanceBuildSuper(Hop_Man_t *p, Vec_Ptr_t *vSuper, Hop_Type_t Type, int fUpdateLevel)
Definition: hopBalance.c:243
static int Hop_ObjIsNode(Hop_Obj_t *pObj)
Definition: hop.h:160
int Id
Definition: hop.h:80
static Hop_Type_t Hop_ObjType(Hop_Obj_t *pObj)
Definition: hop.h:153
void Hop_ManPrintVerbose(Hop_Man_t *p, int fHaig)
Definition: hopUtil.c:482
int iData
Definition: hop.h:69
Hop_Obj_t * Hop_Transfer(Hop_Man_t *pSour, Hop_Man_t *pDest, Hop_Obj_t *pObj, int nVars)
Definition: hopDfs.c:353
void Hop_ObjDelete_rec(Hop_Man_t *p, Hop_Obj_t *pObj)
Definition: hopObj.c:214
void * pData
Definition: hop.h:100
Hop_Obj_t * Hop_Compose(Hop_Man_t *p, Hop_Obj_t *pRoot, Hop_Obj_t *pFunc, int iVar)
Definition: hopDfs.c:415
int Hop_ManCountLevels(Hop_Man_t *p)
Definition: hopDfs.c:116
Definition: hop.h:60
static Hop_Obj_t * Hop_ManGhost(Hop_Man_t *p)
Definition: hop.h:133
static int Hop_ObjChild0CopyI(Hop_Obj_t *pObj)
Definition: hop.h:188
void Hop_ObjConnect(Hop_Man_t *p, Hop_Obj_t *pObj, Hop_Obj_t *pFan0, Hop_Obj_t *pFan1)
Definition: hopObj.c:125
Hop_Obj_t * Hop_CreateExor(Hop_Man_t *p, int nVars)
Definition: hopOper.c:362
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
Vec_Ptr_t * vPages
Definition: hop.h:106
void Hop_ManStartMemory(Hop_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition: hopMem.c:49
Vec_Ptr_t * vPos
Definition: hop.h:88
Hop_Obj_t * pFanin1
Definition: hop.h:74
unsigned int Type
Definition: hop.h:75
word Hop_ManComputeTruth6(Hop_Man_t *p, Hop_Obj_t *pObj, int nVars)
Definition: hopTruth.c:256
static int Hop_ManGetCost(Hop_Man_t *p)
Definition: hop.h:150
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Hop_ManPoNum(Hop_Man_t *p)
Definition: hop.h:146
static int Hop_ObjFaninC1(Hop_Obj_t *pObj)
Definition: hop.h:181
static Hop_Obj_t * Hop_ManObj(Hop_Man_t *p, int i)
Definition: hop.h:136
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Hop_Edge_t Hop_EdgeRegular(Hop_Edge_t Edge)
Definition: hop.h:141
static Hop_Obj_t * Hop_Not(Hop_Obj_t *p)
Definition: hop.h:127
static int Hop_ManObjNum(Hop_Man_t *p)
Definition: hop.h:151
unsigned int nRefs
Definition: hop.h:79
static int Hop_ObjIsAnd(Hop_Obj_t *pObj)
Definition: hop.h:158
Definition: hop.h:65
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static void Hop_ObjSetTravIdCurrent(Hop_Man_t *p, Hop_Obj_t *pObj)
Definition: hop.h:169
Hop_Obj_t * Hop_Oper(Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1, Hop_Type_t Type)
Definition: hopOper.c:83
Hop_Obj_t * Hop_Mux(Hop_Man_t *p, Hop_Obj_t *pC, Hop_Obj_t *p1, Hop_Obj_t *p0)
Definition: hopOper.c:187
void Hop_ConeUnmark_rec(Hop_Obj_t *pObj)
Definition: hopDfs.c:257
static void Hop_ManRecycleMemory(Hop_Man_t *p, Hop_Obj_t *pEntry)
Definition: hop.h:246
void Hop_ObjPrintVerbose(Hop_Obj_t *pObj, int fHaig)
Definition: hopUtil.c:456
Hop_Obj_t * Hop_Exor(Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1)
Definition: hopOper.c:138
static int Hop_BitWordNum(int nBits)
Definition: hop.h:118
unsigned int fMarkA
Definition: hop.h:77
void Hop_ManStop(Hop_Man_t *p)
Definition: hopMan.c:84
Hop_Obj_t * Hop_Remap(Hop_Man_t *p, Hop_Obj_t *pRoot, unsigned uSupp, int nVars)
Definition: hopDfs.c:518
void Hop_ObjCleanData_rec(Hop_Obj_t *pObj)
Definition: hopUtil.c:88
void Hop_ObjCreateChoice(Hop_Obj_t *pOld, Hop_Obj_t *pNew)
Definition: hopObj.c:260
Hop_Type_t
Definition: hop.h:54
int nCreated
Definition: hop.h:94
Hop_Obj_t Ghost
Definition: hop.h:91
static Hop_Obj_t * Hop_ManPi(Hop_Man_t *p, int i)
Definition: hop.h:134
Hop_Obj_t * pListFree
Definition: hop.h:107
void Hop_ObjCollectMulti(Hop_Obj_t *pFunc, Vec_Ptr_t *vSuper)
Definition: hopUtil.c:133
unsigned int fPhase
Definition: hop.h:76
int nTableSize
Definition: hop.h:98
Hop_Obj_t * Hop_Permute(Hop_Man_t *p, Hop_Obj_t *pRoot, int nRootVars, int *pPermute)
Definition: hopDfs.c:563
Definition: hop.h:57
Hop_Obj_t * Hop_CreateAnd(Hop_Man_t *p, int nVars)
Definition: hopOper.c:320
static int Hop_ObjPhaseCompl(Hop_Obj_t *pObj)
Definition: hop.h:192
int PioNum
Definition: hop.h:72
static Hop_Obj_t * Hop_ObjChild1Copy(Hop_Obj_t *pObj)
Definition: hop.h:187
static int Hop_ObjTravId(Hop_Obj_t *pObj)
Definition: hop.h:174
static int Hop_Base10Log(unsigned n)
Definition: hop.h:124
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static int Hop_ManAndNum(Hop_Man_t *p)
Definition: hop.h:147
static Hop_Obj_t * Hop_ManPo(Hop_Man_t *p, int i)
Definition: hop.h:135
static int Hop_ObjIsNone(Hop_Obj_t *pObj)
Definition: hop.h:154
static Hop_Obj_t * Hop_ObjChild1(Hop_Obj_t *pObj)
Definition: hop.h:185
int Hop_Edge_t
Definition: hop.h:51
Hop_Obj_t * pFanin0
Definition: hop.h:73
static Hop_Obj_t * Hop_ManFetchMemory(Hop_Man_t *p)
Definition: hop.h:230
Hop_Man_t * Hop_ManStart()
DECLARATIONS ///.
Definition: hopMan.c:45
static int Hop_IsComplement(Hop_Obj_t *p)
Definition: hop.h:129
static Hop_Obj_t * Hop_ObjChild0Copy(Hop_Obj_t *pObj)
Definition: hop.h:186
void Hop_ObjDelete(Hop_Man_t *p, Hop_Obj_t *pObj)
Definition: hopObj.c:186
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
Definition: abc_global.h:105
Hop_Obj_t * pNext
Definition: hop.h:71
static int Hop_ObjIsPo(Hop_Obj_t *pObj)
Definition: hop.h:157
static void Hop_ObjSetTravId(Hop_Obj_t *pObj, int TravId)
Definition: hop.h:168
static int Hop_ObjIsHash(Hop_Obj_t *pObj)
Definition: hop.h:162
static void Hop_ObjClearMarkA(Hop_Obj_t *pObj)
Definition: hop.h:166
void * pData
Definition: hop.h:68
Definition: hop.h:58
static int Hop_ObjIsExor(Hop_Obj_t *pObj)
Definition: hop.h:159
static Hop_Obj_t * Hop_ObjFanin0(Hop_Obj_t *pObj)
Definition: hop.h:182
void Hop_TableProfile(Hop_Man_t *p)
Definition: hopTable.c:212
#define ABC_NAMESPACE_HEADER_END
Definition: abc_global.h:106
static int Hop_ObjIsConst1(Hop_Obj_t *pObj)
Definition: hop.h:155
static void Hop_ObjClearRef(Hop_Obj_t *pObj)
Definition: hop.h:179
static int Hop_ObjIsTravIdPrevious(Hop_Man_t *p, Hop_Obj_t *pObj)
Definition: hop.h:172
int nTravIds
Definition: hop.h:101
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
Definition: hop.h:84
static int Hop_ObjLevel(Hop_Obj_t *pObj)
Definition: hop.h:190
Vec_Ptr_t * vObjs
Definition: hop.h:89
abctime time1
Definition: hop.h:109
static int Hop_ObjIsTravIdCurrent(Hop_Man_t *p, Hop_Obj_t *pObj)
Definition: hop.h:171
Vec_Ptr_t * vPis
Definition: hop.h:87
static int Hop_TruthWordNum(int nVars)
Definition: hop.h:119
static int Hop_ManExorNum(Hop_Man_t *p)
Definition: hop.h:148
Hop_Obj_t * Hop_CreateOr(Hop_Man_t *p, int nVars)
Definition: hopOper.c:341
static int Hop_ObjChild1CopyI(Hop_Obj_t *pObj)
Definition: hop.h:189
static int Hop_ObjFaninC0(Hop_Obj_t *pObj)
Definition: hop.h:180
static int Hop_ObjWhatFanin(Hop_Obj_t *pObj, Hop_Obj_t *pFanin)
Definition: hop.h:194
static int Hop_ObjIsTerm(Hop_Obj_t *pObj)
Definition: hop.h:161
static Hop_Obj_t * Hop_NotCond(Hop_Obj_t *p, int c)
Definition: hop.h:128
Hop_Obj_t * Hop_ObjRecognizeMux(Hop_Obj_t *pObj, Hop_Obj_t **ppObjT, Hop_Obj_t **ppObjE)
Definition: hopUtil.c:231
void Hop_ObjDisconnect(Hop_Man_t *p, Hop_Obj_t *pObj)
Definition: hopObj.c:159
static void Hop_ObjRef(Hop_Obj_t *pObj)
Definition: hop.h:177
static void Hop_ObjDeref(Hop_Obj_t *pObj)
Definition: hop.h:178
void Hop_ManCleanData(Hop_Man_t *p)
Definition: hopUtil.c:63
Definition: hop.h:56
Definition: hop.h:59
static int Hop_InfoHasBit(unsigned *p, int i)
Definition: hop.h:120
abctime time2
Definition: hop.h:110
unsigned * Hop_ManConvertAigToTruth(Hop_Man_t *p, Hop_Obj_t *pRoot, int nVars, Vec_Int_t *vTruth, int fMsbFirst)
Definition: hopTruth.c:143
int nDeleted
Definition: hop.h:95
void Hop_TableDelete(Hop_Man_t *p, Hop_Obj_t *pObj)
Definition: hopTable.c:123
#define assert(ex)
Definition: util_old.h:213
int Hop_ObjIsMuxType(Hop_Obj_t *pObj)
Definition: hopUtil.c:151
Definition: hop.h:61
static void Hop_InfoSetBit(unsigned *p, int i)
Definition: hop.h:121
void Hop_ManAddMemory(Hop_Man_t *p)
MACRO DEFINITIONS ///.
Definition: hopMem.c:89
static Hop_Obj_t * Hop_ManConst0(Hop_Man_t *p)
Definition: hop.h:131
static int Hop_EdgeId(Hop_Edge_t Edge)
Definition: hop.h:139
Hop_Obj_t * Hop_ObjCreatePo(Hop_Man_t *p, Hop_Obj_t *pDriver)
Definition: hopObj.c:67
Hop_Obj_t * Hop_Miter(Hop_Man_t *p, Vec_Ptr_t *vPairs)
Definition: hopOper.c:297
int fRefCount
Definition: hop.h:102
static int Hop_ObjFanoutC(Hop_Obj_t *pObj, Hop_Obj_t *pFanout)
Definition: hop.h:200
static Hop_Obj_t * Hop_Regular(Hop_Obj_t *p)
Definition: hop.h:126
Vec_Ptr_t * Hop_ManDfsNode(Hop_Man_t *p, Hop_Obj_t *pNode)
Definition: hopDfs.c:92
Hop_Man_t * Hop_ManBalance(Hop_Man_t *p, int fUpdateLevel)
FUNCTION DECLARATIONS ///.
Definition: hopBalance.c:51
int Hop_ObjRecognizeExor(Hop_Obj_t *pObj, Hop_Obj_t **ppFan0, Hop_Obj_t **ppFan1)
Definition: hopUtil.c:187
ABC_INT64_T abctime
Definition: abc_global.h:278
static Hop_Obj_t * Hop_ObjCreateGhost(Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1, Hop_Type_t Type)
Definition: hop.h:208
static int Hop_ObjLevelNew(Hop_Obj_t *pObj)
Definition: hop.h:191
Hop_Obj_t * Hop_ObjCreatePi(Hop_Man_t *p)
DECLARATIONS ///.
Definition: hopObj.c:45
int fCatchExor
Definition: hop.h:103
int nObjs[AIG_VOID]
Definition: hop.h:93
static int Hop_EdgeIsComplement(Hop_Edge_t Edge)
Definition: hop.h:140
unsigned int fMarkB
Definition: hop.h:78
static int Hop_ManNodeNum(Hop_Man_t *p)
Definition: hop.h:149
int Hop_TableCountEntries(Hop_Man_t *p)
Definition: hopTable.c:145
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Definition: hop.h:55
Hop_Obj_t ** pTable
Definition: hop.h:97
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: hopOper.c:63
static Hop_Edge_t Hop_EdgeCreate(int Id, int fCompl)
Definition: hop.h:138
Hop_Obj_t * Hop_TableLookup(Hop_Man_t *p, Hop_Obj_t *pGhost)
FUNCTION DEFINITIONS ///.
Definition: hopTable.c:71
static void Hop_ObjClean(Hop_Obj_t *pObj)
Definition: hop.h:193
static int Hop_Base2Log(unsigned n)
Definition: hop.h:123
void Hop_ManPrintStats(Hop_Man_t *p)
Definition: hopMan.c:150
Hop_Obj_t * Hop_Complement(Hop_Man_t *p, Hop_Obj_t *pRoot, int iVar)
Definition: hopDfs.c:469
void Hop_ObjPrintEqn(FILE *pFile, Hop_Obj_t *pObj, Vec_Vec_t *vLevels, int Level)
Definition: hopUtil.c:322
Vec_Ptr_t * vChunks
Definition: hop.h:105
void Hop_ObjPrintVerilog(FILE *pFile, Hop_Obj_t *pObj, Vec_Vec_t *vLevels, int Level)
Definition: hopUtil.c:369
static int Hop_ManPiNum(Hop_Man_t *p)
Definition: hop.h:145
void Hop_ManStopMemory(Hop_Man_t *p)
Definition: hopMem.c:66
static void Hop_ObjSetTravIdPrevious(Hop_Man_t *p, Hop_Obj_t *pObj)
Definition: hop.h:170