ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
hop.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "misc/vec/vec.h"
Include dependency graph for hop.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Hop_Obj_t_
 
struct  Hop_Man_t_
 

Macros

#define Hop_ManForEachPi(p, pObj, i)
 ITERATORS ///.
 
#define Hop_ManForEachPo(p, pObj, i)
 
#define Hop_ManForEachNode(p, pObj, i)
 

Typedefs

typedef typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
 INCLUDES ///.
 
typedef struct Hop_Obj_t_ Hop_Obj_t
 
typedef int Hop_Edge_t
 

Enumerations

enum  Hop_Type_t {
  AIG_NONE , AIG_CONST1 , AIG_PI , AIG_PO ,
  AIG_AND , AIG_EXOR , AIG_VOID
}
 

Functions

void Hop_ManAddMemory (Hop_Man_t *p)
 MACRO DEFINITIONS ///.
 
Hop_Man_tHop_ManBalance (Hop_Man_t *p, int fUpdateLevel)
 FUNCTION DECLARATIONS ///.
 
Hop_Obj_tHop_NodeBalanceBuildSuper (Hop_Man_t *p, Vec_Ptr_t *vSuper, Hop_Type_t Type, int fUpdateLevel)
 
int Hop_ManCheck (Hop_Man_t *p)
 DECLARATIONS ///.
 
Vec_Ptr_tHop_ManDfs (Hop_Man_t *p)
 
Vec_Ptr_tHop_ManDfsNode (Hop_Man_t *p, Hop_Obj_t *pNode)
 
int Hop_ManCountLevels (Hop_Man_t *p)
 
void Hop_ManCreateRefs (Hop_Man_t *p)
 
int Hop_DagSize (Hop_Obj_t *pObj)
 
int Hop_ObjFanoutCount (Hop_Obj_t *pObj, Hop_Obj_t *pPivot)
 
void Hop_ConeUnmark_rec (Hop_Obj_t *pObj)
 
Hop_Obj_tHop_Transfer (Hop_Man_t *pSour, Hop_Man_t *pDest, Hop_Obj_t *pObj, int nVars)
 
Hop_Obj_tHop_Compose (Hop_Man_t *p, Hop_Obj_t *pRoot, Hop_Obj_t *pFunc, int iVar)
 
Hop_Obj_tHop_Complement (Hop_Man_t *p, Hop_Obj_t *pRoot, int iVar)
 
Hop_Obj_tHop_Remap (Hop_Man_t *p, Hop_Obj_t *pRoot, unsigned uSupp, int nVars)
 
Hop_Obj_tHop_Permute (Hop_Man_t *p, Hop_Obj_t *pRoot, int nRootVars, int *pPermute)
 
Hop_Man_tHop_ManStart ()
 DECLARATIONS ///.
 
Hop_Man_tHop_ManDup (Hop_Man_t *p)
 
void Hop_ManStop (Hop_Man_t *p)
 
int Hop_ManCleanup (Hop_Man_t *p)
 
void Hop_ManPrintStats (Hop_Man_t *p)
 
void Hop_ManStartMemory (Hop_Man_t *p)
 FUNCTION DEFINITIONS ///.
 
void Hop_ManStopMemory (Hop_Man_t *p)
 
Hop_Obj_tHop_ObjCreatePi (Hop_Man_t *p)
 DECLARATIONS ///.
 
Hop_Obj_tHop_ObjCreatePo (Hop_Man_t *p, Hop_Obj_t *pDriver)
 
Hop_Obj_tHop_ObjCreate (Hop_Man_t *p, Hop_Obj_t *pGhost)
 
void Hop_ObjConnect (Hop_Man_t *p, Hop_Obj_t *pObj, Hop_Obj_t *pFan0, Hop_Obj_t *pFan1)
 
void Hop_ObjDisconnect (Hop_Man_t *p, Hop_Obj_t *pObj)
 
void Hop_ObjDelete (Hop_Man_t *p, Hop_Obj_t *pObj)
 
void Hop_ObjDelete_rec (Hop_Man_t *p, Hop_Obj_t *pObj)
 
Hop_Obj_tHop_ObjRepr (Hop_Obj_t *pObj)
 
void Hop_ObjCreateChoice (Hop_Obj_t *pOld, Hop_Obj_t *pNew)
 
Hop_Obj_tHop_IthVar (Hop_Man_t *p, int i)
 FUNCTION DEFINITIONS ///.
 
Hop_Obj_tHop_Oper (Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1, Hop_Type_t Type)
 
Hop_Obj_tHop_And (Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1)
 
Hop_Obj_tHop_Or (Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1)
 
Hop_Obj_tHop_Exor (Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1)
 
Hop_Obj_tHop_Mux (Hop_Man_t *p, Hop_Obj_t *pC, Hop_Obj_t *p1, Hop_Obj_t *p0)
 
Hop_Obj_tHop_Maj (Hop_Man_t *p, Hop_Obj_t *pA, Hop_Obj_t *pB, Hop_Obj_t *pC)
 
Hop_Obj_tHop_Miter (Hop_Man_t *p, Vec_Ptr_t *vPairs)
 
Hop_Obj_tHop_CreateAnd (Hop_Man_t *p, int nVars)
 
Hop_Obj_tHop_CreateOr (Hop_Man_t *p, int nVars)
 
Hop_Obj_tHop_CreateExor (Hop_Man_t *p, int nVars)
 
Hop_Obj_tHop_TableLookup (Hop_Man_t *p, Hop_Obj_t *pGhost)
 FUNCTION DEFINITIONS ///.
 
void Hop_TableInsert (Hop_Man_t *p, Hop_Obj_t *pObj)
 
void Hop_TableDelete (Hop_Man_t *p, Hop_Obj_t *pObj)
 
int Hop_TableCountEntries (Hop_Man_t *p)
 
void Hop_TableProfile (Hop_Man_t *p)
 
unsigned * Hop_ManConvertAigToTruth (Hop_Man_t *p, Hop_Obj_t *pRoot, int nVars, Vec_Int_t *vTruth, int fMsbFirst)
 
word Hop_ManComputeTruth6 (Hop_Man_t *p, Hop_Obj_t *pObj, int nVars)
 
void Hop_ManIncrementTravId (Hop_Man_t *p)
 DECLARATIONS ///.
 
void Hop_ManCleanData (Hop_Man_t *p)
 
void Hop_ObjCleanData_rec (Hop_Obj_t *pObj)
 
void Hop_ObjCollectMulti (Hop_Obj_t *pFunc, Vec_Ptr_t *vSuper)
 
int Hop_ObjIsMuxType (Hop_Obj_t *pObj)
 
int Hop_ObjRecognizeExor (Hop_Obj_t *pObj, Hop_Obj_t **ppFan0, Hop_Obj_t **ppFan1)
 
Hop_Obj_tHop_ObjRecognizeMux (Hop_Obj_t *pObj, Hop_Obj_t **ppObjT, Hop_Obj_t **ppObjE)
 
void Hop_ObjPrintEqn (FILE *pFile, Hop_Obj_t *pObj, Vec_Vec_t *vLevels, int Level)
 
void Hop_ObjPrintVerilog (FILE *pFile, Hop_Obj_t *pObj, Vec_Vec_t *vLevels, int Level, int fOnlyAnds)
 
void Hop_ObjPrintVerbose (Hop_Obj_t *pObj, int fHaig)
 
void Hop_ManPrintVerbose (Hop_Man_t *p, int fHaig)
 
void Hop_ManDumpBlif (Hop_Man_t *p, char *pFileName)
 

Macro Definition Documentation

◆ Hop_ManForEachNode

#define Hop_ManForEachNode ( p,
pObj,
i )
Value:
for ( i = 0; i < p->nTableSize; i++ ) \
if ( ((pObj) = p->pTable[i]) == NULL ) {} else
Cube * p
Definition exorList.c:222

Definition at line 265 of file hop.h.

265#define Hop_ManForEachNode( p, pObj, i ) \
266 for ( i = 0; i < p->nTableSize; i++ ) \
267 if ( ((pObj) = p->pTable[i]) == NULL ) {} else

◆ Hop_ManForEachPi

#define Hop_ManForEachPi ( p,
pObj,
i )
Value:
Vec_PtrForEachEntry( Hop_Obj_t *, p->vPis, pObj, i )
struct Hop_Obj_t_ Hop_Obj_t
Definition hop.h:50
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55

ITERATORS ///.

Definition at line 259 of file hop.h.

259#define Hop_ManForEachPi( p, pObj, i ) \
260 Vec_PtrForEachEntry( Hop_Obj_t *, p->vPis, pObj, i )

◆ Hop_ManForEachPo

#define Hop_ManForEachPo ( p,
pObj,
i )
Value:
Vec_PtrForEachEntry( Hop_Obj_t *, p->vPos, pObj, i )

Definition at line 262 of file hop.h.

262#define Hop_ManForEachPo( p, pObj, i ) \
263 Vec_PtrForEachEntry( Hop_Obj_t *, p->vPos, pObj, i )

Typedef Documentation

◆ Hop_Edge_t

typedef int Hop_Edge_t

Definition at line 51 of file hop.h.

◆ Hop_Man_t

typedef typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t

INCLUDES ///.

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

FileName [hop.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Minimalistic And-Inverter Graph package.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - May 11, 2006.]

Revision [

Id
hop.h,v 1.00 2006/05/11 00:00:00 alanmi Exp

] PARAMETERS /// BASIC TYPES ///

Definition at line 49 of file hop.h.

◆ Hop_Obj_t

typedef struct Hop_Obj_t_ Hop_Obj_t

Definition at line 50 of file hop.h.

Enumeration Type Documentation

◆ Hop_Type_t

enum Hop_Type_t
Enumerator
AIG_NONE 
AIG_CONST1 
AIG_PI 
AIG_PO 
AIG_AND 
AIG_EXOR 
AIG_VOID 

Definition at line 54 of file hop.h.

54 {
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
Hop_Type_t
Definition hop.h:54
@ AIG_VOID
Definition hop.h:61
@ AIG_CONST1
Definition hop.h:56
@ AIG_EXOR
Definition hop.h:60
@ AIG_NONE
Definition hop.h:55
@ AIG_PI
Definition hop.h:57
@ AIG_PO
Definition hop.h:58
@ AIG_AND
Definition hop.h:59

Function Documentation

◆ Hop_And()

Hop_Obj_t * Hop_And ( Hop_Man_t * p,
Hop_Obj_t * p0,
Hop_Obj_t * p1 )
extern

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

Synopsis [Performs canonicization step.]

Description [The argument nodes can be complemented.]

SideEffects []

SeeAlso []

Definition at line 104 of file hopOper.c.

105{
106 Hop_Obj_t * pGhost, * pResult;
107// Hop_Obj_t * pFan0, * pFan1;
108 // check trivial cases
109 if ( p0 == p1 )
110 return p0;
111 if ( p0 == Hop_Not(p1) )
112 return Hop_Not(p->pConst1);
113 if ( Hop_Regular(p0) == p->pConst1 )
114 return p0 == p->pConst1 ? p1 : Hop_Not(p->pConst1);
115 if ( Hop_Regular(p1) == p->pConst1 )
116 return p1 == p->pConst1 ? p0 : Hop_Not(p->pConst1);
117 // check if it can be an EXOR gate
118// if ( Hop_ObjIsExorType( p0, p1, &pFan0, &pFan1 ) )
119// return Hop_Exor( p, pFan0, pFan1 );
120 // check the table
121 pGhost = Hop_ObjCreateGhost( p, p0, p1, AIG_AND );
122 if ( (pResult = Hop_TableLookup( p, pGhost )) )
123 return pResult;
124 return Hop_ObjCreate( p, pGhost );
125}
Hop_Obj_t * Hop_ObjCreate(Hop_Man_t *p, Hop_Obj_t *pGhost)
Definition hopObj.c:97
Hop_Obj_t * Hop_TableLookup(Hop_Man_t *p, Hop_Obj_t *pGhost)
FUNCTION DEFINITIONS ///.
Definition hopTable.c:71
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_Complement()

Hop_Obj_t * Hop_Complement ( Hop_Man_t * p,
Hop_Obj_t * pRoot,
int iVar )
extern

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

Synopsis [Complements the AIG (pRoot) with the function (pFunc) using PI var (iVar).]

Description []

SideEffects []

SeeAlso []

Definition at line 469 of file hopDfs.c.

470{
471 // quit if the PI variable is not defined
472 if ( iVar >= Hop_ManPiNum(p) )
473 {
474 printf( "Hop_Complement(): The PI variable %d is not defined.\n", iVar );
475 return NULL;
476 }
477 // recursively perform composition
478 Hop_Complement_rec( p, Hop_Regular(pRoot), Hop_ManPi(p, iVar) );
479 // clear the markings
480 Hop_ConeUnmark_rec( Hop_Regular(pRoot) );
481 return Hop_NotCond( (Hop_Obj_t *)Hop_Regular(pRoot)->pData, Hop_IsComplement(pRoot) );
482}
void Hop_ConeUnmark_rec(Hop_Obj_t *pObj)
Definition hopDfs.c:257
void Hop_Complement_rec(Hop_Man_t *p, Hop_Obj_t *pObj, Hop_Obj_t *pVar)
Definition hopDfs.c:441
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_Compose()

Hop_Obj_t * Hop_Compose ( Hop_Man_t * p,
Hop_Obj_t * pRoot,
Hop_Obj_t * pFunc,
int iVar )
extern

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

Synopsis [Composes the AIG (pRoot) with the function (pFunc) using PI var (iVar).]

Description []

SideEffects []

SeeAlso []

Definition at line 415 of file hopDfs.c.

416{
417 // quit if the PI variable is not defined
418 if ( iVar >= Hop_ManPiNum(p) )
419 {
420 printf( "Hop_Compose(): The PI variable %d is not defined.\n", iVar );
421 return NULL;
422 }
423 // recursively perform composition
424 Hop_Compose_rec( p, Hop_Regular(pRoot), pFunc, Hop_ManPi(p, iVar) );
425 // clear the markings
426 Hop_ConeUnmark_rec( Hop_Regular(pRoot) );
427 return Hop_NotCond( (Hop_Obj_t *)Hop_Regular(pRoot)->pData, Hop_IsComplement(pRoot) );
428}
void Hop_Compose_rec(Hop_Man_t *p, Hop_Obj_t *pObj, Hop_Obj_t *pFunc, Hop_Obj_t *pVar)
Definition hopDfs.c:387
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_ConeUnmark_rec()

void Hop_ConeUnmark_rec ( Hop_Obj_t * pObj)
extern

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

Synopsis [Counts the number of AIG nodes rooted at this cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 257 of file hopDfs.c.

258{
259 assert( !Hop_IsComplement(pObj) );
260 if ( !Hop_ObjIsNode(pObj) || !Hop_ObjIsMarkA(pObj) )
261 return;
262 Hop_ConeUnmark_rec( Hop_ObjFanin0(pObj) );
263 Hop_ConeUnmark_rec( Hop_ObjFanin1(pObj) );
264 assert( Hop_ObjIsMarkA(pObj) ); // loop detection
265 Hop_ObjClearMarkA( pObj );
266}
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_CreateAnd()

Hop_Obj_t * Hop_CreateAnd ( Hop_Man_t * p,
int nVars )
extern

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

Synopsis [Creates AND function with nVars inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 320 of file hopOper.c.

321{
322 Hop_Obj_t * pFunc;
323 int i;
324 pFunc = Hop_ManConst1( p );
325 for ( i = 0; i < nVars; i++ )
326 pFunc = Hop_And( p, pFunc, Hop_IthVar(p, i) );
327 return pFunc;
328}
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition hopOper.c:63
Hop_Obj_t * Hop_And(Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1)
Definition hopOper.c:104
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_CreateExor()

Hop_Obj_t * Hop_CreateExor ( Hop_Man_t * p,
int nVars )
extern

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

Synopsis [Creates AND function with nVars inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 362 of file hopOper.c.

363{
364 Hop_Obj_t * pFunc;
365 int i;
366 pFunc = Hop_ManConst0( p );
367 for ( i = 0; i < nVars; i++ )
368 pFunc = Hop_Exor( p, pFunc, Hop_IthVar(p, i) );
369 return pFunc;
370}
Hop_Obj_t * Hop_Exor(Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1)
Definition hopOper.c:138
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_CreateOr()

Hop_Obj_t * Hop_CreateOr ( Hop_Man_t * p,
int nVars )
extern

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

Synopsis [Creates AND function with nVars inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 341 of file hopOper.c.

342{
343 Hop_Obj_t * pFunc;
344 int i;
345 pFunc = Hop_ManConst0( p );
346 for ( i = 0; i < nVars; i++ )
347 pFunc = Hop_Or( p, pFunc, Hop_IthVar(p, i) );
348 return pFunc;
349}
Hop_Obj_t * Hop_Or(Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1)
Definition hopOper.c:171
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_DagSize()

int Hop_DagSize ( Hop_Obj_t * pObj)
extern

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

Synopsis [Counts the number of AIG nodes rooted at this cone.]

Description []

SideEffects []

SeeAlso []

Definition at line 279 of file hopDfs.c.

280{
281 int Counter;
282 Counter = Hop_ConeCountAndMark_rec( Hop_Regular(pObj) );
283 Hop_ConeUnmark_rec( Hop_Regular(pObj) );
284 return Counter;
285}
int Hop_ConeCountAndMark_rec(Hop_Obj_t *pObj)
Definition hopDfs.c:233
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_Exor()

Hop_Obj_t * Hop_Exor ( Hop_Man_t * p,
Hop_Obj_t * p0,
Hop_Obj_t * p1 )
extern

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

Synopsis [Performs canonicization step.]

Description [The argument nodes can be complemented.]

SideEffects []

SeeAlso []

Definition at line 138 of file hopOper.c.

139{
140/*
141 Hop_Obj_t * pGhost, * pResult;
142 // check trivial cases
143 if ( p0 == p1 )
144 return Hop_Not(p->pConst1);
145 if ( p0 == Hop_Not(p1) )
146 return p->pConst1;
147 if ( Hop_Regular(p0) == p->pConst1 )
148 return Hop_NotCond( p1, p0 == p->pConst1 );
149 if ( Hop_Regular(p1) == p->pConst1 )
150 return Hop_NotCond( p0, p1 == p->pConst1 );
151 // check the table
152 pGhost = Hop_ObjCreateGhost( p, p0, p1, AIG_EXOR );
153 if ( pResult = Hop_TableLookup( p, pGhost ) )
154 return pResult;
155 return Hop_ObjCreate( p, pGhost );
156*/
157 return Hop_Or( p, Hop_And(p, p0, Hop_Not(p1)), Hop_And(p, Hop_Not(p0), p1) );
158}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_IthVar()

Hop_Obj_t * Hop_IthVar ( Hop_Man_t * p,
int i )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Returns i-th elementary variable.]

Description []

SideEffects []

SeeAlso []

Definition at line 63 of file hopOper.c.

64{
65 int v;
66 for ( v = Hop_ManPiNum(p); v <= i; v++ )
68 assert( i < Vec_PtrSize(p->vPis) );
69 return Hop_ManPi( p, i );
70}
Hop_Obj_t * Hop_ObjCreatePi(Hop_Man_t *p)
DECLARATIONS ///.
Definition hopObj.c:45
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_Maj()

Hop_Obj_t * Hop_Maj ( Hop_Man_t * p,
Hop_Obj_t * pA,
Hop_Obj_t * pB,
Hop_Obj_t * pC )
extern

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

Synopsis [Implements ITE operation.]

Description []

SideEffects []

SeeAlso []

Definition at line 242 of file hopOper.c.

243{
244 return Hop_Or( p, Hop_Or(p, Hop_And(p, pA, pB), Hop_And(p, pA, pC)), Hop_And(p, pB, pC) );
245}
Here is the call graph for this function:

◆ Hop_ManAddMemory()

void Hop_ManAddMemory ( Hop_Man_t * p)
extern

MACRO DEFINITIONS ///.

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

Synopsis [Allocates additional memory for the nodes.]

Description [Allocates IVY_PAGE_SIZE nodes. Aligns memory by 32 bytes. Records the pointer to the AIG manager in the -1 entry.]

SideEffects []

SeeAlso []

Definition at line 89 of file hopMem.c.

90{
91 char * pMemory;
92 int i, nBytes;
93 assert( sizeof(Hop_Obj_t) <= 64 );
94 assert( p->pListFree == NULL );
95// assert( (Hop_ManObjNum(p) & IVY_PAGE_MASK) == 0 );
96 // allocate new memory page
97 nBytes = sizeof(Hop_Obj_t) * (1<<IVY_PAGE_SIZE) + 64;
98 pMemory = ABC_ALLOC( char, nBytes );
99 Vec_PtrPush( p->vChunks, pMemory );
100 // align memory at the 32-byte boundary
101 pMemory = pMemory + 64 - (((int)(ABC_PTRUINT_T)pMemory) & 63);
102 // remember the manager in the first entry
103 Vec_PtrPush( p->vPages, pMemory );
104 // break the memory down into nodes
105 p->pListFree = (Hop_Obj_t *)pMemory;
106 for ( i = 1; i <= IVY_PAGE_MASK; i++ )
107 {
108 *((char **)pMemory) = pMemory + sizeof(Hop_Obj_t);
109 pMemory += sizeof(Hop_Obj_t);
110 }
111 *((char **)pMemory) = NULL;
112}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define IVY_PAGE_SIZE
DECLARATIONS ///.
Definition hopMem.c:31
#define IVY_PAGE_MASK
Definition hopMem.c:32

◆ Hop_ManBalance()

Hop_Man_t * Hop_ManBalance ( Hop_Man_t * p,
int fUpdateLevel )
extern

FUNCTION DECLARATIONS ///.

FUNCTION DECLARATIONS ///.

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

Synopsis [Performs algebraic balancing of the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 51 of file hopBalance.c.

52{
53 Hop_Man_t * pNew;
54 Hop_Obj_t * pObj, * pObjNew;
55 Vec_Vec_t * vStore;
56 int i;
57 // create the new manager
58 pNew = Hop_ManStart();
59 pNew->fRefCount = 0;
60 // map the PI nodes
62 Hop_ManConst1(p)->pData = Hop_ManConst1(pNew);
63 Hop_ManForEachPi( p, pObj, i )
64 pObj->pData = Hop_ObjCreatePi(pNew);
65 // balance the AIG
66 vStore = Vec_VecAlloc( 50 );
67 Hop_ManForEachPo( p, pObj, i )
68 {
69 pObjNew = Hop_NodeBalance_rec( pNew, Hop_ObjFanin0(pObj), vStore, 0, fUpdateLevel );
70 Hop_ObjCreatePo( pNew, Hop_NotCond( pObjNew, Hop_ObjFaninC0(pObj) ) );
71 }
72 Vec_VecFree( vStore );
73 // remove dangling nodes
74// Hop_ManCreateRefs( pNew );
75// if ( i = Hop_ManCleanup( pNew ) )
76// printf( "Cleanup after balancing removed %d dangling nodes.\n", i );
77 // check the resulting AIG
78 if ( !Hop_ManCheck(pNew) )
79 printf( "Hop_ManBalance(): The check has failed.\n" );
80 return pNew;
81}
Hop_Obj_t * Hop_ObjCreatePo(Hop_Man_t *p, Hop_Obj_t *pDriver)
Definition hopObj.c:67
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition hop.h:49
int Hop_ManCheck(Hop_Man_t *p)
DECLARATIONS ///.
Definition hopCheck.c:45
#define Hop_ManForEachPi(p, pObj, i)
ITERATORS ///.
Definition hop.h:259
#define Hop_ManForEachPo(p, pObj, i)
Definition hop.h:262
Hop_Man_t * Hop_ManStart()
DECLARATIONS ///.
Definition hopMan.c:45
void Hop_ManCleanData(Hop_Man_t *p)
Definition hopUtil.c:63
void * pData
Definition hop.h:68
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition vecVec.h:42
Here is the call graph for this function:

◆ Hop_ManCheck()

int Hop_ManCheck ( Hop_Man_t * p)
extern

DECLARATIONS ///.

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

FileName [hopCheck.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Minimalistic And-Inverter Graph package.]

Synopsis [AIG checking procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - May 11, 2006.]

Revision [

Id
hopCheck.c,v 1.00 2006/05/11 00:00:00 alanmi Exp

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

Synopsis [Checks the consistency of the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file hopCheck.c.

46{
47 Hop_Obj_t * pObj, * pObj2;
48 int i;
49 // check primary inputs
50 Hop_ManForEachPi( p, pObj, i )
51 {
52 if ( Hop_ObjFanin0(pObj) || Hop_ObjFanin1(pObj) )
53 {
54 printf( "Hop_ManCheck: The PI node \"%p\" has fanins.\n", pObj );
55 return 0;
56 }
57 }
58 // check primary outputs
59 Hop_ManForEachPo( p, pObj, i )
60 {
61 if ( !Hop_ObjFanin0(pObj) )
62 {
63 printf( "Hop_ManCheck: The PO node \"%p\" has NULL fanin.\n", pObj );
64 return 0;
65 }
66 if ( Hop_ObjFanin1(pObj) )
67 {
68 printf( "Hop_ManCheck: The PO node \"%p\" has second fanin.\n", pObj );
69 return 0;
70 }
71 }
72 // check internal nodes
73 Hop_ManForEachNode( p, pObj, i )
74 {
75 if ( !Hop_ObjFanin0(pObj) || !Hop_ObjFanin1(pObj) )
76 {
77 printf( "Hop_ManCheck: The AIG has internal node \"%p\" with a NULL fanin.\n", pObj );
78 return 0;
79 }
80 if ( Hop_ObjFanin0(pObj)->Id >= Hop_ObjFanin1(pObj)->Id )
81 {
82 printf( "Hop_ManCheck: The AIG has node \"%p\" with a wrong ordering of fanins.\n", pObj );
83 return 0;
84 }
85 pObj2 = Hop_TableLookup( p, pObj );
86 if ( pObj2 != pObj )
87 {
88 printf( "Hop_ManCheck: Node \"%p\" is not in the structural hashing table.\n", pObj );
89 return 0;
90 }
91 }
92 // count the total number of nodes
93 if ( Hop_ManObjNum(p) != 1 + Hop_ManPiNum(p) + Hop_ManPoNum(p) + Hop_ManAndNum(p) + Hop_ManExorNum(p) )
94 {
95 printf( "Hop_ManCheck: The number of created nodes is wrong.\n" );
96 return 0;
97 }
98 // count the number of nodes in the table
99 if ( Hop_TableCountEntries(p) != Hop_ManAndNum(p) + Hop_ManExorNum(p) )
100 {
101 printf( "Hop_ManCheck: The number of nodes in the structural hashing table is wrong.\n" );
102 return 0;
103 }
104// if ( !Hop_ManIsAcyclic(p) )
105// return 0;
106 return 1;
107}
int Hop_TableCountEntries(Hop_Man_t *p)
Definition hopTable.c:145
#define Hop_ManForEachNode(p, pObj, i)
Definition hop.h:265
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_ManCleanData()

void Hop_ManCleanData ( Hop_Man_t * p)
extern

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

Synopsis [Cleans the data pointers for the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 63 of file hopUtil.c.

64{
65 Hop_Obj_t * pObj;
66 int i;
67 p->nTravIds = 1;
68 Hop_ManConst1(p)->pData = NULL;
69 Hop_ManForEachPi( p, pObj, i )
70 pObj->pData = NULL;
71 Hop_ManForEachPo( p, pObj, i )
72 pObj->pData = NULL;
73 Hop_ManForEachNode( p, pObj, i )
74 pObj->pData = NULL;
75}
Here is the caller graph for this function:

◆ Hop_ManCleanup()

int Hop_ManCleanup ( Hop_Man_t * p)
extern

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

Synopsis [Returns the number of dangling nodes removed.]

Description []

SideEffects []

SeeAlso []

Definition at line 120 of file hopMan.c.

121{
122 Vec_Ptr_t * vObjs;
123 Hop_Obj_t * pNode;
124 int i, nNodesOld;
125 assert( p->fRefCount );
126 nNodesOld = Hop_ManNodeNum(p);
127 // collect roots of dangling nodes
128 vObjs = Vec_PtrAlloc( 100 );
129 Hop_ManForEachNode( p, pNode, i )
130 if ( Hop_ObjRefs(pNode) == 0 )
131 Vec_PtrPush( vObjs, pNode );
132 // recursively remove dangling nodes
133 Vec_PtrForEachEntry( Hop_Obj_t *, vObjs, pNode, i )
134 Hop_ObjDelete_rec( p, pNode );
135 Vec_PtrFree( vObjs );
136 return nNodesOld - Hop_ManNodeNum(p);
137}
void Hop_ObjDelete_rec(Hop_Man_t *p, Hop_Obj_t *pObj)
Definition hopObj.c:214
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:

◆ Hop_ManComputeTruth6()

word Hop_ManComputeTruth6 ( Hop_Man_t * p,
Hop_Obj_t * pObj,
int nVars )
extern

Definition at line 256 of file hopTruth.c.

257{
258 word Truth;
259 int i;
260 if ( Hop_ObjIsConst1( Hop_Regular(pObj) ) )
261 return Hop_IsComplement(pObj) ? 0 : ~(word)0;
262 for ( i = 0; i < nVars; i++ )
263 Hop_ManPi( p, i )->iData = i;
264 Truth = Hop_ManComputeTruth6_rec( p, Hop_Regular(pObj) );
265 return Hop_IsComplement(pObj) ? ~Truth : Truth;
266}
word Hop_ManComputeTruth6_rec(Hop_Man_t *p, Hop_Obj_t *pObj)
Definition hopTruth.c:244
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_ManConvertAigToTruth()

unsigned * Hop_ManConvertAigToTruth ( Hop_Man_t * p,
Hop_Obj_t * pRoot,
int nVars,
Vec_Int_t * vTruth,
int fMsbFirst )
extern

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

Synopsis [Computes truth table of the node.]

Description [Assumes that the structural support is no more than 8 inputs. Uses array vTruth to store temporary truth tables. The returned pointer should be used immediately.]

SideEffects []

SeeAlso []

Definition at line 143 of file hopTruth.c.

144{
145 static unsigned uTruths[8][8] = { // elementary truth tables
146 { 0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA,0xAAAAAAAA },
147 { 0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC,0xCCCCCCCC },
148 { 0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0 },
149 { 0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00 },
150 { 0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000 },
151 { 0x00000000,0xFFFFFFFF,0x00000000,0xFFFFFFFF,0x00000000,0xFFFFFFFF,0x00000000,0xFFFFFFFF },
152 { 0x00000000,0x00000000,0xFFFFFFFF,0xFFFFFFFF,0x00000000,0x00000000,0xFFFFFFFF,0xFFFFFFFF },
153 { 0x00000000,0x00000000,0x00000000,0x00000000,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF }
154 };
155 Hop_Obj_t * pObj;
156 unsigned * pTruth, * pTruth2;
157 int i, nWords, nNodes;
158 Vec_Ptr_t * vTtElems;
159
160 // if the number of variables is more than 8, allocate truth tables
161 if ( nVars > 8 )
162 vTtElems = Vec_PtrAllocTruthTables( nVars );
163 else
164 vTtElems = NULL;
165
166 // clear the data fields and set marks
167 nNodes = Hop_ManConvertAigToTruth_rec1( Hop_Regular(pRoot) );
168 // prepare memory
169 nWords = Hop_TruthWordNum( nVars );
170 Vec_IntClear( vTruth );
171 Vec_IntGrow( vTruth, nWords * (nNodes+1) );
172 pTruth = Vec_IntFetch( vTruth, nWords );
173 // check the case of a constant
174 if ( Hop_ObjIsConst1( Hop_Regular(pRoot) ) )
175 {
176 assert( nNodes == 0 );
177 if ( Hop_IsComplement(pRoot) )
178 Hop_ManTruthClear( pTruth, nVars );
179 else
180 Hop_ManTruthFill( pTruth, nVars );
181 return pTruth;
182 }
183 // set elementary truth tables at the leaves
184 assert( nVars <= Hop_ManPiNum(p) );
185// assert( Hop_ManPiNum(p) <= 8 );
186 if ( fMsbFirst )
187 {
188// Hop_ManForEachPi( p, pObj, i )
189 for ( i = 0; i < nVars; i++ )
190 {
191 pObj = Hop_ManPi( p, i );
192 if ( vTtElems )
193 pObj->pData = Vec_PtrEntry(vTtElems, nVars-1-i);
194 else
195 pObj->pData = (void *)uTruths[nVars-1-i];
196 }
197 }
198 else
199 {
200// Hop_ManForEachPi( p, pObj, i )
201 for ( i = 0; i < nVars; i++ )
202 {
203 pObj = Hop_ManPi( p, i );
204 if ( vTtElems )
205 pObj->pData = Vec_PtrEntry(vTtElems, i);
206 else
207 pObj->pData = (void *)uTruths[i];
208 }
209 }
210 // clear the marks and compute the truth table
211 pTruth2 = Hop_ManConvertAigToTruth_rec2( Hop_Regular(pRoot), vTruth, nWords );
212 // copy the result
213 Hop_ManTruthCopy( pTruth, pTruth2, nVars );
214 if ( Hop_IsComplement(pRoot) )
215 Hop_ManTruthNot( pTruth, pTruth, nVars );
216 if ( vTtElems )
217 Vec_PtrFree( vTtElems );
218 return pTruth;
219}
int nWords
Definition abcNpn.c:127
unsigned * Hop_ManConvertAigToTruth_rec2(Hop_Obj_t *pObj, Vec_Int_t *vTruth, int nWords)
Definition hopTruth.c:97
int Hop_ManConvertAigToTruth_rec1(Hop_Obj_t *pObj)
FUNCTION DEFINITIONS ///.
Definition hopTruth.c:73
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_ManCountLevels()

int Hop_ManCountLevels ( Hop_Man_t * p)
extern

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

Synopsis [Computes the max number of levels in the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 116 of file hopDfs.c.

117{
118 Vec_Ptr_t * vNodes;
119 Hop_Obj_t * pObj;
120 int i, LevelsMax, Level0, Level1;
121 // initialize the levels
122 Hop_ManConst1(p)->pData = NULL;
123 Hop_ManForEachPi( p, pObj, i )
124 pObj->pData = NULL;
125 // compute levels in a DFS order
126 vNodes = Hop_ManDfs( p );
127 Vec_PtrForEachEntry( Hop_Obj_t *, vNodes, pObj, i )
128 {
129 Level0 = (int)(ABC_PTRUINT_T)Hop_ObjFanin0(pObj)->pData;
130 Level1 = (int)(ABC_PTRUINT_T)Hop_ObjFanin1(pObj)->pData;
131 pObj->pData = (void *)(ABC_PTRUINT_T)(1 + Hop_ObjIsExor(pObj) + Abc_MaxInt(Level0, Level1));
132 }
133 Vec_PtrFree( vNodes );
134 // get levels of the POs
135 LevelsMax = 0;
136 Hop_ManForEachPo( p, pObj, i )
137 LevelsMax = Abc_MaxInt( LevelsMax, (int)(ABC_PTRUINT_T)Hop_ObjFanin0(pObj)->pData );
138 return LevelsMax;
139}
Vec_Ptr_t * Hop_ManDfs(Hop_Man_t *p)
Definition hopDfs.c:68
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_ManCreateRefs()

void Hop_ManCreateRefs ( Hop_Man_t * p)
extern

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

Synopsis [Creates correct reference counters at each node.]

Description []

SideEffects []

SeeAlso []

Definition at line 152 of file hopDfs.c.

153{
154 Hop_Obj_t * pObj;
155 int i;
156 if ( p->fRefCount )
157 return;
158 p->fRefCount = 1;
159 // clear refs
160 Hop_ObjClearRef( Hop_ManConst1(p) );
161 Hop_ManForEachPi( p, pObj, i )
162 Hop_ObjClearRef( pObj );
163 Hop_ManForEachNode( p, pObj, i )
164 Hop_ObjClearRef( pObj );
165 Hop_ManForEachPo( p, pObj, i )
166 Hop_ObjClearRef( pObj );
167 // set refs
168 Hop_ManForEachNode( p, pObj, i )
169 {
170 Hop_ObjRef( Hop_ObjFanin0(pObj) );
171 Hop_ObjRef( Hop_ObjFanin1(pObj) );
172 }
173 Hop_ManForEachPo( p, pObj, i )
174 Hop_ObjRef( Hop_ObjFanin0(pObj) );
175}

◆ Hop_ManDfs()

Vec_Ptr_t * Hop_ManDfs ( Hop_Man_t * p)
extern

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

Synopsis [Collects internal nodes in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 68 of file hopDfs.c.

69{
70 Vec_Ptr_t * vNodes;
71 Hop_Obj_t * pObj;
72 int i;
73 vNodes = Vec_PtrAlloc( Hop_ManNodeNum(p) );
74 Hop_ManForEachNode( p, pObj, i )
75 Hop_ManDfs_rec( pObj, vNodes );
76 Hop_ManForEachNode( p, pObj, i )
77 Hop_ObjClearMarkA(pObj);
78 return vNodes;
79}
ABC_NAMESPACE_IMPL_START void Hop_ManDfs_rec(Hop_Obj_t *pObj, Vec_Ptr_t *vNodes)
DECLARATIONS ///.
Definition hopDfs.c:45
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_ManDfsNode()

Vec_Ptr_t * Hop_ManDfsNode ( Hop_Man_t * p,
Hop_Obj_t * pNode )
extern

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

Synopsis [Collects internal nodes in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 92 of file hopDfs.c.

93{
94 Vec_Ptr_t * vNodes;
95 Hop_Obj_t * pObj;
96 int i;
97 assert( !Hop_IsComplement(pNode) );
98 vNodes = Vec_PtrAlloc( 16 );
99 Hop_ManDfs_rec( pNode, vNodes );
100 Vec_PtrForEachEntry( Hop_Obj_t *, vNodes, pObj, i )
101 Hop_ObjClearMarkA(pObj);
102 return vNodes;
103}
Here is the call graph for this function:

◆ Hop_ManDumpBlif()

void Hop_ManDumpBlif ( Hop_Man_t * p,
char * pFileName )
extern

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

Synopsis [Writes the AIG into the BLIF file.]

Description []

SideEffects []

SeeAlso []

Definition at line 509 of file hopUtil.c.

510{
511 FILE * pFile;
512 Vec_Ptr_t * vNodes;
513 Hop_Obj_t * pObj, * pConst1 = NULL;
514 int i, nDigits, Counter = 0;
515 if ( Hop_ManPoNum(p) == 0 )
516 {
517 printf( "Hop_ManDumpBlif(): AIG manager does not have POs.\n" );
518 return;
519 }
520 // collect nodes in the DFS order
521 vNodes = Hop_ManDfs( p );
522 // assign IDs to objects
523 Hop_ManConst1(p)->pData = (void *)(ABC_PTRUINT_T)Counter++;
524 Hop_ManForEachPi( p, pObj, i )
525 pObj->pData = (void *)(ABC_PTRUINT_T)Counter++;
526 Hop_ManForEachPo( p, pObj, i )
527 pObj->pData = (void *)(ABC_PTRUINT_T)Counter++;
528 Vec_PtrForEachEntry( Hop_Obj_t *, vNodes, pObj, i )
529 pObj->pData = (void *)(ABC_PTRUINT_T)Counter++;
530 nDigits = Hop_Base10Log( Counter );
531 // write the file
532 pFile = fopen( pFileName, "w" );
533 fprintf( pFile, "# BLIF file written by procedure Hop_ManDumpBlif() in ABC\n" );
534 fprintf( pFile, "# http://www.eecs.berkeley.edu/~alanmi/abc/\n" );
535 fprintf( pFile, ".model test\n" );
536 // write PIs
537 fprintf( pFile, ".inputs" );
538 Hop_ManForEachPi( p, pObj, i )
539 fprintf( pFile, " n%0*d", nDigits, (int)(ABC_PTRUINT_T)pObj->pData );
540 fprintf( pFile, "\n" );
541 // write POs
542 fprintf( pFile, ".outputs" );
543 Hop_ManForEachPo( p, pObj, i )
544 fprintf( pFile, " n%0*d", nDigits, (int)(ABC_PTRUINT_T)pObj->pData );
545 fprintf( pFile, "\n" );
546 // write nodes
547 Vec_PtrForEachEntry( Hop_Obj_t *, vNodes, pObj, i )
548 {
549 fprintf( pFile, ".names n%0*d n%0*d n%0*d\n",
550 nDigits, (int)(ABC_PTRUINT_T)Hop_ObjFanin0(pObj)->pData,
551 nDigits, (int)(ABC_PTRUINT_T)Hop_ObjFanin1(pObj)->pData,
552 nDigits, (int)(ABC_PTRUINT_T)pObj->pData );
553 fprintf( pFile, "%d%d 1\n", !Hop_ObjFaninC0(pObj), !Hop_ObjFaninC1(pObj) );
554 }
555 // write POs
556 Hop_ManForEachPo( p, pObj, i )
557 {
558 fprintf( pFile, ".names n%0*d n%0*d\n",
559 nDigits, (int)(ABC_PTRUINT_T)Hop_ObjFanin0(pObj)->pData,
560 nDigits, (int)(ABC_PTRUINT_T)pObj->pData );
561 fprintf( pFile, "%d 1\n", !Hop_ObjFaninC0(pObj) );
562 if ( Hop_ObjIsConst1(Hop_ObjFanin0(pObj)) )
563 pConst1 = Hop_ManConst1(p);
564 }
565 if ( pConst1 )
566 fprintf( pFile, ".names n%0*d\n 1\n", nDigits, (int)(ABC_PTRUINT_T)pConst1->pData );
567 fprintf( pFile, ".end\n\n" );
568 fclose( pFile );
569 Vec_PtrFree( vNodes );
570}
Vec_Ptr_t * Hop_ManDfs(Hop_Man_t *p)
Definition hopDfs.c:68
Here is the call graph for this function:

◆ Hop_ManDup()

Hop_Man_t * Hop_ManDup ( Hop_Man_t * p)
extern

◆ Hop_ManIncrementTravId()

void Hop_ManIncrementTravId ( Hop_Man_t * p)
extern

DECLARATIONS ///.

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

FileName [hopUtil.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [And-Inverter Graph package.]

Synopsis [Various procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - May 11, 2006.]

Revision [

Id
hopUtil.c,v 1.00 2006/05/11 00:00:00 alanmi Exp

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

Synopsis [Increments the current traversal ID of the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file hopUtil.c.

46{
47 if ( p->nTravIds >= (1<<30)-1 )
49 p->nTravIds++;
50}
void Hop_ManCleanData(Hop_Man_t *p)
Definition hopUtil.c:63
Here is the call graph for this function:

◆ Hop_ManPrintStats()

void Hop_ManPrintStats ( Hop_Man_t * p)
extern

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

Synopsis [Stops the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 150 of file hopMan.c.

151{
152 printf( "PI/PO = %d/%d. ", Hop_ManPiNum(p), Hop_ManPoNum(p) );
153 printf( "A = %7d. ", Hop_ManAndNum(p) );
154 printf( "X = %5d. ", Hop_ManExorNum(p) );
155 printf( "Cre = %7d. ", p->nCreated );
156 printf( "Del = %7d. ", p->nDeleted );
157 printf( "Lev = %3d. ", Hop_ManCountLevels(p) );
158 printf( "\n" );
159}
int Hop_ManCountLevels(Hop_Man_t *p)
Definition hopDfs.c:116
Here is the call graph for this function:

◆ Hop_ManPrintVerbose()

void Hop_ManPrintVerbose ( Hop_Man_t * p,
int fHaig )
extern

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

Synopsis [Prints node in HAIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 482 of file hopUtil.c.

483{
484 Vec_Ptr_t * vNodes;
485 Hop_Obj_t * pObj;
486 int i;
487 printf( "PIs: " );
488 Hop_ManForEachPi( p, pObj, i )
489 printf( " %p", pObj );
490 printf( "\n" );
491 vNodes = Hop_ManDfs( p );
492 Vec_PtrForEachEntry( Hop_Obj_t *, vNodes, pObj, i )
493 Hop_ObjPrintVerbose( pObj, fHaig ), printf( "\n" );
494 printf( "\n" );
495 Vec_PtrFree( vNodes );
496}
void Hop_ObjPrintVerbose(Hop_Obj_t *pObj, int fHaig)
Definition hopUtil.c:456
Here is the call graph for this function:

◆ Hop_ManStart()

Hop_Man_t * Hop_ManStart ( )
extern

DECLARATIONS ///.

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

FileName [hopMan.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Minimalistic And-Inverter Graph package.]

Synopsis [AIG manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - May 11, 2006.]

Revision [

Id
hopMan.c,v 1.00 2006/05/11 00:00:00 alanmi Exp

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

Synopsis [Starts the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file hopMan.c.

46{
47 Hop_Man_t * p;
48 // start the manager
49 p = ABC_ALLOC( Hop_Man_t, 1 );
50 memset( p, 0, sizeof(Hop_Man_t) );
51 // perform initializations
52 p->nTravIds = 1;
53 p->fRefCount = 1;
54 p->fCatchExor = 0;
55 // allocate arrays for nodes
56 p->vPis = Vec_PtrAlloc( 100 );
57 p->vPos = Vec_PtrAlloc( 100 );
58 // prepare the internal memory manager
60 // create the constant node
61 p->pConst1 = Hop_ManFetchMemory( p );
62 p->pConst1->Type = AIG_CONST1;
63 p->pConst1->fPhase = 1;
64 p->nCreated = 1;
65 // start the table
66// p->nTableSize = 107;
67 p->nTableSize = 10007;
68 p->pTable = ABC_ALLOC( Hop_Obj_t *, p->nTableSize );
69 memset( p->pTable, 0, sizeof(Hop_Obj_t *) * p->nTableSize );
70 return p;
71}
void Hop_ManStartMemory(Hop_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition hopMem.c:49
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_ManStartMemory()

void Hop_ManStartMemory ( Hop_Man_t * p)
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Starts the internal memory manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 49 of file hopMem.c.

50{
51 p->vChunks = Vec_PtrAlloc( 128 );
52 p->vPages = Vec_PtrAlloc( 128 );
53}
Here is the caller graph for this function:

◆ Hop_ManStop()

void Hop_ManStop ( Hop_Man_t * p)
extern

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

Synopsis [Stops the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 84 of file hopMan.c.

85{
86 Hop_Obj_t * pObj;
87 int i;
88 // make sure the nodes have clean marks
89 pObj = Hop_ManConst1(p);
90 assert( !pObj->fMarkA && !pObj->fMarkB );
91 Hop_ManForEachPi( p, pObj, i )
92 assert( !pObj->fMarkA && !pObj->fMarkB );
93 Hop_ManForEachPo( p, pObj, i )
94 assert( !pObj->fMarkA && !pObj->fMarkB );
95 Hop_ManForEachNode( p, pObj, i )
96 assert( !pObj->fMarkA && !pObj->fMarkB );
97 // print time
98 if ( p->time1 ) { ABC_PRT( "time1", p->time1 ); }
99 if ( p->time2 ) { ABC_PRT( "time2", p->time2 ); }
100// Hop_TableProfile( p );
101 if ( p->vChunks ) Hop_ManStopMemory( p );
102 if ( p->vPis ) Vec_PtrFree( p->vPis );
103 if ( p->vPos ) Vec_PtrFree( p->vPos );
104 if ( p->vObjs ) Vec_PtrFree( p->vObjs );
105 ABC_FREE( p->pTable );
106 ABC_FREE( p );
107}
#define ABC_PRT(a, t)
Definition abc_global.h:255
#define ABC_FREE(obj)
Definition abc_global.h:267
void Hop_ManStopMemory(Hop_Man_t *p)
Definition hopMem.c:66
unsigned int fMarkA
Definition hop.h:77
unsigned int fMarkB
Definition hop.h:78
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_ManStopMemory()

void Hop_ManStopMemory ( Hop_Man_t * p)
extern

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

Synopsis [Stops the internal memory manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 66 of file hopMem.c.

67{
68 void * pMemory;
69 int i;
70 Vec_PtrForEachEntry( void *, p->vChunks, pMemory, i )
71 ABC_FREE( pMemory );
72 Vec_PtrFree( p->vChunks );
73 Vec_PtrFree( p->vPages );
74 p->pListFree = NULL;
75}
Here is the caller graph for this function:

◆ Hop_Miter()

Hop_Obj_t * Hop_Miter ( Hop_Man_t * p,
Vec_Ptr_t * vPairs )
extern

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

Synopsis [Implements the miter.]

Description []

SideEffects []

SeeAlso []

Definition at line 297 of file hopOper.c.

298{
299 int i;
300 assert( vPairs->nSize > 0 );
301 assert( vPairs->nSize % 2 == 0 );
302 // go through the cubes of the node's SOP
303 for ( i = 0; i < vPairs->nSize; i += 2 )
304 vPairs->pArray[i/2] = Hop_Not( Hop_Exor( p, (Hop_Obj_t *)vPairs->pArray[i], (Hop_Obj_t *)vPairs->pArray[i+1] ) );
305 vPairs->nSize = vPairs->nSize/2;
306 return Hop_Not( Hop_Multi_rec( p, (Hop_Obj_t **)vPairs->pArray, vPairs->nSize, AIG_AND ) );
307}
Hop_Obj_t * Hop_Multi_rec(Hop_Man_t *p, Hop_Obj_t **ppObjs, int nObjs, Hop_Type_t Type)
Definition hopOper.c:258
Here is the call graph for this function:

◆ Hop_Mux()

Hop_Obj_t * Hop_Mux ( Hop_Man_t * p,
Hop_Obj_t * pC,
Hop_Obj_t * p1,
Hop_Obj_t * p0 )
extern

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

Synopsis [Implements ITE operation.]

Description []

SideEffects []

SeeAlso []

Definition at line 187 of file hopOper.c.

188{
189/*
190 Hop_Obj_t * pTempA1, * pTempA2, * pTempB1, * pTempB2, * pTemp;
191 int Count0, Count1;
192 // consider trivial cases
193 if ( p0 == Hop_Not(p1) )
194 return Hop_Exor( p, pC, p0 );
195 // other cases can be added
196 // implement the first MUX (F = C * x1 + C' * x0)
197
198 // check for constants here!!!
199
200 pTempA1 = Hop_TableLookup( p, Hop_ObjCreateGhost(p, pC, p1, AIG_AND) );
201 pTempA2 = Hop_TableLookup( p, Hop_ObjCreateGhost(p, Hop_Not(pC), p0, AIG_AND) );
202 if ( pTempA1 && pTempA2 )
203 {
204 pTemp = Hop_TableLookup( p, Hop_ObjCreateGhost(p, Hop_Not(pTempA1), Hop_Not(pTempA2), AIG_AND) );
205 if ( pTemp ) return Hop_Not(pTemp);
206 }
207 Count0 = (pTempA1 != NULL) + (pTempA2 != NULL);
208 // implement the second MUX (F' = C * x1' + C' * x0')
209 pTempB1 = Hop_TableLookup( p, Hop_ObjCreateGhost(p, pC, Hop_Not(p1), AIG_AND) );
210 pTempB2 = Hop_TableLookup( p, Hop_ObjCreateGhost(p, Hop_Not(pC), Hop_Not(p0), AIG_AND) );
211 if ( pTempB1 && pTempB2 )
212 {
213 pTemp = Hop_TableLookup( p, Hop_ObjCreateGhost(p, Hop_Not(pTempB1), Hop_Not(pTempB2), AIG_AND) );
214 if ( pTemp ) return pTemp;
215 }
216 Count1 = (pTempB1 != NULL) + (pTempB2 != NULL);
217 // compare and decide which one to implement
218 if ( Count0 >= Count1 )
219 {
220 pTempA1 = pTempA1? pTempA1 : Hop_And(p, pC, p1);
221 pTempA2 = pTempA2? pTempA2 : Hop_And(p, Hop_Not(pC), p0);
222 return Hop_Or( p, pTempA1, pTempA2 );
223 }
224 pTempB1 = pTempB1? pTempB1 : Hop_And(p, pC, Hop_Not(p1));
225 pTempB2 = pTempB2? pTempB2 : Hop_And(p, Hop_Not(pC), Hop_Not(p0));
226 return Hop_Not( Hop_Or( p, pTempB1, pTempB2 ) );
227*/
228 return Hop_Or( p, Hop_And(p, pC, p1), Hop_And(p, Hop_Not(pC), p0) );
229}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_NodeBalanceBuildSuper()

Hop_Obj_t * Hop_NodeBalanceBuildSuper ( Hop_Man_t * p,
Vec_Ptr_t * vSuper,
Hop_Type_t Type,
int fUpdateLevel )
extern

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

Synopsis [Builds implication supergate.]

Description []

SideEffects []

SeeAlso []

Definition at line 243 of file hopBalance.c.

244{
245 Hop_Obj_t * pObj1, * pObj2;
246 int LeftBound;
247 assert( vSuper->nSize > 1 );
248 // sort the new nodes by level in the decreasing order
249 Vec_PtrSort( vSuper, (int (*)(const void *, const void *))Hop_NodeCompareLevelsDecrease );
250 // balance the nodes
251 while ( vSuper->nSize > 1 )
252 {
253 // find the left bound on the node to be paired
254 LeftBound = (!fUpdateLevel)? 0 : Hop_NodeBalanceFindLeft( vSuper );
255 // find the node that can be shared (if no such node, randomize choice)
256 Hop_NodeBalancePermute( p, vSuper, LeftBound, Type == AIG_EXOR );
257 // pull out the last two nodes
258 pObj1 = (Hop_Obj_t *)Vec_PtrPop(vSuper);
259 pObj2 = (Hop_Obj_t *)Vec_PtrPop(vSuper);
260 Hop_NodeBalancePushUniqueOrderByLevel( vSuper, Hop_Oper(p, pObj1, pObj2, Type) );
261 }
262 return (Hop_Obj_t *)Vec_PtrEntry(vSuper, 0);
263}
int Hop_NodeCompareLevelsDecrease(Hop_Obj_t **pp1, Hop_Obj_t **pp2)
Definition hopBalance.c:217
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
Here is the call graph for this function:

◆ Hop_ObjCleanData_rec()

void Hop_ObjCleanData_rec ( Hop_Obj_t * pObj)
extern

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

Synopsis [Recursively cleans the data pointers in the cone of the node.]

Description [Applicable to small AIGs only because no caching is performed.]

SideEffects []

SeeAlso []

Definition at line 88 of file hopUtil.c.

89{
90 assert( !Hop_IsComplement(pObj) );
91 assert( !Hop_ObjIsPo(pObj) );
92 if ( Hop_ObjIsAnd(pObj) )
93 {
94 Hop_ObjCleanData_rec( Hop_ObjFanin0(pObj) );
95 Hop_ObjCleanData_rec( Hop_ObjFanin1(pObj) );
96 }
97 pObj->pData = NULL;
98}
void Hop_ObjCleanData_rec(Hop_Obj_t *pObj)
Definition hopUtil.c:88
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_ObjCollectMulti()

void Hop_ObjCollectMulti ( Hop_Obj_t * pRoot,
Vec_Ptr_t * vSuper )
extern

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

Synopsis [Detects multi-input gate rooted at this node.]

Description []

SideEffects []

SeeAlso []

Definition at line 133 of file hopUtil.c.

134{
135 assert( !Hop_IsComplement(pRoot) );
136 Vec_PtrClear( vSuper );
137 Hop_ObjCollectMulti_rec( pRoot, pRoot, vSuper );
138}
void Hop_ObjCollectMulti_rec(Hop_Obj_t *pRoot, Hop_Obj_t *pObj, Vec_Ptr_t *vSuper)
Definition hopUtil.c:111
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_ObjConnect()

void Hop_ObjConnect ( Hop_Man_t * p,
Hop_Obj_t * pObj,
Hop_Obj_t * pFan0,
Hop_Obj_t * pFan1 )
extern

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

Synopsis [Connect the object to the fanin.]

Description []

SideEffects []

SeeAlso []

Definition at line 125 of file hopObj.c.

126{
127 assert( !Hop_IsComplement(pObj) );
128 assert( Hop_ObjIsNode(pObj) );
129 // add the first fanin
130 pObj->pFanin0 = pFan0;
131 pObj->pFanin1 = pFan1;
132 // increment references of the fanins and add their fanouts
133 if ( p->fRefCount )
134 {
135 if ( pFan0 != NULL )
136 Hop_ObjRef( Hop_ObjFanin0(pObj) );
137 if ( pFan1 != NULL )
138 Hop_ObjRef( Hop_ObjFanin1(pObj) );
139 }
140 else
141 pObj->nRefs = Hop_ObjLevelNew( pObj );
142 // set the phase
143 pObj->fPhase = Hop_ObjPhaseCompl(pFan0) & Hop_ObjPhaseCompl(pFan1);
144 // add the node to the structural hash table
145 Hop_TableInsert( p, pObj );
146}
void Hop_TableInsert(Hop_Man_t *p, Hop_Obj_t *pObj)
Definition hopTable.c:100
unsigned int nRefs
Definition hop.h:79
unsigned int fPhase
Definition hop.h:76
Hop_Obj_t * pFanin1
Definition hop.h:74
Hop_Obj_t * pFanin0
Definition hop.h:73
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_ObjCreate()

Hop_Obj_t * Hop_ObjCreate ( Hop_Man_t * p,
Hop_Obj_t * pGhost )
extern

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

Synopsis [Create the new node assuming it does not exist.]

Description []

SideEffects []

SeeAlso []

Definition at line 97 of file hopObj.c.

98{
99 Hop_Obj_t * pObj;
100 assert( !Hop_IsComplement(pGhost) );
101 assert( Hop_ObjIsNode(pGhost) );
102 assert( pGhost == &p->Ghost );
103 // get memory for the new object
104 pObj = Hop_ManFetchMemory( p );
105 pObj->Type = pGhost->Type;
106 // add connections
107 Hop_ObjConnect( p, pObj, pGhost->pFanin0, pGhost->pFanin1 );
108 // update node counters of the manager
109 p->nObjs[Hop_ObjType(pObj)]++;
110 assert( pObj->pData == NULL );
111 return pObj;
112}
void Hop_ObjConnect(Hop_Man_t *p, Hop_Obj_t *pObj, Hop_Obj_t *pFan0, Hop_Obj_t *pFan1)
Definition hopObj.c:125
unsigned int Type
Definition hop.h:75
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_ObjCreateChoice()

void Hop_ObjCreateChoice ( Hop_Obj_t * pOld,
Hop_Obj_t * pNew )
extern

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

Synopsis [Sets an equivalence relation between the nodes.]

Description [Makes the representative of pNew point to the representaive of pOld.]

SideEffects []

SeeAlso []

Definition at line 260 of file hopObj.c.

261{
262 Hop_Obj_t * pOldRepr;
263 Hop_Obj_t * pNewRepr;
264 assert( pOld != NULL && pNew != NULL );
265 pOldRepr = Hop_ObjRepr(pOld);
266 pNewRepr = Hop_ObjRepr(pNew);
267 if ( pNewRepr != pOldRepr )
268 pNewRepr->pData = pOldRepr;
269}
Hop_Obj_t * Hop_ObjRepr(Hop_Obj_t *pObj)
Definition hopObj.c:241
Here is the call graph for this function:

◆ Hop_ObjCreatePi()

Hop_Obj_t * Hop_ObjCreatePi ( Hop_Man_t * p)
extern

DECLARATIONS ///.

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

FileName [hopObj.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Minimalistic And-Inverter Graph package.]

Synopsis [Adding/removing objects.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - May 11, 2006.]

Revision [

Id
hopObj.c,v 1.00 2006/05/11 00:00:00 alanmi Exp

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

Synopsis [Creates primary input.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file hopObj.c.

46{
47 Hop_Obj_t * pObj;
48 pObj = Hop_ManFetchMemory( p );
49 pObj->Type = AIG_PI;
50 pObj->PioNum = Vec_PtrSize( p->vPis );
51 Vec_PtrPush( p->vPis, pObj );
52 p->nObjs[AIG_PI]++;
53 return pObj;
54}
int PioNum
Definition hop.h:72
Here is the caller graph for this function:

◆ Hop_ObjCreatePo()

Hop_Obj_t * Hop_ObjCreatePo ( Hop_Man_t * p,
Hop_Obj_t * pDriver )
extern

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

Synopsis [Creates primary output with the given driver.]

Description []

SideEffects []

SeeAlso []

Definition at line 67 of file hopObj.c.

68{
69 Hop_Obj_t * pObj;
70 pObj = Hop_ManFetchMemory( p );
71 pObj->Type = AIG_PO;
72 Vec_PtrPush( p->vPos, pObj );
73 // add connections
74 pObj->pFanin0 = pDriver;
75 if ( p->fRefCount )
76 Hop_ObjRef( Hop_Regular(pDriver) );
77 else
78 pObj->nRefs = Hop_ObjLevel( Hop_Regular(pDriver) );
79 // set the phase
80 pObj->fPhase = Hop_ObjPhaseCompl(pDriver);
81 // update node counters of the manager
82 p->nObjs[AIG_PO]++;
83 return pObj;
84}
Here is the caller graph for this function:

◆ Hop_ObjDelete()

void Hop_ObjDelete ( Hop_Man_t * p,
Hop_Obj_t * pObj )
extern

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

Synopsis [Deletes the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 186 of file hopObj.c.

187{
188 assert( !Hop_IsComplement(pObj) );
189 assert( !Hop_ObjIsTerm(pObj) );
190 assert( Hop_ObjRefs(pObj) == 0 );
191 // update node counters of the manager
192 p->nObjs[pObj->Type]--;
193 p->nDeleted++;
194 // remove connections
195 Hop_ObjDisconnect( p, pObj );
196 // remove PIs/POs from the arrays
197 if ( Hop_ObjIsPi(pObj) )
198 Vec_PtrRemove( p->vPis, pObj );
199 // free the node
200 Hop_ManRecycleMemory( p, pObj );
201}
void Hop_ObjDisconnect(Hop_Man_t *p, Hop_Obj_t *pObj)
Definition hopObj.c:159
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_ObjDelete_rec()

void Hop_ObjDelete_rec ( Hop_Man_t * p,
Hop_Obj_t * pObj )
extern

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

Synopsis [Deletes the MFFC of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 214 of file hopObj.c.

215{
216 Hop_Obj_t * pFanin0, * pFanin1;
217 assert( !Hop_IsComplement(pObj) );
218 if ( Hop_ObjIsConst1(pObj) || Hop_ObjIsPi(pObj) )
219 return;
220 assert( Hop_ObjIsNode(pObj) );
221 pFanin0 = Hop_ObjFanin0(pObj);
222 pFanin1 = Hop_ObjFanin1(pObj);
223 Hop_ObjDelete( p, pObj );
224 if ( pFanin0 && !Hop_ObjIsNone(pFanin0) && Hop_ObjRefs(pFanin0) == 0 )
225 Hop_ObjDelete_rec( p, pFanin0 );
226 if ( pFanin1 && !Hop_ObjIsNone(pFanin1) && Hop_ObjRefs(pFanin1) == 0 )
227 Hop_ObjDelete_rec( p, pFanin1 );
228}
void Hop_ObjDelete_rec(Hop_Man_t *p, Hop_Obj_t *pObj)
Definition hopObj.c:214
void Hop_ObjDelete(Hop_Man_t *p, Hop_Obj_t *pObj)
Definition hopObj.c:186
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_ObjDisconnect()

void Hop_ObjDisconnect ( Hop_Man_t * p,
Hop_Obj_t * pObj )
extern

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

Synopsis [Connect the object to the fanin.]

Description []

SideEffects []

SeeAlso []

Definition at line 159 of file hopObj.c.

160{
161 assert( !Hop_IsComplement(pObj) );
162 assert( Hop_ObjIsNode(pObj) );
163 // remove connections
164 if ( pObj->pFanin0 != NULL )
165 Hop_ObjDeref(Hop_ObjFanin0(pObj));
166 if ( pObj->pFanin1 != NULL )
167 Hop_ObjDeref(Hop_ObjFanin1(pObj));
168 // remove the node from the structural hash table
169 Hop_TableDelete( p, pObj );
170 // add the first fanin
171 pObj->pFanin0 = NULL;
172 pObj->pFanin1 = NULL;
173}
void Hop_TableDelete(Hop_Man_t *p, Hop_Obj_t *pObj)
Definition hopTable.c:123
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_ObjFanoutCount()

int Hop_ObjFanoutCount ( Hop_Obj_t * pObj,
Hop_Obj_t * pPivot )
extern

Definition at line 310 of file hopDfs.c.

311{
312 int Counter;
313 assert( !Hop_IsComplement(pPivot) );
314 Counter = Hop_ObjFanoutCount_rec( Hop_Regular(pObj), pPivot );
315 Hop_ConeUnmark_rec( Hop_Regular(pObj) );
316 return Counter;
317}
int Hop_ObjFanoutCount_rec(Hop_Obj_t *pObj, Hop_Obj_t *pPivot)
Definition hopDfs.c:298
Here is the call graph for this function:

◆ Hop_ObjIsMuxType()

int Hop_ObjIsMuxType ( Hop_Obj_t * pNode)
extern

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

Synopsis [Returns 1 if the node is the root of MUX or EXOR/NEXOR.]

Description []

SideEffects []

SeeAlso []

Definition at line 151 of file hopUtil.c.

152{
153 Hop_Obj_t * pNode0, * pNode1;
154 // check that the node is regular
155 assert( !Hop_IsComplement(pNode) );
156 // if the node is not AND, this is not MUX
157 if ( !Hop_ObjIsAnd(pNode) )
158 return 0;
159 // if the children are not complemented, this is not MUX
160 if ( !Hop_ObjFaninC0(pNode) || !Hop_ObjFaninC1(pNode) )
161 return 0;
162 // get children
163 pNode0 = Hop_ObjFanin0(pNode);
164 pNode1 = Hop_ObjFanin1(pNode);
165 // if the children are not ANDs, this is not MUX
166 if ( !Hop_ObjIsAnd(pNode0) || !Hop_ObjIsAnd(pNode1) )
167 return 0;
168 // otherwise the node is MUX iff it has a pair of equal grandchildren
169 return (Hop_ObjFanin0(pNode0) == Hop_ObjFanin0(pNode1) && (Hop_ObjFaninC0(pNode0) ^ Hop_ObjFaninC0(pNode1))) ||
170 (Hop_ObjFanin0(pNode0) == Hop_ObjFanin1(pNode1) && (Hop_ObjFaninC0(pNode0) ^ Hop_ObjFaninC1(pNode1))) ||
171 (Hop_ObjFanin1(pNode0) == Hop_ObjFanin0(pNode1) && (Hop_ObjFaninC1(pNode0) ^ Hop_ObjFaninC0(pNode1))) ||
172 (Hop_ObjFanin1(pNode0) == Hop_ObjFanin1(pNode1) && (Hop_ObjFaninC1(pNode0) ^ Hop_ObjFaninC1(pNode1)));
173}
Here is the caller graph for this function:

◆ Hop_ObjPrintEqn()

void Hop_ObjPrintEqn ( FILE * pFile,
Hop_Obj_t * pObj,
Vec_Vec_t * vLevels,
int Level )
extern

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

Synopsis [Prints Eqn formula for the AIG rooted at this node.]

Description [The formula is in terms of PIs, which should have their names assigned in pObj->pData fields.]

SideEffects []

SeeAlso []

Definition at line 322 of file hopUtil.c.

323{
324 Vec_Ptr_t * vSuper;
325 Hop_Obj_t * pFanin;
326 int fCompl, i;
327 // store the complemented attribute
328 fCompl = Hop_IsComplement(pObj);
329 pObj = Hop_Regular(pObj);
330 // constant case
331 if ( Hop_ObjIsConst1(pObj) )
332 {
333 fprintf( pFile, "%d", !fCompl );
334 return;
335 }
336 // PI case
337 if ( Hop_ObjIsPi(pObj) )
338 {
339 fprintf( pFile, "%s%s", fCompl? "!" : "", (char*)pObj->pData );
340 return;
341 }
342 // AND case
343 Vec_VecExpand( vLevels, Level );
344 vSuper = Vec_VecEntry(vLevels, Level);
345 Hop_ObjCollectMulti( pObj, vSuper );
346 fprintf( pFile, "%s", (Level==0? "" : "(") );
347 Vec_PtrForEachEntry( Hop_Obj_t *, vSuper, pFanin, i )
348 {
349 Hop_ObjPrintEqn( pFile, Hop_NotCond(pFanin, fCompl), vLevels, Level+1 );
350 if ( i < Vec_PtrSize(vSuper) - 1 )
351 fprintf( pFile, " %s ", fCompl? "+" : "*" );
352 }
353 fprintf( pFile, "%s", (Level==0? "" : ")") );
354 return;
355}
void Hop_ObjCollectMulti(Hop_Obj_t *pRoot, Vec_Ptr_t *vSuper)
Definition hopUtil.c:133
void Hop_ObjPrintEqn(FILE *pFile, Hop_Obj_t *pObj, Vec_Vec_t *vLevels, int Level)
Definition hopUtil.c:322
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_ObjPrintVerbose()

void Hop_ObjPrintVerbose ( Hop_Obj_t * pObj,
int fHaig )
extern

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

Synopsis [Prints node in HAIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 456 of file hopUtil.c.

457{
458 assert( !Hop_IsComplement(pObj) );
459 printf( "Node %p : ", pObj );
460 if ( Hop_ObjIsConst1(pObj) )
461 printf( "constant 1" );
462 else if ( Hop_ObjIsPi(pObj) )
463 printf( "PI" );
464 else
465 printf( "AND( %p%s, %p%s )",
466 Hop_ObjFanin0(pObj), (Hop_ObjFaninC0(pObj)? "\'" : " "),
467 Hop_ObjFanin1(pObj), (Hop_ObjFaninC1(pObj)? "\'" : " ") );
468 printf( " (refs = %3d)", Hop_ObjRefs(pObj) );
469}
Here is the caller graph for this function:

◆ Hop_ObjPrintVerilog()

void Hop_ObjPrintVerilog ( FILE * pFile,
Hop_Obj_t * pObj,
Vec_Vec_t * vLevels,
int Level,
int fOnlyAnds )
extern

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

Synopsis [Prints Verilog formula for the AIG rooted at this node.]

Description [The formula is in terms of PIs, which should have their names assigned in pObj->pData fields.]

SideEffects []

SeeAlso []

Definition at line 369 of file hopUtil.c.

370{
371 Vec_Ptr_t * vSuper;
372 Hop_Obj_t * pFanin, * pFanin0, * pFanin1, * pFaninC;
373 int fCompl, i;
374 // store the complemented attribute
375 fCompl = Hop_IsComplement(pObj);
376 pObj = Hop_Regular(pObj);
377 // constant case
378 if ( Hop_ObjIsConst1(pObj) )
379 {
380 fprintf( pFile, "1\'b%d", !fCompl );
381 return;
382 }
383 // PI case
384 if ( Hop_ObjIsPi(pObj) )
385 {
386 fprintf( pFile, "%s%s", fCompl? "~" : "", (char*)pObj->pData );
387 return;
388 }
389 // EXOR case
390 if ( !fOnlyAnds && Hop_ObjIsExor(pObj) )
391 {
392 Vec_VecExpand( vLevels, Level );
393 vSuper = Vec_VecEntry( vLevels, Level );
394 Hop_ObjCollectMulti( pObj, vSuper );
395 fprintf( pFile, "%s", (Level==0? "" : "(") );
396 Vec_PtrForEachEntry( Hop_Obj_t *, vSuper, pFanin, i )
397 {
398 Hop_ObjPrintVerilog( pFile, Hop_NotCond(pFanin, (fCompl && i==0)), vLevels, Level+1, fOnlyAnds );
399 if ( i < Vec_PtrSize(vSuper) - 1 )
400 fprintf( pFile, " ^ " );
401 }
402 fprintf( pFile, "%s", (Level==0? "" : ")") );
403 return;
404 }
405 // MUX case
406 if ( !fOnlyAnds && Hop_ObjIsMuxType(pObj) )
407 {
408 if ( Hop_ObjRecognizeExor( pObj, &pFanin0, &pFanin1 ) )
409 {
410 fprintf( pFile, "%s", (Level==0? "" : "(") );
411 Hop_ObjPrintVerilog( pFile, Hop_NotCond(pFanin0, fCompl), vLevels, Level+1, fOnlyAnds );
412 fprintf( pFile, " ^ " );
413 Hop_ObjPrintVerilog( pFile, pFanin1, vLevels, Level+1, fOnlyAnds );
414 fprintf( pFile, "%s", (Level==0? "" : ")") );
415 }
416 else
417 {
418 pFaninC = Hop_ObjRecognizeMux( pObj, &pFanin1, &pFanin0 );
419 fprintf( pFile, "%s", (Level==0? "" : "(") );
420 Hop_ObjPrintVerilog( pFile, pFaninC, vLevels, Level+1, fOnlyAnds );
421 fprintf( pFile, " ? " );
422 Hop_ObjPrintVerilog( pFile, Hop_NotCond(pFanin1, fCompl), vLevels, Level+1, fOnlyAnds );
423 fprintf( pFile, " : " );
424 Hop_ObjPrintVerilog( pFile, Hop_NotCond(pFanin0, fCompl), vLevels, Level+1, fOnlyAnds );
425 fprintf( pFile, "%s", (Level==0? "" : ")") );
426 }
427 return;
428 }
429 // AND case
430 Vec_VecExpand( vLevels, Level );
431 vSuper = Vec_VecEntry(vLevels, Level);
432 Hop_ObjCollectMulti( pObj, vSuper );
433 fprintf( pFile, "%s", (Level==0? "" : "(") );
434 Vec_PtrForEachEntry( Hop_Obj_t *, vSuper, pFanin, i )
435 {
436 Hop_ObjPrintVerilog( pFile, Hop_NotCond(pFanin, fCompl), vLevels, Level+1, fOnlyAnds );
437 if ( i < Vec_PtrSize(vSuper) - 1 )
438 fprintf( pFile, " %s ", fCompl? "|" : "&" );
439 }
440 fprintf( pFile, "%s", (Level==0? "" : ")") );
441 return;
442}
Hop_Obj_t * Hop_ObjRecognizeMux(Hop_Obj_t *pNode, Hop_Obj_t **ppNodeT, Hop_Obj_t **ppNodeE)
Definition hopUtil.c:231
int Hop_ObjIsMuxType(Hop_Obj_t *pNode)
Definition hopUtil.c:151
int Hop_ObjRecognizeExor(Hop_Obj_t *pObj, Hop_Obj_t **ppFan0, Hop_Obj_t **ppFan1)
Definition hopUtil.c:187
void Hop_ObjPrintVerilog(FILE *pFile, Hop_Obj_t *pObj, Vec_Vec_t *vLevels, int Level, int fOnlyAnds)
Definition hopUtil.c:369
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_ObjRecognizeExor()

int Hop_ObjRecognizeExor ( Hop_Obj_t * pObj,
Hop_Obj_t ** ppFan0,
Hop_Obj_t ** ppFan1 )
extern

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

Synopsis [Recognizes what nodes are inputs of the EXOR.]

Description []

SideEffects []

SeeAlso []

Definition at line 187 of file hopUtil.c.

188{
189 Hop_Obj_t * p0, * p1;
190 assert( !Hop_IsComplement(pObj) );
191 if ( !Hop_ObjIsNode(pObj) )
192 return 0;
193 if ( Hop_ObjIsExor(pObj) )
194 {
195 *ppFan0 = Hop_ObjChild0(pObj);
196 *ppFan1 = Hop_ObjChild1(pObj);
197 return 1;
198 }
199 assert( Hop_ObjIsAnd(pObj) );
200 p0 = Hop_ObjChild0(pObj);
201 p1 = Hop_ObjChild1(pObj);
202 if ( !Hop_IsComplement(p0) || !Hop_IsComplement(p1) )
203 return 0;
204 p0 = Hop_Regular(p0);
205 p1 = Hop_Regular(p1);
206 if ( !Hop_ObjIsAnd(p0) || !Hop_ObjIsAnd(p1) )
207 return 0;
208 if ( Hop_ObjFanin0(p0) != Hop_ObjFanin0(p1) || Hop_ObjFanin1(p0) != Hop_ObjFanin1(p1) )
209 return 0;
210 if ( Hop_ObjFaninC0(p0) == Hop_ObjFaninC0(p1) || Hop_ObjFaninC1(p0) == Hop_ObjFaninC1(p1) )
211 return 0;
212 *ppFan0 = Hop_ObjChild0(p0);
213 *ppFan1 = Hop_ObjChild1(p0);
214 return 1;
215}
Here is the caller graph for this function:

◆ Hop_ObjRecognizeMux()

Hop_Obj_t * Hop_ObjRecognizeMux ( Hop_Obj_t * pNode,
Hop_Obj_t ** ppNodeT,
Hop_Obj_t ** ppNodeE )
extern

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

Synopsis [Recognizes what nodes are control and data inputs of a MUX.]

Description [If the node is a MUX, returns the control variable C. Assigns nodes T and E to be the then and else variables of the MUX. Node C is never complemented. Nodes T and E can be complemented. This function also recognizes EXOR/NEXOR gates as MUXes.]

SideEffects []

SeeAlso []

Definition at line 231 of file hopUtil.c.

232{
233 Hop_Obj_t * pNode0, * pNode1;
234 assert( !Hop_IsComplement(pNode) );
235 assert( Hop_ObjIsMuxType(pNode) );
236 // get children
237 pNode0 = Hop_ObjFanin0(pNode);
238 pNode1 = Hop_ObjFanin1(pNode);
239
240 // find the control variable
241 if ( Hop_ObjFanin1(pNode0) == Hop_ObjFanin1(pNode1) && (Hop_ObjFaninC1(pNode0) ^ Hop_ObjFaninC1(pNode1)) )
242 {
243// if ( Fraig_IsComplement(pNode1->p2) )
244 if ( Hop_ObjFaninC1(pNode0) )
245 { // pNode2->p2 is positive phase of C
246 *ppNodeT = Hop_Not(Hop_ObjChild0(pNode1));//pNode2->p1);
247 *ppNodeE = Hop_Not(Hop_ObjChild0(pNode0));//pNode1->p1);
248 return Hop_ObjChild1(pNode1);//pNode2->p2;
249 }
250 else
251 { // pNode1->p2 is positive phase of C
252 *ppNodeT = Hop_Not(Hop_ObjChild0(pNode0));//pNode1->p1);
253 *ppNodeE = Hop_Not(Hop_ObjChild0(pNode1));//pNode2->p1);
254 return Hop_ObjChild1(pNode0);//pNode1->p2;
255 }
256 }
257 else if ( Hop_ObjFanin0(pNode0) == Hop_ObjFanin0(pNode1) && (Hop_ObjFaninC0(pNode0) ^ Hop_ObjFaninC0(pNode1)) )
258 {
259// if ( Fraig_IsComplement(pNode1->p1) )
260 if ( Hop_ObjFaninC0(pNode0) )
261 { // pNode2->p1 is positive phase of C
262 *ppNodeT = Hop_Not(Hop_ObjChild1(pNode1));//pNode2->p2);
263 *ppNodeE = Hop_Not(Hop_ObjChild1(pNode0));//pNode1->p2);
264 return Hop_ObjChild0(pNode1);//pNode2->p1;
265 }
266 else
267 { // pNode1->p1 is positive phase of C
268 *ppNodeT = Hop_Not(Hop_ObjChild1(pNode0));//pNode1->p2);
269 *ppNodeE = Hop_Not(Hop_ObjChild1(pNode1));//pNode2->p2);
270 return Hop_ObjChild0(pNode0);//pNode1->p1;
271 }
272 }
273 else if ( Hop_ObjFanin0(pNode0) == Hop_ObjFanin1(pNode1) && (Hop_ObjFaninC0(pNode0) ^ Hop_ObjFaninC1(pNode1)) )
274 {
275// if ( Fraig_IsComplement(pNode1->p1) )
276 if ( Hop_ObjFaninC0(pNode0) )
277 { // pNode2->p2 is positive phase of C
278 *ppNodeT = Hop_Not(Hop_ObjChild0(pNode1));//pNode2->p1);
279 *ppNodeE = Hop_Not(Hop_ObjChild1(pNode0));//pNode1->p2);
280 return Hop_ObjChild1(pNode1);//pNode2->p2;
281 }
282 else
283 { // pNode1->p1 is positive phase of C
284 *ppNodeT = Hop_Not(Hop_ObjChild1(pNode0));//pNode1->p2);
285 *ppNodeE = Hop_Not(Hop_ObjChild0(pNode1));//pNode2->p1);
286 return Hop_ObjChild0(pNode0);//pNode1->p1;
287 }
288 }
289 else if ( Hop_ObjFanin1(pNode0) == Hop_ObjFanin0(pNode1) && (Hop_ObjFaninC1(pNode0) ^ Hop_ObjFaninC0(pNode1)) )
290 {
291// if ( Fraig_IsComplement(pNode1->p2) )
292 if ( Hop_ObjFaninC1(pNode0) )
293 { // pNode2->p1 is positive phase of C
294 *ppNodeT = Hop_Not(Hop_ObjChild1(pNode1));//pNode2->p2);
295 *ppNodeE = Hop_Not(Hop_ObjChild0(pNode0));//pNode1->p1);
296 return Hop_ObjChild0(pNode1);//pNode2->p1;
297 }
298 else
299 { // pNode1->p2 is positive phase of C
300 *ppNodeT = Hop_Not(Hop_ObjChild0(pNode0));//pNode1->p1);
301 *ppNodeE = Hop_Not(Hop_ObjChild1(pNode1));//pNode2->p2);
302 return Hop_ObjChild1(pNode0);//pNode1->p2;
303 }
304 }
305 assert( 0 ); // this is not MUX
306 return NULL;
307}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_ObjRepr()

Hop_Obj_t * Hop_ObjRepr ( Hop_Obj_t * pObj)
extern

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

Synopsis [Returns the representative of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 241 of file hopObj.c.

242{
243 assert( !Hop_IsComplement(pObj) );
244 if ( pObj->pData == NULL || pObj->pData == pObj )
245 return pObj;
246 return Hop_ObjRepr( (Hop_Obj_t *)pObj->pData );
247}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_Oper()

Hop_Obj_t * Hop_Oper ( Hop_Man_t * p,
Hop_Obj_t * p0,
Hop_Obj_t * p1,
Hop_Type_t Type )
extern

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

Synopsis [Perform one operation.]

Description [The argument nodes can be complemented.]

SideEffects []

SeeAlso []

Definition at line 83 of file hopOper.c.

84{
85 if ( Type == AIG_AND )
86 return Hop_And( p, p0, p1 );
87 if ( Type == AIG_EXOR )
88 return Hop_Exor( p, p0, p1 );
89 assert( 0 );
90 return NULL;
91}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_Or()

Hop_Obj_t * Hop_Or ( Hop_Man_t * p,
Hop_Obj_t * p0,
Hop_Obj_t * p1 )
extern

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

Synopsis [Implements Boolean OR.]

Description []

SideEffects []

SeeAlso []

Definition at line 171 of file hopOper.c.

172{
173 return Hop_Not( Hop_And( p, Hop_Not(p0), Hop_Not(p1) ) );
174}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_Permute()

Hop_Obj_t * Hop_Permute ( Hop_Man_t * p,
Hop_Obj_t * pRoot,
int nRootVars,
int * pPermute )
extern

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

Synopsis [Permute the AIG according to the given permutation.]

Description []

SideEffects []

SeeAlso []

Definition at line 563 of file hopDfs.c.

564{
565 Hop_Obj_t * pObj;
566 int i;
567 // return if constant
568 if ( Hop_ObjIsConst1( Hop_Regular(pRoot) ) )
569 return pRoot;
570 // create mapping
571 Hop_ManForEachPi( p, pObj, i )
572 {
573 if ( i == nRootVars )
574 break;
575 assert( pPermute[i] >= 0 && pPermute[i] < Hop_ManPiNum(p) );
576 pObj->pData = Hop_IthVar( p, pPermute[i] );
577 }
578 // recursively perform composition
579 Hop_Remap_rec( p, Hop_Regular(pRoot) );
580 // clear the markings
581 Hop_ConeUnmark_rec( Hop_Regular(pRoot) );
582 return Hop_NotCond( (Hop_Obj_t *)Hop_Regular(pRoot)->pData, Hop_IsComplement(pRoot) );
583}
void Hop_Remap_rec(Hop_Man_t *p, Hop_Obj_t *pObj)
Definition hopDfs.c:495
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition hopOper.c:63
Here is the call graph for this function:

◆ Hop_Remap()

Hop_Obj_t * Hop_Remap ( Hop_Man_t * p,
Hop_Obj_t * pRoot,
unsigned uSupp,
int nVars )
extern

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

Synopsis [Remaps the AIG (pRoot) to have the given support (uSupp).]

Description []

SideEffects []

SeeAlso []

Definition at line 518 of file hopDfs.c.

519{
520 Hop_Obj_t * pObj;
521 int i, k;
522 // quit if the PI variable is not defined
523 if ( nVars > Hop_ManPiNum(p) )
524 {
525 printf( "Hop_Remap(): The number of variables (%d) is more than the manager size (%d).\n", nVars, Hop_ManPiNum(p) );
526 return NULL;
527 }
528 // return if constant
529 if ( Hop_ObjIsConst1( Hop_Regular(pRoot) ) )
530 return pRoot;
531 if ( uSupp == 0 )
532 return Hop_NotCond( Hop_ManConst0(p), Hop_ObjPhaseCompl(pRoot) );
533 // set the PI mapping
534 k = 0;
535 Hop_ManForEachPi( p, pObj, i )
536 {
537 if ( i == nVars )
538 break;
539 if ( uSupp & (1 << i) )
540 pObj->pData = Hop_IthVar(p, k++);
541 else
542 pObj->pData = Hop_ManConst0(p);
543 }
544 assert( k > 0 && k < nVars );
545 // recursively perform composition
546 Hop_Remap_rec( p, Hop_Regular(pRoot) );
547 // clear the markings
548 Hop_ConeUnmark_rec( Hop_Regular(pRoot) );
549 return Hop_NotCond( (Hop_Obj_t *)Hop_Regular(pRoot)->pData, Hop_IsComplement(pRoot) );
550}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_TableCountEntries()

int Hop_TableCountEntries ( Hop_Man_t * p)
extern

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

Synopsis [Count the number of nodes in the table.]

Description []

SideEffects []

SeeAlso []

Definition at line 145 of file hopTable.c.

146{
147 Hop_Obj_t * pEntry;
148 int i, Counter = 0;
149 for ( i = 0; i < p->nTableSize; i++ )
150 for ( pEntry = p->pTable[i]; pEntry; pEntry = pEntry->pNext )
151 Counter++;
152 return Counter;
153}
Hop_Obj_t * pNext
Definition hop.h:71
Here is the caller graph for this function:

◆ Hop_TableDelete()

void Hop_TableDelete ( Hop_Man_t * p,
Hop_Obj_t * pObj )
extern

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

Synopsis [Deletes the node from the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 123 of file hopTable.c.

124{
125 Hop_Obj_t ** ppPlace;
126 assert( !Hop_IsComplement(pObj) );
127 ppPlace = Hop_TableFind( p, pObj );
128 assert( *ppPlace == pObj ); // node should be in the table
129 // remove the node
130 *ppPlace = pObj->pNext;
131 pObj->pNext = NULL;
132}
Here is the caller graph for this function:

◆ Hop_TableInsert()

void Hop_TableInsert ( Hop_Man_t * p,
Hop_Obj_t * pObj )
extern

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

Synopsis [Adds the new node to the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 100 of file hopTable.c.

101{
102 Hop_Obj_t ** ppPlace;
103 assert( !Hop_IsComplement(pObj) );
104 assert( Hop_TableLookup(p, pObj) == NULL );
105 if ( (pObj->Id & 0xFF) == 0 && 2 * p->nTableSize < Hop_ManNodeNum(p) )
106 Hop_TableResize( p );
107 ppPlace = Hop_TableFind( p, pObj );
108 assert( *ppPlace == NULL );
109 *ppPlace = pObj;
110}
Hop_Obj_t * Hop_TableLookup(Hop_Man_t *p, Hop_Obj_t *pGhost)
FUNCTION DEFINITIONS ///.
Definition hopTable.c:71
int Id
Definition hop.h:80
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Hop_TableLookup()

Hop_Obj_t * Hop_TableLookup ( Hop_Man_t * p,
Hop_Obj_t * pGhost )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Checks if a node with the given attributes is in the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 71 of file hopTable.c.

72{
73 Hop_Obj_t * pEntry;
74 assert( !Hop_IsComplement(pGhost) );
75 assert( Hop_ObjChild0(pGhost) && Hop_ObjChild1(pGhost) );
76 assert( Hop_ObjFanin0(pGhost)->Id < Hop_ObjFanin1(pGhost)->Id );
77 if ( p->fRefCount && (!Hop_ObjRefs(Hop_ObjFanin0(pGhost)) || !Hop_ObjRefs(Hop_ObjFanin1(pGhost))) )
78 return NULL;
79 for ( pEntry = p->pTable[Hop_Hash(pGhost, p->nTableSize)]; pEntry; pEntry = pEntry->pNext )
80 {
81 if ( Hop_ObjChild0(pEntry) == Hop_ObjChild0(pGhost) &&
82 Hop_ObjChild1(pEntry) == Hop_ObjChild1(pGhost) &&
83 Hop_ObjType(pEntry) == Hop_ObjType(pGhost) )
84 return pEntry;
85 }
86 return NULL;
87}
Here is the caller graph for this function:

◆ Hop_TableProfile()

void Hop_TableProfile ( Hop_Man_t * p)
extern

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

Synopsis [Profiles the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 212 of file hopTable.c.

213{
214 Hop_Obj_t * pEntry;
215 int i, Counter;
216 for ( i = 0; i < p->nTableSize; i++ )
217 {
218 Counter = 0;
219 for ( pEntry = p->pTable[i]; pEntry; pEntry = pEntry->pNext )
220 Counter++;
221 if ( Counter )
222 printf( "%d ", Counter );
223 }
224}

◆ Hop_Transfer()

Hop_Obj_t * Hop_Transfer ( Hop_Man_t * pSour,
Hop_Man_t * pDest,
Hop_Obj_t * pRoot,
int nVars )
extern

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

Synopsis [Transfers the AIG from one manager into another.]

Description []

SideEffects []

SeeAlso []

Definition at line 353 of file hopDfs.c.

354{
355 Hop_Obj_t * pObj;
356 int i;
357 // solve simple cases
358 if ( pSour == pDest )
359 return pRoot;
360 if ( Hop_ObjIsConst1( Hop_Regular(pRoot) ) )
361 return Hop_NotCond( Hop_ManConst1(pDest), Hop_IsComplement(pRoot) );
362 // set the PI mapping
363 Hop_ManForEachPi( pSour, pObj, i )
364 {
365 if ( i == nVars )
366 break;
367 pObj->pData = Hop_IthVar(pDest, i);
368 }
369 // transfer and set markings
370 Hop_Transfer_rec( pDest, Hop_Regular(pRoot) );
371 // clear the markings
372 Hop_ConeUnmark_rec( Hop_Regular(pRoot) );
373 return Hop_NotCond( (Hop_Obj_t *)Hop_Regular(pRoot)->pData, Hop_IsComplement(pRoot) );
374}
void Hop_Transfer_rec(Hop_Man_t *pDest, Hop_Obj_t *pObj)
Definition hopDfs.c:330
Here is the call graph for this function:
Here is the caller graph for this function: