From 4d30a1e4f1edecff86d5066ce4653a370e59e5e1 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Wed, 30 Jan 2008 08:01:00 -0800 Subject: Version abc80130 --- src/misc/nm/module.make | 2 - src/misc/nm/nm.h | 92 ------------- src/misc/nm/nmApi.c | 272 -------------------------------------- src/misc/nm/nmInt.h | 91 ------------- src/misc/nm/nmTable.c | 340 ------------------------------------------------ 5 files changed, 797 deletions(-) delete mode 100644 src/misc/nm/module.make delete mode 100644 src/misc/nm/nm.h delete mode 100644 src/misc/nm/nmApi.c delete mode 100644 src/misc/nm/nmInt.h delete mode 100644 src/misc/nm/nmTable.c (limited to 'src/misc/nm') diff --git a/src/misc/nm/module.make b/src/misc/nm/module.make deleted file mode 100644 index 2a3820c7..00000000 --- a/src/misc/nm/module.make +++ /dev/null @@ -1,2 +0,0 @@ -SRC += src/misc/nm/nmApi.c \ - src/misc/nm/nmTable.c diff --git a/src/misc/nm/nm.h b/src/misc/nm/nm.h deleted file mode 100644 index c6344bbf..00000000 --- a/src/misc/nm/nm.h +++ /dev/null @@ -1,92 +0,0 @@ -/**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 $] - -***********************************************************************/ - -#ifndef __NM_H__ -#define __NM_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - This manager is designed to store ID-to-name and name-to-ID mapping - for Boolean networks and And-Inverter Graphs. - - In a netlist, net names are unique. In this case, there is a one-to-one - mapping between IDs and names. - - In a logic network, which do not have nets, several objects may have - the same name. For example, a latch output and a primary output. - Another example, a primary input and an input to a black box. - In this case, for each ID on an object there is only one name, - but for each name may be several IDs of objects having this name. - - The name manager maps ID-to-name uniquely but it allows one name to - be mapped into several IDs. When a query to find an ID of the object - by its name is submitted, it is possible to specify the object type, - which will help select one of several IDs. If the type is -1, and - there is more than one object with the given name, any object with - the given name is returned. -*/ - -//////////////////////////////////////////////////////////////////////// -/// INCLUDES /// -//////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////// -/// PARAMETERS /// -//////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////// -/// BASIC TYPES /// -//////////////////////////////////////////////////////////////////////// - -typedef struct Nm_Man_t_ Nm_Man_t; - -//////////////////////////////////////////////////////////////////////// -/// MACRO DEFINITIONS /// -//////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////// -/// FUNCTION DECLARATIONS /// -//////////////////////////////////////////////////////////////////////// - -/*=== nmApi.c ==========================================================*/ -extern Nm_Man_t * Nm_ManCreate( int nSize ); -extern void Nm_ManFree( Nm_Man_t * p ); -extern int Nm_ManNumEntries( Nm_Man_t * p ); -extern char * Nm_ManStoreIdName( Nm_Man_t * p, int ObjId, int Type, char * pName, char * pSuffix ); -extern void Nm_ManDeleteIdName( Nm_Man_t * p, int ObjId ); -extern char * Nm_ManCreateUniqueName( Nm_Man_t * p, int ObjId ); -extern char * Nm_ManFindNameById( Nm_Man_t * p, int ObjId ); -extern int Nm_ManFindIdByName( Nm_Man_t * p, char * pName, int Type ); -extern int Nm_ManFindIdByNameTwoTypes( Nm_Man_t * p, char * pName, int Type1, int Type2 ); -extern Vec_Int_t * Nm_ManReturnNameIds( Nm_Man_t * p ); - -#ifdef __cplusplus -} -#endif - -#endif - -//////////////////////////////////////////////////////////////////////// -/// END OF FILE /// -//////////////////////////////////////////////////////////////////////// - diff --git a/src/misc/nm/nmApi.c b/src/misc/nm/nmApi.c deleted file mode 100644 index 9165922f..00000000 --- a/src/misc/nm/nmApi.c +++ /dev/null @@ -1,272 +0,0 @@ -/**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 $] - -***********************************************************************/ - -#include "nmInt.h" - -//////////////////////////////////////////////////////////////////////// -/// DECLARATIONS /// -//////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////// -/// FUNCTION DEFINITIONS /// -//////////////////////////////////////////////////////////////////////// - -/**Function************************************************************* - - Synopsis [Allocates the name manager.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -Nm_Man_t * Nm_ManCreate( int nSize ) -{ - Nm_Man_t * p; - // allocate the table - p = ALLOC( Nm_Man_t, 1 ); - memset( p, 0, sizeof(Nm_Man_t) ); - // set the parameters - p->nSizeFactor = 2; // determined the limit on the grow of data before the table resizes - p->nGrowthFactor = 3; // determined how much the table grows after resizing - // allocate and clean the bins - p->nBins = Cudd_PrimeNm(nSize); - p->pBinsI2N = ALLOC( Nm_Entry_t *, p->nBins ); - p->pBinsN2I = ALLOC( Nm_Entry_t *, p->nBins ); - memset( p->pBinsI2N, 0, sizeof(Nm_Entry_t *) * p->nBins ); - memset( p->pBinsN2I, 0, sizeof(Nm_Entry_t *) * p->nBins ); - // start the memory manager - p->pMem = Extra_MmFlexStart(); - return p; -} - -/**Function************************************************************* - - Synopsis [Deallocates the name manager.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -void Nm_ManFree( Nm_Man_t * p ) -{ - Extra_MmFlexStop( p->pMem ); - FREE( p->pBinsI2N ); - FREE( p->pBinsN2I ); - FREE( p ); -} - -/**Function************************************************************* - - Synopsis [Returns the number of objects with names.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Nm_ManNumEntries( Nm_Man_t * p ) -{ - return p->nEntries; -} - -/**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 [] - -***********************************************************************/ -char * Nm_ManStoreIdName( Nm_Man_t * p, int ObjId, int Type, char * pName, char * pSuffix ) -{ - Nm_Entry_t * pEntry; - int RetValue, nEntrySize; - // check if the object with this ID is already stored - if ( pEntry = Nm_ManTableLookupId(p, ObjId) ) - { - printf( "Nm_ManStoreIdName(): Entry with the same ID already exists.\n" ); - return NULL; - } - // create a new entry - nEntrySize = sizeof(Nm_Entry_t) + strlen(pName) + (pSuffix?strlen(pSuffix):0) + 1; - nEntrySize = (nEntrySize / 4 + ((nEntrySize % 4) > 0)) * 4; - pEntry = (Nm_Entry_t *)Extra_MmFlexEntryFetch( p->pMem, nEntrySize ); - pEntry->pNextI2N = pEntry->pNextN2I = pEntry->pNameSake = NULL; - pEntry->ObjId = ObjId; - pEntry->Type = Type; - sprintf( pEntry->Name, "%s%s", pName, pSuffix? pSuffix : "" ); - // add the entry to the hash table - RetValue = Nm_ManTableAdd( p, pEntry ); - assert( RetValue == 1 ); - return pEntry->Name; -} - -/**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 [] - -***********************************************************************/ -void Nm_ManDeleteIdName( Nm_Man_t * p, int ObjId ) -{ - Nm_Entry_t * pEntry; - pEntry = Nm_ManTableLookupId(p, ObjId); - if ( pEntry == NULL ) - { - printf( "Nm_ManDeleteIdName(): This entry is not in the table.\n" ); - return; - } - // remove entry from the table - Nm_ManTableDelete( p, ObjId ); -} - - -/**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 [] - -***********************************************************************/ -char * Nm_ManCreateUniqueName( Nm_Man_t * p, int ObjId ) -{ - static char NameStr[1000]; - Nm_Entry_t * pEntry; - int i; - if ( pEntry = Nm_ManTableLookupId(p, ObjId) ) - return pEntry->Name; - sprintf( NameStr, "n%d", ObjId ); - for ( i = 1; Nm_ManTableLookupName(p, NameStr, -1); i++ ) - sprintf( NameStr, "n%d_%d", ObjId, i ); - return NameStr; -} - -/**Function************************************************************* - - Synopsis [Returns name of the object if the ID is known.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -char * Nm_ManFindNameById( Nm_Man_t * p, int ObjId ) -{ - Nm_Entry_t * pEntry; - if ( pEntry = Nm_ManTableLookupId(p, ObjId) ) - return pEntry->Name; - return NULL; -} - -/**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 [] - -***********************************************************************/ -int Nm_ManFindIdByName( Nm_Man_t * p, char * pName, int Type ) -{ - Nm_Entry_t * pEntry; - if ( pEntry = Nm_ManTableLookupName(p, pName, Type) ) - return pEntry->ObjId; - return -1; -} - -/**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 [] - -***********************************************************************/ -int Nm_ManFindIdByNameTwoTypes( Nm_Man_t * p, char * pName, int Type1, int Type2 ) -{ - int iNodeId; - iNodeId = Nm_ManFindIdByName( p, pName, Type1 ); - if ( iNodeId == -1 ) - iNodeId = Nm_ManFindIdByName( p, pName, Type2 ); - if ( iNodeId == -1 ) - return -1; - return iNodeId; -} - -/**Function************************************************************* - - Synopsis [Return the IDs of objects with names.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -Vec_Int_t * Nm_ManReturnNameIds( Nm_Man_t * p ) -{ - Vec_Int_t * vNameIds; - int i; - vNameIds = Vec_IntAlloc( p->nEntries ); - for ( i = 0; i < p->nBins; i++ ) - if ( p->pBinsI2N[i] ) - Vec_IntPush( vNameIds, p->pBinsI2N[i]->ObjId ); - return vNameIds; -} - -//////////////////////////////////////////////////////////////////////// -/// END OF FILE /// -//////////////////////////////////////////////////////////////////////// - - diff --git a/src/misc/nm/nmInt.h b/src/misc/nm/nmInt.h deleted file mode 100644 index 028316e1..00000000 --- a/src/misc/nm/nmInt.h +++ /dev/null @@ -1,91 +0,0 @@ -/**CFile**************************************************************** - - FileName [nmInt.h] - - SystemName [ABC: Logic synthesis and verification system.] - - PackageName [Name manager.] - - Synopsis [Internal declarations.] - - Author [Alan Mishchenko] - - Affiliation [UC Berkeley] - - Date [Ver. 1.0. Started - June 20, 2005.] - - Revision [$Id: nmInt.h,v 1.00 2005/06/20 00:00:00 alanmi Exp $] - -***********************************************************************/ - -#ifndef __NM_INT_H__ -#define __NM_INT_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -//////////////////////////////////////////////////////////////////////// -/// INCLUDES /// -//////////////////////////////////////////////////////////////////////// - -#include "extra.h" -#include "vec.h" -#include "nm.h" - -//////////////////////////////////////////////////////////////////////// -/// PARAMETERS /// -//////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////// -/// BASIC TYPES /// -//////////////////////////////////////////////////////////////////////// - -typedef struct Nm_Entry_t_ Nm_Entry_t; -struct Nm_Entry_t_ -{ - unsigned Type : 4; // object type - unsigned ObjId : 28; // object ID - Nm_Entry_t * pNextI2N; // the next entry in the ID hash table - Nm_Entry_t * pNextN2I; // the next entry in the name hash table - Nm_Entry_t * pNameSake; // the next entry with the same name - char Name[0]; // name of the object -}; - -struct Nm_Man_t_ -{ - Nm_Entry_t ** pBinsI2N; // mapping IDs into names - Nm_Entry_t ** pBinsN2I; // mapping names into IDs - int nBins; // the number of bins in tables - int nEntries; // the number of entries - int nSizeFactor; // determined how much larger the table should be - int nGrowthFactor; // determined how much the table grows after resizing - Extra_MmFlex_t * pMem; // memory manager for entries (and names) -}; - -//////////////////////////////////////////////////////////////////////// -/// MACRO DEFINITIONS /// -//////////////////////////////////////////////////////////////////////// - -//////////////////////////////////////////////////////////////////////// -/// FUNCTION DECLARATIONS /// -//////////////////////////////////////////////////////////////////////// - -/*=== nmTable.c ==========================================================*/ -extern int Nm_ManTableAdd( Nm_Man_t * p, Nm_Entry_t * pEntry ); -extern int Nm_ManTableDelete( Nm_Man_t * p, int ObjId ); -extern Nm_Entry_t * Nm_ManTableLookupId( Nm_Man_t * p, int ObjId ); -extern Nm_Entry_t * Nm_ManTableLookupName( Nm_Man_t * p, char * pName, int Type ); -extern unsigned int Cudd_PrimeNm( unsigned int p ); - -#ifdef __cplusplus -} -#endif - -#endif - -//////////////////////////////////////////////////////////////////////// -/// END OF FILE /// -//////////////////////////////////////////////////////////////////////// - - diff --git a/src/misc/nm/nmTable.c b/src/misc/nm/nmTable.c deleted file mode 100644 index f97a2f0b..00000000 --- a/src/misc/nm/nmTable.c +++ /dev/null @@ -1,340 +0,0 @@ -/**CFile**************************************************************** - - FileName [nmTable.c] - - SystemName [ABC: Logic synthesis and verification system.] - - PackageName [Name manager.] - - Synopsis [Hash table for the name manager.] - - Author [Alan Mishchenko] - - Affiliation [UC Berkeley] - - Date [Ver. 1.0. Started - June 20, 2005.] - - Revision [$Id: nmTable.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $] - -***********************************************************************/ - -#include "nmInt.h" - -//////////////////////////////////////////////////////////////////////// -/// DECLARATIONS /// -//////////////////////////////////////////////////////////////////////// - -// hashing for integers -static unsigned Nm_HashNumber( int Num, int TableSize ) -{ - unsigned Key = 0; - Key ^= ( Num & 0xFF) * 7937; - Key ^= ((Num >> 8) & 0xFF) * 2971; - Key ^= ((Num >> 16) & 0xFF) * 911; - Key ^= ((Num >> 24) & 0xFF) * 353; - return Key % TableSize; -} - -// hashing for strings -static unsigned Nm_HashString( char * pName, int TableSize ) -{ - static int s_Primes[10] = { - 1291, 1699, 2357, 4177, 5147, - 5647, 6343, 7103, 7873, 8147 - }; - unsigned i, Key = 0; - for ( i = 0; pName[i] != '\0'; i++ ) - Key ^= s_Primes[i%10]*pName[i]*pName[i]; - return Key % TableSize; -} - -static void Nm_ManResize( Nm_Man_t * p ); - -//////////////////////////////////////////////////////////////////////// -/// FUNCTION DEFINITIONS /// -//////////////////////////////////////////////////////////////////////// - -/**Function************************************************************* - - Synopsis [Adds an entry to two hash tables.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Nm_ManTableAdd( Nm_Man_t * p, Nm_Entry_t * pEntry ) -{ - Nm_Entry_t ** ppSpot, * pOther; - // resize the tables if needed - if ( p->nEntries > p->nBins * p->nSizeFactor ) - Nm_ManResize( p ); - // add the entry to the table Id->Name - assert( Nm_ManTableLookupId(p, pEntry->ObjId) == NULL ); - ppSpot = p->pBinsI2N + Nm_HashNumber(pEntry->ObjId, p->nBins); - pEntry->pNextI2N = *ppSpot; - *ppSpot = pEntry; - // check if an entry with the same name already exists - if ( pOther = Nm_ManTableLookupName(p, pEntry->Name, -1) ) - { - // entry with the same name already exists - add it to the ring - pEntry->pNameSake = pOther->pNameSake? pOther->pNameSake : pOther; - pOther->pNameSake = pEntry; - } - else - { - // entry with the same name does not exist - add it to the table - ppSpot = p->pBinsN2I + Nm_HashString(pEntry->Name, p->nBins); - pEntry->pNextN2I = *ppSpot; - *ppSpot = pEntry; - } - // report successfully added entry - p->nEntries++; - return 1; -} - -/**Function************************************************************* - - Synopsis [Deletes the entry from two hash tables.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -int Nm_ManTableDelete( Nm_Man_t * p, int ObjId ) -{ - Nm_Entry_t ** ppSpot, * pEntry, * pPrev; - int fRemoved; - p->nEntries--; - // remove the entry from the table Id->Name - assert( Nm_ManTableLookupId(p, ObjId) != NULL ); - ppSpot = p->pBinsI2N + Nm_HashNumber(ObjId, p->nBins); - while ( (*ppSpot)->ObjId != (unsigned)ObjId ) - ppSpot = &(*ppSpot)->pNextI2N; - pEntry = *ppSpot; - *ppSpot = (*ppSpot)->pNextI2N; - // remove the entry from the table Name->Id - ppSpot = p->pBinsN2I + Nm_HashString(pEntry->Name, p->nBins); - while ( *ppSpot && *ppSpot != pEntry ) - ppSpot = &(*ppSpot)->pNextN2I; - // remember if we found this one in the list - fRemoved = (*ppSpot != NULL); - if ( *ppSpot ) - { - assert( *ppSpot == pEntry ); - *ppSpot = (*ppSpot)->pNextN2I; - } - // quit if this entry has no namesakes - if ( pEntry->pNameSake == NULL ) - { - assert( fRemoved ); - return 1; - } - // remove entry from the ring of namesakes - assert( pEntry->pNameSake != pEntry ); - for ( pPrev = pEntry; pPrev->pNameSake != pEntry; pPrev = pPrev->pNameSake ); - assert( !strcmp(pPrev->Name, pEntry->Name) ); - assert( pPrev->pNameSake == pEntry ); - if ( pEntry->pNameSake == pPrev ) // two entries in the ring - pPrev->pNameSake = NULL; - else - pPrev->pNameSake = pEntry->pNameSake; - // reinsert the ring back if we removed its connection with the list in the table - if ( fRemoved ) - { - assert( pPrev->pNextN2I == NULL ); - pPrev->pNextN2I = *ppSpot; - *ppSpot = pPrev; - } - return 1; -} - -/**Function************************************************************* - - Synopsis [Looks up the entry by ID.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -Nm_Entry_t * Nm_ManTableLookupId( Nm_Man_t * p, int ObjId ) -{ - Nm_Entry_t * pEntry; - for ( pEntry = p->pBinsI2N[ Nm_HashNumber(ObjId, p->nBins) ]; pEntry; pEntry = pEntry->pNextI2N ) - if ( pEntry->ObjId == (unsigned)ObjId ) - return pEntry; - return NULL; -} - -/**Function************************************************************* - - Synopsis [Looks up the entry by name and type.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -Nm_Entry_t * Nm_ManTableLookupName( Nm_Man_t * p, char * pName, int Type ) -{ - Nm_Entry_t * pEntry, * pTemp; - int Counter = 0; - for ( pEntry = p->pBinsN2I[ Nm_HashString(pName, p->nBins) ]; pEntry; pEntry = pEntry->pNextN2I ) - { - // check the entry itself - if ( !strcmp(pEntry->Name, pName) && (Type == -1 || pEntry->Type == (unsigned)Type) ) - return pEntry; - // if there is no namesakes, continue - if ( pEntry->pNameSake == NULL ) - continue; - // check the list of namesakes - for ( pTemp = pEntry->pNameSake; pTemp != pEntry; pTemp = pTemp->pNameSake ) - if ( !strcmp(pTemp->Name, pName) && (Type == -1 || pTemp->Type == (unsigned)Type) ) - return pTemp; - } - return NULL; -} - -/**Function************************************************************* - - Synopsis [Profiles hash tables.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -void Nm_ManProfile( Nm_Man_t * p ) -{ - Nm_Entry_t * pEntry; - int Counter, e; - printf( "I2N table: " ); - for ( e = 0; e < p->nBins; e++ ) - { - Counter = 0; - for ( pEntry = p->pBinsI2N[e]; pEntry; pEntry = pEntry->pNextI2N ) - Counter++; - printf( "%d ", Counter ); - } - printf( "\n" ); - printf( "N2I table: " ); - for ( e = 0; e < p->nBins; e++ ) - { - Counter = 0; - for ( pEntry = p->pBinsN2I[e]; pEntry; pEntry = pEntry->pNextN2I ) - Counter++; - printf( "%d ", Counter ); - } - printf( "\n" ); -} - -/**Function************************************************************* - - Synopsis [Resizes the table.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -void Nm_ManResize( Nm_Man_t * p ) -{ - Nm_Entry_t ** pBinsNewI2N, ** pBinsNewN2I, * pEntry, * pEntry2, ** ppSpot; - int nBinsNew, Counter, e, clk; - -clk = clock(); - // get the new table size - nBinsNew = Cudd_PrimeCopy( p->nGrowthFactor * p->nBins ); - // allocate a new array - pBinsNewI2N = ALLOC( Nm_Entry_t *, nBinsNew ); - pBinsNewN2I = ALLOC( Nm_Entry_t *, nBinsNew ); - memset( pBinsNewI2N, 0, sizeof(Nm_Entry_t *) * nBinsNew ); - memset( pBinsNewN2I, 0, sizeof(Nm_Entry_t *) * nBinsNew ); - // rehash entries in Id->Name table - Counter = 0; - for ( e = 0; e < p->nBins; e++ ) - for ( pEntry = p->pBinsI2N[e], pEntry2 = pEntry? pEntry->pNextI2N : NULL; - pEntry; pEntry = pEntry2, pEntry2 = pEntry? pEntry->pNextI2N : NULL ) - { - ppSpot = pBinsNewI2N + Nm_HashNumber(pEntry->ObjId, nBinsNew); - pEntry->pNextI2N = *ppSpot; - *ppSpot = pEntry; - Counter++; - } - // rehash entries in Name->Id table - for ( e = 0; e < p->nBins; e++ ) - for ( pEntry = p->pBinsN2I[e], pEntry2 = pEntry? pEntry->pNextN2I : NULL; - pEntry; pEntry = pEntry2, pEntry2 = pEntry? pEntry->pNextN2I : NULL ) - { - ppSpot = pBinsNewN2I + Nm_HashString(pEntry->Name, nBinsNew); - pEntry->pNextN2I = *ppSpot; - *ppSpot = pEntry; - } - assert( Counter == p->nEntries ); -// printf( "Increasing the structural table size from %6d to %6d. ", p->nBins, nBinsNew ); -// PRT( "Time", clock() - clk ); - // replace the table and the parameters - free( p->pBinsI2N ); - free( p->pBinsN2I ); - p->pBinsI2N = pBinsNewI2N; - p->pBinsN2I = pBinsNewN2I; - p->nBins = nBinsNew; -// Nm_ManProfile( p ); -} - - -/**Function************************************************************* - - Synopsis [Returns the smallest prime larger than the number.] - - Description [] - - SideEffects [] - - SeeAlso [] - -***********************************************************************/ -unsigned int Cudd_PrimeNm( unsigned int p) -{ - int i,pn; - - p--; - do { - p++; - if (p&1) { - pn = 1; - i = 3; - while ((unsigned) (i * i) <= p) { - if (p % i == 0) { - pn = 0; - break; - } - i += 2; - } - } else { - pn = 0; - } - } while (!pn); - return(p); - -} /* end of Cudd_Prime */ - -//////////////////////////////////////////////////////////////////////// -/// END OF FILE /// -//////////////////////////////////////////////////////////////////////// - - -- cgit v1.2.3