/**Function************************************************************* Synopsis [Resizes the table.] Description [Typically this procedure should not be called.] SideEffects [] SeeAlso [] ***********************************************************************/ void Ivy_TableResize( Ivy_Man_t * p ) { int * pTableOld, * pPlace; int nTableSizeOld, Counter, nEntries, e; abctime clk; clk = Abc_Clock(); // save the old table pTableOld = p->pTable; nTableSizeOld = p->nTableSize; // get the new table p->nTableSize = Abc_PrimeCudd( 5 * Ivy_ManHashObjNum(p) ); p->pTable = ABC_ALLOC( int, p->nTableSize ); memset( p->pTable, 0, sizeof(int) * p->nTableSize ); // rehash the entries from the old table Counter = 0; for ( e = 0; e < nTableSizeOld; e++ ) { if ( pTableOld[e] == 0 ) continue; Counter++; // get the place where this entry goes in the table table pPlace = Ivy_TableFind( p, Ivy_ManObj(p, pTableOld[e]) ); assert( *pPlace == 0 ); // should not be in the table *pPlace = pTableOld[e]; } nEntries = Ivy_ManHashObjNum(p); // assert( Counter == nEntries ); // printf( "Increasing the structural table size from %6d to %6d. ", nTableSizeOld, p->nTableSize ); // ABC_PRT( "Time", Abc_Clock() - clk ); // replace the table and the parameters ABC_FREE( pTableOld ); }
/**Function************************************************************* Synopsis [Resizes the table.] Description [Typically this procedure should not be called.] SideEffects [] SeeAlso [] ***********************************************************************/ void Hop_TableResize( Hop_Man_t * p ) { Hop_Obj_t * pEntry, * pNext; Hop_Obj_t ** pTableOld, ** ppPlace; int nTableSizeOld, Counter, nEntries, i; abctime clk; clk = Abc_Clock(); // save the old table pTableOld = p->pTable; nTableSizeOld = p->nTableSize; // get the new table p->nTableSize = Abc_PrimeCudd( 2 * Hop_ManNodeNum(p) ); p->pTable = ABC_ALLOC( Hop_Obj_t *, p->nTableSize ); memset( p->pTable, 0, sizeof(Hop_Obj_t *) * p->nTableSize ); // rehash the entries from the old table Counter = 0; for ( i = 0; i < nTableSizeOld; i++ ) for ( pEntry = pTableOld[i], pNext = pEntry? pEntry->pNext : NULL; pEntry; pEntry = pNext, pNext = pEntry? pEntry->pNext : NULL ) { // get the place where this entry goes in the table ppPlace = Hop_TableFind( p, pEntry ); assert( *ppPlace == NULL ); // should not be there // add the entry to the list *ppPlace = pEntry; pEntry->pNext = NULL; Counter++; } nEntries = Hop_ManNodeNum(p); assert( Counter == nEntries ); // printf( "Increasing the structural table size from %6d to %6d. ", nTableSizeOld, p->nTableSize ); // ABC_PRT( "Time", Abc_Clock() - clk ); // replace the table and the parameters ABC_FREE( pTableOld ); }
/**Function************************************************************* Synopsis [Create the unique table of AND gates.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Map_TableCreate( Map_Man_t * pMan ) { assert( pMan->pBins == NULL ); pMan->nBins = Abc_PrimeCudd(5000); pMan->pBins = ABC_ALLOC( Map_Node_t *, pMan->nBins ); memset( pMan->pBins, 0, sizeof(Map_Node_t *) * pMan->nBins ); pMan->nNodes = 0; }
void Abc_SclHashCells( SC_Lib * p ) { SC_Cell * pCell; int i, * pPlace; assert( p->nBins == 0 ); p->nBins = Abc_PrimeCudd( 5 * SC_LibCellNum(p) ); p->pBins = ABC_FALLOC( int, p->nBins ); SC_LibForEachCell( p, pCell, i ) { pPlace = Abc_SclHashLookup( p, pCell->pName ); assert( *pPlace == -1 ); *pPlace = i; }
/**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; clock_t clk; clk = clock(); // get the new table size nBinsNew = Abc_PrimeCudd( p->nGrowthFactor * p->nBins ); // allocate a new array pBinsNewI2N = ABC_ALLOC( Nm_Entry_t *, nBinsNew ); pBinsNewN2I = ABC_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 ); // ABC_PRT( "Time", clock() - clk ); // replace the table and the parameters ABC_FREE( p->pBinsI2N ); ABC_FREE( p->pBinsN2I ); p->pBinsI2N = pBinsNewI2N; p->pBinsN2I = pBinsNewN2I; p->nBins = nBinsNew; // Nm_ManProfile( p ); }
/**Function******************************************************************** Synopsis [(Re)allocates the local cache.] Description [] SideEffects [] SeeAlso [] ******************************************************************************/ void Dsd_CheckCacheAllocate( int nEntries ) { int nRequested; pCache = ABC_ALLOC( Dds_Cache_t, 1 ); memset( pCache, 0, sizeof(Dds_Cache_t) ); // check what is the size of the current cache nRequested = Abc_PrimeCudd( nEntries ); if ( pCache->nTableSize != nRequested ) { // the current size is different // deallocate the old, allocate the new if ( pCache->nTableSize ) Dsd_CheckCacheDeallocate(); // allocate memory for the hash table pCache->nTableSize = nRequested; pCache->pTable = ABC_ALLOC( Dsd_Entry_t, nRequested ); } // otherwise, there is no need to allocate, just clean Dsd_CheckCacheClear(); // printf( "\nThe number of allocated cache entries = %d.\n\n", pCache->nTableSize ); }
/**Function************************************************************* Synopsis [Resizes the table.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Map_TableResize( Map_Man_t * pMan ) { Map_Node_t ** pBinsNew; Map_Node_t * pEnt, * pEnt2; int nBinsNew, Counter, i; abctime clk; unsigned Key; clk = Abc_Clock(); // get the new table size nBinsNew = Abc_PrimeCudd(2 * pMan->nBins); // allocate a new array pBinsNew = ABC_ALLOC( Map_Node_t *, nBinsNew ); memset( pBinsNew, 0, sizeof(Map_Node_t *) * nBinsNew ); // rehash the entries from the old table Counter = 0; for ( i = 0; i < pMan->nBins; i++ ) for ( pEnt = pMan->pBins[i], pEnt2 = pEnt? pEnt->pNext: NULL; pEnt; pEnt = pEnt2, pEnt2 = pEnt? pEnt->pNext: NULL ) { Key = Map_HashKey2( pEnt->p1, pEnt->p2, nBinsNew ); pEnt->pNext = pBinsNew[Key]; pBinsNew[Key] = pEnt; Counter++; } assert( Counter == pMan->nNodes - pMan->nInputs ); if ( pMan->fVerbose ) { // printf( "Increasing the unique table size from %6d to %6d. ", pMan->nBins, nBinsNew ); // ABC_PRT( "Time", Abc_Clock() - clk ); } // replace the table and the parameters ABC_FREE( pMan->pBins ); pMan->pBins = pBinsNew; pMan->nBins = nBinsNew; }