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
42 ABC_NAMESPACE_HEADER_START
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
109 abctime time1;
110 abctime time2;
111 };
112
113 ////////////////////////////////////////////////////////////////////////
114 /// MACRO DEFINITIONS ///
115 ////////////////////////////////////////////////////////////////////////
116 extern void Hop_ManAddMemory( Hop_Man_t * p );
117
Hop_BitWordNum(int nBits)118 static inline int Hop_BitWordNum( int nBits ) { return (nBits>>5) + ((nBits&31) > 0); }
Hop_TruthWordNum(int nVars)119 static inline int Hop_TruthWordNum( int nVars ) { return nVars <= 5 ? 1 : (1 << (nVars - 5)); }
Hop_InfoHasBit(unsigned * p,int i)120 static inline int Hop_InfoHasBit( unsigned * p, int i ) { return (p[(i)>>5] & (1<<((i) & 31))) > 0; }
Hop_InfoSetBit(unsigned * p,int i)121 static inline void Hop_InfoSetBit( unsigned * p, int i ) { p[(i)>>5] |= (1<<((i) & 31)); }
Hop_InfoXorBit(unsigned * p,int i)122 static inline void Hop_InfoXorBit( unsigned * p, int i ) { p[(i)>>5] ^= (1<<((i) & 31)); }
Hop_Base2Log(unsigned n)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; }
Hop_Base10Log(unsigned n)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
Hop_Regular(Hop_Obj_t * p)126 static inline Hop_Obj_t * Hop_Regular( Hop_Obj_t * p ) { return (Hop_Obj_t *)((ABC_PTRUINT_T)(p) & ~01); }
Hop_Not(Hop_Obj_t * p)127 static inline Hop_Obj_t * Hop_Not( Hop_Obj_t * p ) { return (Hop_Obj_t *)((ABC_PTRUINT_T)(p) ^ 01); }
Hop_NotCond(Hop_Obj_t * p,int c)128 static inline Hop_Obj_t * Hop_NotCond( Hop_Obj_t * p, int c ) { return (Hop_Obj_t *)((ABC_PTRUINT_T)(p) ^ (c)); }
Hop_IsComplement(Hop_Obj_t * p)129 static inline int Hop_IsComplement( Hop_Obj_t * p ) { return (int)((ABC_PTRUINT_T)(p) & 01); }
130
Hop_ManConst0(Hop_Man_t * p)131 static inline Hop_Obj_t * Hop_ManConst0( Hop_Man_t * p ) { return Hop_Not(p->pConst1); }
Hop_ManConst1(Hop_Man_t * p)132 static inline Hop_Obj_t * Hop_ManConst1( Hop_Man_t * p ) { return p->pConst1; }
Hop_ManGhost(Hop_Man_t * p)133 static inline Hop_Obj_t * Hop_ManGhost( Hop_Man_t * p ) { return &p->Ghost; }
Hop_ManPi(Hop_Man_t * p,int i)134 static inline Hop_Obj_t * Hop_ManPi( Hop_Man_t * p, int i ) { return (Hop_Obj_t *)Vec_PtrEntry(p->vPis, i); }
Hop_ManPo(Hop_Man_t * p,int i)135 static inline Hop_Obj_t * Hop_ManPo( Hop_Man_t * p, int i ) { return (Hop_Obj_t *)Vec_PtrEntry(p->vPos, i); }
Hop_ManObj(Hop_Man_t * p,int 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
Hop_EdgeCreate(int Id,int fCompl)138 static inline Hop_Edge_t Hop_EdgeCreate( int Id, int fCompl ) { return (Id << 1) | fCompl; }
Hop_EdgeId(Hop_Edge_t Edge)139 static inline int Hop_EdgeId( Hop_Edge_t Edge ) { return Edge >> 1; }
Hop_EdgeIsComplement(Hop_Edge_t Edge)140 static inline int Hop_EdgeIsComplement( Hop_Edge_t Edge ) { return Edge & 1; }
Hop_EdgeRegular(Hop_Edge_t Edge)141 static inline Hop_Edge_t Hop_EdgeRegular( Hop_Edge_t Edge ) { return (Edge >> 1) << 1; }
Hop_EdgeNot(Hop_Edge_t Edge)142 static inline Hop_Edge_t Hop_EdgeNot( Hop_Edge_t Edge ) { return Edge ^ 1; }
Hop_EdgeNotCond(Hop_Edge_t Edge,int fCond)143 static inline Hop_Edge_t Hop_EdgeNotCond( Hop_Edge_t Edge, int fCond ) { return Edge ^ fCond; }
144
Hop_ManPiNum(Hop_Man_t * p)145 static inline int Hop_ManPiNum( Hop_Man_t * p ) { return p->nObjs[AIG_PI]; }
Hop_ManPoNum(Hop_Man_t * p)146 static inline int Hop_ManPoNum( Hop_Man_t * p ) { return p->nObjs[AIG_PO]; }
Hop_ManAndNum(Hop_Man_t * p)147 static inline int Hop_ManAndNum( Hop_Man_t * p ) { return p->nObjs[AIG_AND]; }
Hop_ManExorNum(Hop_Man_t * p)148 static inline int Hop_ManExorNum( Hop_Man_t * p ) { return p->nObjs[AIG_EXOR]; }
Hop_ManNodeNum(Hop_Man_t * p)149 static inline int Hop_ManNodeNum( Hop_Man_t * p ) { return p->nObjs[AIG_AND]+p->nObjs[AIG_EXOR];}
Hop_ManGetCost(Hop_Man_t * p)150 static inline int Hop_ManGetCost( Hop_Man_t * p ) { return p->nObjs[AIG_AND]+3*p->nObjs[AIG_EXOR]; }
Hop_ManObjNum(Hop_Man_t * p)151 static inline int Hop_ManObjNum( Hop_Man_t * p ) { return p->nCreated - p->nDeleted; }
152
Hop_ObjType(Hop_Obj_t * pObj)153 static inline Hop_Type_t Hop_ObjType( Hop_Obj_t * pObj ) { return (Hop_Type_t)pObj->Type; }
Hop_ObjIsNone(Hop_Obj_t * pObj)154 static inline int Hop_ObjIsNone( Hop_Obj_t * pObj ) { return pObj->Type == AIG_NONE; }
Hop_ObjIsConst1(Hop_Obj_t * pObj)155 static inline int Hop_ObjIsConst1( Hop_Obj_t * pObj ) { assert(!Hop_IsComplement(pObj)); return pObj->Type == AIG_CONST1; }
Hop_ObjIsPi(Hop_Obj_t * pObj)156 static inline int Hop_ObjIsPi( Hop_Obj_t * pObj ) { return pObj->Type == AIG_PI; }
Hop_ObjIsPo(Hop_Obj_t * pObj)157 static inline int Hop_ObjIsPo( Hop_Obj_t * pObj ) { return pObj->Type == AIG_PO; }
Hop_ObjIsAnd(Hop_Obj_t * pObj)158 static inline int Hop_ObjIsAnd( Hop_Obj_t * pObj ) { return pObj->Type == AIG_AND; }
Hop_ObjIsExor(Hop_Obj_t * pObj)159 static inline int Hop_ObjIsExor( Hop_Obj_t * pObj ) { return pObj->Type == AIG_EXOR; }
Hop_ObjIsNode(Hop_Obj_t * pObj)160 static inline int Hop_ObjIsNode( Hop_Obj_t * pObj ) { return pObj->Type == AIG_AND || pObj->Type == AIG_EXOR; }
Hop_ObjIsTerm(Hop_Obj_t * pObj)161 static inline int Hop_ObjIsTerm( Hop_Obj_t * pObj ) { return pObj->Type == AIG_PI || pObj->Type == AIG_PO || pObj->Type == AIG_CONST1; }
Hop_ObjIsHash(Hop_Obj_t * pObj)162 static inline int Hop_ObjIsHash( Hop_Obj_t * pObj ) { return pObj->Type == AIG_AND || pObj->Type == AIG_EXOR; }
163
Hop_ObjIsMarkA(Hop_Obj_t * pObj)164 static inline int Hop_ObjIsMarkA( Hop_Obj_t * pObj ) { return pObj->fMarkA; }
Hop_ObjSetMarkA(Hop_Obj_t * pObj)165 static inline void Hop_ObjSetMarkA( Hop_Obj_t * pObj ) { pObj->fMarkA = 1; }
Hop_ObjClearMarkA(Hop_Obj_t * pObj)166 static inline void Hop_ObjClearMarkA( Hop_Obj_t * pObj ) { pObj->fMarkA = 0; }
167
Hop_ObjSetTravId(Hop_Obj_t * pObj,int TravId)168 static inline void Hop_ObjSetTravId( Hop_Obj_t * pObj, int TravId ) { pObj->pData = (void *)(ABC_PTRINT_T)TravId; }
Hop_ObjSetTravIdCurrent(Hop_Man_t * p,Hop_Obj_t * pObj)169 static inline void Hop_ObjSetTravIdCurrent( Hop_Man_t * p, Hop_Obj_t * pObj ) { pObj->pData = (void *)(ABC_PTRINT_T)p->nTravIds; }
Hop_ObjSetTravIdPrevious(Hop_Man_t * p,Hop_Obj_t * pObj)170 static inline void Hop_ObjSetTravIdPrevious( Hop_Man_t * p, Hop_Obj_t * pObj ) { pObj->pData = (void *)(ABC_PTRINT_T)(p->nTravIds - 1); }
Hop_ObjIsTravIdCurrent(Hop_Man_t * p,Hop_Obj_t * pObj)171 static inline int Hop_ObjIsTravIdCurrent( Hop_Man_t * p, Hop_Obj_t * pObj ) { return (int)((int)(ABC_PTRINT_T)pObj->pData == p->nTravIds); }
Hop_ObjIsTravIdPrevious(Hop_Man_t * p,Hop_Obj_t * pObj)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
Hop_ObjTravId(Hop_Obj_t * pObj)174 static inline int Hop_ObjTravId( Hop_Obj_t * pObj ) { return (int)(ABC_PTRINT_T)pObj->pData; }
Hop_ObjPhase(Hop_Obj_t * pObj)175 static inline int Hop_ObjPhase( Hop_Obj_t * pObj ) { return pObj->fPhase; }
Hop_ObjRefs(Hop_Obj_t * pObj)176 static inline int Hop_ObjRefs( Hop_Obj_t * pObj ) { return pObj->nRefs; }
Hop_ObjRef(Hop_Obj_t * pObj)177 static inline void Hop_ObjRef( Hop_Obj_t * pObj ) { pObj->nRefs++; }
Hop_ObjDeref(Hop_Obj_t * pObj)178 static inline void Hop_ObjDeref( Hop_Obj_t * pObj ) { assert( pObj->nRefs > 0 ); pObj->nRefs--; }
Hop_ObjClearRef(Hop_Obj_t * pObj)179 static inline void Hop_ObjClearRef( Hop_Obj_t * pObj ) { pObj->nRefs = 0; }
Hop_ObjFaninC0(Hop_Obj_t * pObj)180 static inline int Hop_ObjFaninC0( Hop_Obj_t * pObj ) { return Hop_IsComplement(pObj->pFanin0); }
Hop_ObjFaninC1(Hop_Obj_t * pObj)181 static inline int Hop_ObjFaninC1( Hop_Obj_t * pObj ) { return Hop_IsComplement(pObj->pFanin1); }
Hop_ObjFanin0(Hop_Obj_t * pObj)182 static inline Hop_Obj_t * Hop_ObjFanin0( Hop_Obj_t * pObj ) { return Hop_Regular(pObj->pFanin0); }
Hop_ObjFanin1(Hop_Obj_t * pObj)183 static inline Hop_Obj_t * Hop_ObjFanin1( Hop_Obj_t * pObj ) { return Hop_Regular(pObj->pFanin1); }
Hop_ObjChild0(Hop_Obj_t * pObj)184 static inline Hop_Obj_t * Hop_ObjChild0( Hop_Obj_t * pObj ) { return pObj->pFanin0; }
Hop_ObjChild1(Hop_Obj_t * pObj)185 static inline Hop_Obj_t * Hop_ObjChild1( Hop_Obj_t * pObj ) { return pObj->pFanin1; }
Hop_ObjChild0Copy(Hop_Obj_t * pObj)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; }
Hop_ObjChild1Copy(Hop_Obj_t * pObj)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; }
Hop_ObjChild0CopyI(Hop_Obj_t * pObj)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; }
Hop_ObjChild1CopyI(Hop_Obj_t * pObj)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; }
Hop_ObjLevel(Hop_Obj_t * pObj)190 static inline int Hop_ObjLevel( Hop_Obj_t * pObj ) { return pObj->nRefs; }
Hop_ObjLevelNew(Hop_Obj_t * pObj)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); }
Hop_ObjPhaseCompl(Hop_Obj_t * pObj)192 static inline int Hop_ObjPhaseCompl( Hop_Obj_t * pObj ) { return Hop_IsComplement(pObj)? !Hop_Regular(pObj)->fPhase : pObj->fPhase; }
Hop_ObjClean(Hop_Obj_t * pObj)193 static inline void Hop_ObjClean( Hop_Obj_t * pObj ) { memset( pObj, 0, sizeof(Hop_Obj_t) ); }
Hop_ObjWhatFanin(Hop_Obj_t * pObj,Hop_Obj_t * pFanin)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 }
Hop_ObjFanoutC(Hop_Obj_t * pObj,Hop_Obj_t * pFanout)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
Hop_ObjCreateGhost(Hop_Man_t * p,Hop_Obj_t * p0,Hop_Obj_t * p1,Hop_Type_t Type)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
Hop_ManFetchMemory(Hop_Man_t * p)230 static inline Hop_Obj_t * Hop_ManFetchMemory( Hop_Man_t * p )
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 }
Hop_ManRecycleMemory(Hop_Man_t * p,Hop_Obj_t * pEntry)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, int fOnlyAnds );
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
347 ABC_NAMESPACE_HEADER_END
348
349
350
351 #endif
352
353 ////////////////////////////////////////////////////////////////////////
354 /// END OF FILE ///
355 ////////////////////////////////////////////////////////////////////////
356
357