ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
ivyTable.c File Reference
#include "ivy.h"
Include dependency graph for ivyTable.c:

Go to the source code of this file.

Functions

Ivy_Obj_tIvy_TableLookup (Ivy_Man_t *p, Ivy_Obj_t *pObj)
 FUNCTION DEFINITIONS ///.
 
void Ivy_TableInsert (Ivy_Man_t *p, Ivy_Obj_t *pObj)
 
void Ivy_TableDelete (Ivy_Man_t *p, Ivy_Obj_t *pObj)
 
void Ivy_TableUpdate (Ivy_Man_t *p, Ivy_Obj_t *pObj, int ObjIdNew)
 
int Ivy_TableCountEntries (Ivy_Man_t *p)
 
void Ivy_TableProfile (Ivy_Man_t *p)
 

Function Documentation

◆ Ivy_TableCountEntries()

int Ivy_TableCountEntries ( Ivy_Man_t * p)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 187 of file ivyTable.c.

188{
189 int i, Counter = 0;
190 for ( i = 0; i < p->nTableSize; i++ )
191 Counter += (p->pTable[i] != 0);
192 return Counter;
193}
Cube * p
Definition exorList.c:222
Here is the caller graph for this function:

◆ Ivy_TableDelete()

void Ivy_TableDelete ( Ivy_Man_t * p,
Ivy_Obj_t * pObj )

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

Synopsis [Deletes the node from the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 132 of file ivyTable.c.

133{
134 Ivy_Obj_t * pEntry;
135 int i, * pPlace;
136 assert( !Ivy_IsComplement(pObj) );
137 if ( !Ivy_ObjIsHash(pObj) )
138 return;
139 pPlace = Ivy_TableFind( p, pObj );
140 assert( *pPlace == pObj->Id ); // node should be in the table
141 *pPlace = 0;
142 // rehash the adjacent entries
143 i = pPlace - p->pTable;
144 for ( i = (i+1) % p->nTableSize; p->pTable[i]; i = (i+1) % p->nTableSize )
145 {
146 pEntry = Ivy_ManObj( p, p->pTable[i] );
147 p->pTable[i] = 0;
148 Ivy_TableInsert( p, pEntry );
149 }
150}
void Ivy_TableInsert(Ivy_Man_t *p, Ivy_Obj_t *pObj)
Definition ivyTable.c:105
struct Ivy_Obj_t_ Ivy_Obj_t
Definition ivy.h:47
int Id
Definition ivy.h:75
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ivy_TableInsert()

void Ivy_TableInsert ( Ivy_Man_t * p,
Ivy_Obj_t * pObj )

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

Synopsis [Adds the node to the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 105 of file ivyTable.c.

106{
107 int * pPlace;
108 assert( !Ivy_IsComplement(pObj) );
109 if ( !Ivy_ObjIsHash(pObj) )
110 return;
111 if ( (pObj->Id & 63) == 0 )
112 {
113 if ( p->nTableSize < 2 * Ivy_ManHashObjNum(p) )
114 Ivy_TableResize( p );
115 }
116 pPlace = Ivy_TableFind( p, pObj );
117 assert( *pPlace == 0 );
118 *pPlace = pObj->Id;
119}
Here is the caller graph for this function:

◆ Ivy_TableLookup()

Ivy_Obj_t * Ivy_TableLookup ( Ivy_Man_t * p,
Ivy_Obj_t * pObj )

FUNCTION DEFINITIONS ///.

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 71 of file ivyTable.c.

72{
73 Ivy_Obj_t * pEntry;
74 int i;
75 assert( !Ivy_IsComplement(pObj) );
76 if ( !Ivy_ObjIsHash(pObj) )
77 return NULL;
78 assert( Ivy_ObjIsLatch(pObj) || Ivy_ObjFaninId0(pObj) > 0 );
79 assert( Ivy_ObjFaninId1(pObj) == 0 || Ivy_ObjFaninId0(pObj) < Ivy_ObjFaninId1(pObj) );
80 if ( Ivy_ObjFanin0(pObj)->nRefs == 0 || (Ivy_ObjChild1(pObj) && Ivy_ObjFanin1(pObj)->nRefs == 0) )
81 return NULL;
82 for ( i = Ivy_Hash(pObj, p->nTableSize); p->pTable[i]; i = (i+1) % p->nTableSize )
83 {
84 pEntry = Ivy_ManObj( p, p->pTable[i] );
85 if ( Ivy_ObjChild0(pEntry) == Ivy_ObjChild0(pObj) &&
86 Ivy_ObjChild1(pEntry) == Ivy_ObjChild1(pObj) &&
87 Ivy_ObjInit(pEntry) == Ivy_ObjInit(pObj) &&
88 Ivy_ObjType(pEntry) == Ivy_ObjType(pObj) )
89 return pEntry;
90 }
91 return NULL;
92}
Here is the caller graph for this function:

◆ Ivy_TableProfile()

void Ivy_TableProfile ( Ivy_Man_t * p)

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

Synopsis [Profiles the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 250 of file ivyTable.c.

251{
252 int i, Counter = 0;
253 for ( i = 0; i < p->nTableSize; i++ )
254 {
255 if ( p->pTable[i] )
256 Counter++;
257 else if ( Counter )
258 {
259 printf( "%d ", Counter );
260 Counter = 0;
261 }
262 }
263}

◆ Ivy_TableUpdate()

void Ivy_TableUpdate ( Ivy_Man_t * p,
Ivy_Obj_t * pObj,
int ObjIdNew )

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

Synopsis [Updates the table to point to the new node.]

Description [If the old node (pObj) is in the table, updates the table to point to an object with different ID (ObjIdNew). The table should not contain an object with ObjIdNew (this is currently not checked).]

SideEffects []

SeeAlso []

Definition at line 165 of file ivyTable.c.

166{
167 int * pPlace;
168 assert( !Ivy_IsComplement(pObj) );
169 if ( !Ivy_ObjIsHash(pObj) )
170 return;
171 pPlace = Ivy_TableFind( p, pObj );
172 assert( *pPlace == pObj->Id ); // node should be in the table
173 *pPlace = ObjIdNew;
174}
Here is the caller graph for this function: