ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
nm.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef typedefABC_NAMESPACE_HEADER_START struct Nm_Man_t_ Nm_Man_t
 INCLUDES ///.
 

Functions

Nm_Man_tNm_ManCreate (int nSize)
 MACRO DEFINITIONS ///.
 
void Nm_ManFree (Nm_Man_t *p)
 
int Nm_ManNumEntries (Nm_Man_t *p)
 
char * Nm_ManStoreIdName (Nm_Man_t *p, int ObjId, int Type, char *pName, char *pSuffix)
 
void Nm_ManDeleteIdName (Nm_Man_t *p, int ObjId)
 
char * Nm_ManCreateUniqueName (Nm_Man_t *p, int ObjId)
 
char * Nm_ManFindNameById (Nm_Man_t *p, int ObjId)
 
int Nm_ManFindIdByName (Nm_Man_t *p, char *pName, int Type)
 
int Nm_ManFindIdByNameTwoTypes (Nm_Man_t *p, char *pName, int Type1, int Type2)
 
Vec_Int_tNm_ManReturnNameIds (Nm_Man_t *p)
 

Typedef Documentation

◆ Nm_Man_t

typedef typedefABC_NAMESPACE_HEADER_START struct Nm_Man_t_ Nm_Man_t

INCLUDES ///.

CFilextern e****************************************************************

FileName [nm.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Name manager.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
nm.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

] PARAMETERS /// BASIC TYPES ///

Definition at line 63 of file nm.h.

Function Documentation

◆ Nm_ManCreate()

Nm_Man_t * Nm_ManCreate ( int nSize)
extern

MACRO DEFINITIONS ///.

FUNCTION DECLARATIONS ///

MACRO DEFINITIONS ///.

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

FileName [nmApi.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Name manager.]

Synopsis [APIs of the name manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
nmApi.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

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

Synopsis [Allocates the name manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file nmApi.c.

46{
47 Nm_Man_t * p;
48 // allocate the table
49 p = ABC_ALLOC( Nm_Man_t, 1 );
50 memset( p, 0, sizeof(Nm_Man_t) );
51 // set the parameters
52 p->nSizeFactor = 2; // determined the limit on the grow of data before the table resizes
53 p->nGrowthFactor = 3; // determined how much the table grows after resizing
54 // allocate and clean the bins
55 p->nBins = Abc_PrimeCudd(nSize);
56 p->pBinsI2N = ABC_ALLOC( Nm_Entry_t *, p->nBins );
57 p->pBinsN2I = ABC_ALLOC( Nm_Entry_t *, p->nBins );
58 memset( p->pBinsI2N, 0, sizeof(Nm_Entry_t *) * p->nBins );
59 memset( p->pBinsN2I, 0, sizeof(Nm_Entry_t *) * p->nBins );
60 // start the memory manager
61 p->pMem = Extra_MmFlexStart();
62 return p;
63}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
Cube * p
Definition exorList.c:222
Extra_MmFlex_t * Extra_MmFlexStart()
typedefABC_NAMESPACE_HEADER_START struct Nm_Entry_t_ Nm_Entry_t
INCLUDES ///.
Definition nmInt.h:46
typedefABC_NAMESPACE_HEADER_START struct Nm_Man_t_ Nm_Man_t
INCLUDES ///.
Definition nm.h:63
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Nm_ManCreateUniqueName()

char * Nm_ManCreateUniqueName ( Nm_Man_t * p,
int ObjId )
extern

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

Synopsis [Finds a unique name for the node.]

Description [If the name exists, tries appending numbers to it until it becomes unique. The name is not added to the table.]

SideEffects []

SeeAlso []

Definition at line 175 of file nmApi.c.

176{
177 static char NameStr[1000];
178 Nm_Entry_t * pEntry;
179 int i;
180 if ( (pEntry = Nm_ManTableLookupId(p, ObjId)) )
181 return pEntry->Name;
182 sprintf( NameStr, "n%d", ObjId );
183 for ( i = 1; Nm_ManTableLookupName(p, NameStr, -1); i++ )
184 sprintf( NameStr, "n%d_%d", ObjId, i );
185 return NameStr;
186}
Nm_Entry_t * Nm_ManTableLookupName(Nm_Man_t *p, char *pName, int Type)
Definition nmTable.c:191
Nm_Entry_t * Nm_ManTableLookupId(Nm_Man_t *p, int ObjId)
Definition nmTable.c:171
char * sprintf()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Nm_ManDeleteIdName()

void Nm_ManDeleteIdName ( Nm_Man_t * p,
int ObjId )
extern

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

Synopsis [Creates a new entry in the name manager.]

Description [Returns 1 if the entry with the given object ID already exists in the name manager.]

SideEffects []

SeeAlso []

Definition at line 149 of file nmApi.c.

150{
151 Nm_Entry_t * pEntry;
152 pEntry = Nm_ManTableLookupId(p, ObjId);
153 if ( pEntry == NULL )
154 {
155 printf( "Nm_ManDeleteIdName(): Entry with ID %d is not in the table.\n", ObjId );
156 return;
157 }
158 // remove entry from the table
159 Nm_ManTableDelete( p, ObjId );
160}
int Nm_ManTableDelete(Nm_Man_t *p, int ObjId)
Definition nmTable.c:112
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Nm_ManFindIdByName()

int Nm_ManFindIdByName ( Nm_Man_t * p,
char * pName,
int Type )
extern

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

Synopsis [Returns ID of the object if its name is known.]

Description [This procedure may return two IDs because POs and latches may have the same name (the only allowed case of name duplication).]

SideEffects []

SeeAlso []

Definition at line 219 of file nmApi.c.

220{
221 Nm_Entry_t * pEntry;
222 if ( (pEntry = Nm_ManTableLookupName(p, pName, Type)) )
223 return pEntry->ObjId;
224 return -1;
225}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Nm_ManFindIdByNameTwoTypes()

int Nm_ManFindIdByNameTwoTypes ( Nm_Man_t * p,
char * pName,
int Type1,
int Type2 )
extern

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

Synopsis [Returns ID of the object if its name is known.]

Description [This procedure may return two IDs because POs and latches may have the same name (the only allowed case of name duplication).]

SideEffects []

SeeAlso []

Definition at line 239 of file nmApi.c.

240{
241 int iNodeId;
242 iNodeId = Nm_ManFindIdByName( p, pName, Type1 );
243 if ( iNodeId == -1 )
244 iNodeId = Nm_ManFindIdByName( p, pName, Type2 );
245 if ( iNodeId == -1 )
246 return -1;
247 return iNodeId;
248}
int Nm_ManFindIdByName(Nm_Man_t *p, char *pName, int Type)
Definition nmApi.c:219
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Nm_ManFindNameById()

char * Nm_ManFindNameById ( Nm_Man_t * p,
int ObjId )
extern

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

Synopsis [Returns name of the object if the ID is known.]

Description []

SideEffects []

SeeAlso []

Definition at line 199 of file nmApi.c.

200{
201 Nm_Entry_t * pEntry;
202 if ( (pEntry = Nm_ManTableLookupId(p, ObjId)) )
203 return pEntry->Name;
204 return NULL;
205}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Nm_ManFree()

void Nm_ManFree ( Nm_Man_t * p)
extern

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

Synopsis [Deallocates the name manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 76 of file nmApi.c.

77{
78 Extra_MmFlexStop( p->pMem );
79 ABC_FREE( p->pBinsI2N );
80 ABC_FREE( p->pBinsN2I );
81 ABC_FREE( p );
82}
#define ABC_FREE(obj)
Definition abc_global.h:267
void Extra_MmFlexStop(Extra_MmFlex_t *p)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Nm_ManNumEntries()

int Nm_ManNumEntries ( Nm_Man_t * p)
extern

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

Synopsis [Returns the number of objects with names.]

Description []

SideEffects []

SeeAlso []

Definition at line 95 of file nmApi.c.

96{
97 return p->nEntries;
98}
Here is the caller graph for this function:

◆ Nm_ManReturnNameIds()

Vec_Int_t * Nm_ManReturnNameIds ( Nm_Man_t * p)
extern

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

Synopsis [Return the IDs of objects with names.]

Description []

SideEffects []

SeeAlso []

Definition at line 261 of file nmApi.c.

262{
263 Vec_Int_t * vNameIds;
264 int i;
265 vNameIds = Vec_IntAlloc( p->nEntries );
266 for ( i = 0; i < p->nBins; i++ )
267 if ( p->pBinsI2N[i] )
268 Vec_IntPush( vNameIds, p->pBinsI2N[i]->ObjId );
269 return vNameIds;
270}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37

◆ Nm_ManStoreIdName()

char * Nm_ManStoreIdName ( Nm_Man_t * p,
int ObjId,
int Type,
char * pName,
char * pSuffix )
extern

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

Synopsis [Creates a new entry in the name manager.]

Description [Returns 1 if the entry with the given object ID already exists in the name manager.]

SideEffects []

SeeAlso []

Definition at line 112 of file nmApi.c.

113{
114 Nm_Entry_t * pEntry;
115 int RetValue, nEntrySize;
116 // check if the object with this ID is already stored
117 if ( (pEntry = Nm_ManTableLookupId(p, ObjId)) )
118 {
119 printf( "Nm_ManStoreIdName(): Entry with ID %d already exists.\n", ObjId );
120 return NULL;
121 }
122 // create a new entry
123 nEntrySize = sizeof(Nm_Entry_t) + strlen(pName) + (pSuffix?strlen(pSuffix):0) + 1;
124// nEntrySize = (nEntrySize / 4 + ((nEntrySize % 4) > 0)) * 4;
125 nEntrySize = (nEntrySize / sizeof(char*) + ((nEntrySize % sizeof(char*)) > 0)) * sizeof(char*); // added by Saurabh on Sep 3, 2009
126 pEntry = (Nm_Entry_t *)Extra_MmFlexEntryFetch( p->pMem, nEntrySize );
127 pEntry->pNextI2N = pEntry->pNextN2I = pEntry->pNameSake = NULL;
128 pEntry->ObjId = ObjId;
129 pEntry->Type = Type;
130 sprintf( pEntry->Name, "%s%s", pName, pSuffix? pSuffix : "" );
131 // add the entry to the hash table
132 RetValue = Nm_ManTableAdd( p, pEntry );
133 assert( RetValue == 1 );
134 return pEntry->Name;
135}
char * Extra_MmFlexEntryFetch(Extra_MmFlex_t *p, int nBytes)
int Nm_ManTableAdd(Nm_Man_t *p, Nm_Entry_t *pEntry)
MACRO DEFINITIONS ///.
Definition nmTable.c:71
#define assert(ex)
Definition util_old.h:213
int strlen()
Here is the call graph for this function:
Here is the caller graph for this function: