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

Go to the source code of this file.

Functions

void Aig_TableResize (Aig_Man_t *p)
 FUNCTION DEFINITIONS ///.
 
Aig_Obj_tAig_TableLookup (Aig_Man_t *p, Aig_Obj_t *pGhost)
 
Aig_Obj_tAig_TableLookupTwo (Aig_Man_t *p, Aig_Obj_t *pFanin0, Aig_Obj_t *pFanin1)
 
void Aig_TableInsert (Aig_Man_t *p, Aig_Obj_t *pObj)
 
void Aig_TableDelete (Aig_Man_t *p, Aig_Obj_t *pObj)
 
int Aig_TableCountEntries (Aig_Man_t *p)
 
void Aig_TableProfile (Aig_Man_t *p)
 
void Aig_TableClear (Aig_Man_t *p)
 

Function Documentation

◆ Aig_TableClear()

void Aig_TableClear ( Aig_Man_t * p)

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

Synopsis [Profiles the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 265 of file aigTable.c.

266{
267 ABC_FREE( p->pTable );
268 p->nTableSize = 0;
269}
#define ABC_FREE(obj)
Definition abc_global.h:267
Cube * p
Definition exorList.c:222
Here is the caller graph for this function:

◆ Aig_TableCountEntries()

int Aig_TableCountEntries ( Aig_Man_t * p)

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 218 of file aigTable.c.

219{
220 Aig_Obj_t * pEntry;
221 int i, Counter = 0;
222 for ( i = 0; i < p->nTableSize; i++ )
223 for ( pEntry = p->pTable[i]; pEntry; pEntry = pEntry->pNext )
224 Counter++;
225 return Counter;
226}
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
Aig_Obj_t * pNext
Definition aig.h:72
Here is the caller graph for this function:

◆ Aig_TableDelete()

void Aig_TableDelete ( Aig_Man_t * p,
Aig_Obj_t * pObj )

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

Synopsis [Deletes the node from the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 196 of file aigTable.c.

197{
198 Aig_Obj_t ** ppPlace;
199 assert( !Aig_IsComplement(pObj) );
200 ppPlace = Aig_TableFind( p, pObj );
201 assert( *ppPlace == pObj ); // node should be in the table
202 // remove the node
203 *ppPlace = pObj->pNext;
204 pObj->pNext = NULL;
205}
#define assert(ex)
Definition util_old.h:213
Here is the caller graph for this function:

◆ Aig_TableInsert()

void Aig_TableInsert ( Aig_Man_t * p,
Aig_Obj_t * pObj )

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 173 of file aigTable.c.

174{
175 Aig_Obj_t ** ppPlace;
176 assert( !Aig_IsComplement(pObj) );
177 assert( Aig_TableLookup(p, pObj) == NULL );
178 if ( (pObj->Id & 0xFF) == 0 && 2 * p->nTableSize < Aig_ManNodeNum(p) )
180 ppPlace = Aig_TableFind( p, pObj );
181 assert( *ppPlace == NULL );
182 *ppPlace = pObj;
183}
void Aig_TableResize(Aig_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition aigTable.c:69
Aig_Obj_t * Aig_TableLookup(Aig_Man_t *p, Aig_Obj_t *pGhost)
Definition aigTable.c:116
int Id
Definition aig.h:85
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Aig_TableLookup()

Aig_Obj_t * Aig_TableLookup ( Aig_Man_t * p,
Aig_Obj_t * pGhost )

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 116 of file aigTable.c.

117{
118 Aig_Obj_t * pEntry;
119 assert( !Aig_IsComplement(pGhost) );
120 assert( Aig_ObjIsNode(pGhost) );
121 assert( Aig_ObjChild0(pGhost) && Aig_ObjChild1(pGhost) );
122 assert( Aig_ObjFanin0(pGhost)->Id < Aig_ObjFanin1(pGhost)->Id );
123 if ( p->pTable == NULL || !Aig_ObjRefs(Aig_ObjFanin0(pGhost)) || !Aig_ObjRefs(Aig_ObjFanin1(pGhost)) )
124 return NULL;
125 for ( pEntry = p->pTable[Aig_Hash(pGhost, p->nTableSize)]; pEntry; pEntry = pEntry->pNext )
126 {
127 if ( Aig_ObjChild0(pEntry) == Aig_ObjChild0(pGhost) &&
128 Aig_ObjChild1(pEntry) == Aig_ObjChild1(pGhost) &&
129 Aig_ObjType(pEntry) == Aig_ObjType(pGhost) )
130 return pEntry;
131 }
132 return NULL;
133}
Here is the caller graph for this function:

◆ Aig_TableLookupTwo()

Aig_Obj_t * Aig_TableLookupTwo ( Aig_Man_t * p,
Aig_Obj_t * pFanin0,
Aig_Obj_t * pFanin1 )

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 146 of file aigTable.c.

147{
148 Aig_Obj_t * pGhost;
149 // consider simple cases
150 if ( pFanin0 == pFanin1 )
151 return pFanin0;
152 if ( pFanin0 == Aig_Not(pFanin1) )
153 return Aig_ManConst0(p);
154 if ( Aig_Regular(pFanin0) == Aig_ManConst1(p) )
155 return pFanin0 == Aig_ManConst1(p) ? pFanin1 : Aig_ManConst0(p);
156 if ( Aig_Regular(pFanin1) == Aig_ManConst1(p) )
157 return pFanin1 == Aig_ManConst1(p) ? pFanin0 : Aig_ManConst0(p);
158 pGhost = Aig_ObjCreateGhost( p, pFanin0, pFanin1, AIG_OBJ_AND );
159 return Aig_TableLookup( p, pGhost );
160}
@ AIG_OBJ_AND
Definition aig.h:63
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Aig_TableProfile()

void Aig_TableProfile ( Aig_Man_t * p)

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

Synopsis [Profiles the hash table.]

Description []

SideEffects []

SeeAlso []

Definition at line 239 of file aigTable.c.

240{
241 Aig_Obj_t * pEntry;
242 int i, Counter;
243 printf( "Table size = %d. Entries = %d.\n", p->nTableSize, Aig_ManNodeNum(p) );
244 for ( i = 0; i < p->nTableSize; i++ )
245 {
246 Counter = 0;
247 for ( pEntry = p->pTable[i]; pEntry; pEntry = pEntry->pNext )
248 Counter++;
249 if ( Counter )
250 printf( "%d ", Counter );
251 }
252}

◆ Aig_TableResize()

void Aig_TableResize ( Aig_Man_t * p)

FUNCTION DEFINITIONS ///.

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

Synopsis [Resizes the table.]

Description [Typically this procedure should not be called.]

SideEffects []

SeeAlso []

Definition at line 69 of file aigTable.c.

70{
71 Aig_Obj_t * pEntry, * pNext;
72 Aig_Obj_t ** pTableOld, ** ppPlace;
73 int nTableSizeOld, Counter, i;
74 abctime clk;
75 assert( p->pTable != NULL );
76clk = Abc_Clock();
77 // save the old table
78 pTableOld = p->pTable;
79 nTableSizeOld = p->nTableSize;
80 // get the new table
81 p->nTableSize = Abc_PrimeCudd( 2 * Aig_ManNodeNum(p) );
82 p->pTable = ABC_ALLOC( Aig_Obj_t *, p->nTableSize );
83 memset( p->pTable, 0, sizeof(Aig_Obj_t *) * p->nTableSize );
84 // rehash the entries from the old table
85 Counter = 0;
86 for ( i = 0; i < nTableSizeOld; i++ )
87 for ( pEntry = pTableOld[i], pNext = pEntry? pEntry->pNext : NULL;
88 pEntry; pEntry = pNext, pNext = pEntry? pEntry->pNext : NULL )
89 {
90 // get the place where this entry goes in the table
91 ppPlace = Aig_TableFind( p, pEntry );
92 assert( *ppPlace == NULL ); // should not be there
93 // add the entry to the list
94 *ppPlace = pEntry;
95 pEntry->pNext = NULL;
96 Counter++;
97 }
98 assert( Counter == Aig_ManNodeNum(p) );
99// printf( "Increasing the structural table size from %6d to %6d. ", nTableSizeOld, p->nTableSize );
100// ABC_PRT( "Time", Abc_Clock() - clk );
101 // replace the table and the parameters
102 ABC_FREE( pTableOld );
103}
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function: