#include "mapperInt.h"
Go to the source code of this file.
Map_Node_t** Map_CutReadLeaves | ( | Map_Cut_t * | p | ) |
Definition at line 129 of file mapperCreate.c.
00129 { return p->ppLeaves; }
int Map_CutReadLeavesNum | ( | Map_Cut_t * | p | ) |
Definition at line 128 of file mapperCreate.c.
00128 { return p->nLeaves; }
Definition at line 133 of file mapperCreate.c.
00133 { return p->pNext; }
unsigned Map_CutReadPhase0 | ( | Map_Cut_t * | p | ) |
Definition at line 131 of file mapperCreate.c.
00131 { return p->M[0].uPhaseBest;}
unsigned Map_CutReadPhase1 | ( | Map_Cut_t * | p | ) |
Definition at line 132 of file mapperCreate.c.
00132 { return p->M[1].uPhaseBest;}
unsigned Map_CutReadPhaseBest | ( | Map_Cut_t * | p, | |
int | fPhase | |||
) |
Definition at line 130 of file mapperCreate.c.
00130 { return p->M[fPhase].uPhaseBest;}
Map_Super_t* Map_CutReadSuper0 | ( | Map_Cut_t * | p | ) |
Definition at line 126 of file mapperCreate.c.
00126 { return p->M[0].pSuperBest;}
Map_Super_t* Map_CutReadSuper1 | ( | Map_Cut_t * | p | ) |
Definition at line 127 of file mapperCreate.c.
00127 { return p->M[1].pSuperBest;}
Map_Super_t* Map_CutReadSuperBest | ( | Map_Cut_t * | p, | |
int | fPhase | |||
) |
Function*************************************************************
Synopsis [Reads parameters from the cut.]
Description []
SideEffects []
SeeAlso []
Definition at line 125 of file mapperCreate.c.
00125 { return p->M[fPhase].pSuperBest;}
static unsigned Map_HashKey2 | ( | Map_Node_t * | p0, | |
Map_Node_t * | p1, | |||
int | TableSize | |||
) | [inline, static] |
Definition at line 30 of file mapperCreate.c.
Map_Man_t* Map_ManCreate | ( | int | nInputs, | |
int | nOutputs, | |||
int | fVerbose | |||
) |
Function*************************************************************
Synopsis [Create the mapping manager.]
Description [The number of inputs and outputs is assumed to be known is advance. It is much simpler to have them fixed upfront. When it comes to representing the object graph in the form of AIG, the resulting manager is similar to the regular AIG manager, except that it does not use reference counting (and therefore does not have garbage collections). It does have table resizing. The data structure is more flexible to represent additional information needed for mapping.]
SideEffects []
SeeAlso []
Definition at line 180 of file mapperCreate.c.
00181 { 00182 Map_Man_t * p; 00183 int i; 00184 00185 // derive the supergate library 00186 if ( Abc_FrameReadLibSuper() == NULL ) 00187 { 00188 printf( "The supergate library is not specified. Use \"read_library\" or \"read_super\".\n" ); 00189 return NULL; 00190 } 00191 00192 // start the manager 00193 p = ALLOC( Map_Man_t, 1 ); 00194 memset( p, 0, sizeof(Map_Man_t) ); 00195 p->pSuperLib = Abc_FrameReadLibSuper(); 00196 p->nVarsMax = p->pSuperLib->nVarsMax; 00197 p->fVerbose = fVerbose; 00198 p->fEpsilon = (float)0.001; 00199 assert( p->nVarsMax > 0 ); 00200 00201 if ( p->nVarsMax == 5 ) 00202 Extra_Truth4VarN( &p->uCanons, &p->uPhases, &p->pCounters, 8 ); 00203 00204 // start various data structures 00205 Map_TableCreate( p ); 00206 Map_MappingSetupTruthTables( p->uTruths ); 00207 Map_MappingSetupTruthTablesLarge( p->uTruthsLarge ); 00208 // printf( "Node = %d bytes. Cut = %d bytes. Super = %d bytes.\n", sizeof(Map_Node_t), sizeof(Map_Cut_t), sizeof(Map_Super_t) ); 00209 p->mmNodes = Extra_MmFixedStart( sizeof(Map_Node_t) ); 00210 p->mmCuts = Extra_MmFixedStart( sizeof(Map_Cut_t) ); 00211 00212 // make sure the constant node will get index -1 00213 p->nNodes = -1; 00214 // create the constant node 00215 p->pConst1 = Map_NodeCreate( p, NULL, NULL ); 00216 p->vNodesAll = Map_NodeVecAlloc( 100 ); 00217 p->vNodesTemp = Map_NodeVecAlloc( 100 ); 00218 p->vMapping = Map_NodeVecAlloc( 100 ); 00219 p->vVisited = Map_NodeVecAlloc( 100 ); 00220 00221 // create the PI nodes 00222 p->nInputs = nInputs; 00223 p->pInputs = ALLOC( Map_Node_t *, nInputs ); 00224 for ( i = 0; i < nInputs; i++ ) 00225 p->pInputs[i] = Map_NodeCreate( p, NULL, NULL ); 00226 00227 // create the place for the output nodes 00228 p->nOutputs = nOutputs; 00229 p->pOutputs = ALLOC( Map_Node_t *, nOutputs ); 00230 memset( p->pOutputs, 0, sizeof(Map_Node_t *) * nOutputs ); 00231 return p; 00232 }
void Map_ManFree | ( | Map_Man_t * | p | ) |
Function*************************************************************
Synopsis [Deallocates the mapping manager.]
Description []
SideEffects []
SeeAlso []
Definition at line 245 of file mapperCreate.c.
00246 { 00247 // int i; 00248 // for ( i = 0; i < p->vNodesAll->nSize; i++ ) 00249 // Map_NodeVecFree( p->vNodesAll->pArray[i]->vFanouts ); 00250 // Map_NodeVecFree( p->pConst1->vFanouts ); 00251 if ( p->vAnds ) 00252 Map_NodeVecFree( p->vAnds ); 00253 if ( p->vNodesAll ) 00254 Map_NodeVecFree( p->vNodesAll ); 00255 if ( p->vNodesTemp ) 00256 Map_NodeVecFree( p->vNodesTemp ); 00257 if ( p->vMapping ) 00258 Map_NodeVecFree( p->vMapping ); 00259 if ( p->vVisited ) 00260 Map_NodeVecFree( p->vVisited ); 00261 if ( p->uCanons ) free( p->uCanons ); 00262 if ( p->uPhases ) free( p->uPhases ); 00263 if ( p->pCounters ) free( p->pCounters ); 00264 Extra_MmFixedStop( p->mmNodes ); 00265 Extra_MmFixedStop( p->mmCuts ); 00266 FREE( p->pInputArrivals ); 00267 FREE( p->pInputs ); 00268 FREE( p->pOutputs ); 00269 FREE( p->pBins ); 00270 FREE( p->ppOutputNames ); 00271 FREE( p ); 00272 }
void Map_ManPrintStatsToFile | ( | char * | pName, | |
float | Area, | |||
float | Delay, | |||
int | Time | |||
) |
Function*************************************************************
Synopsis [Prints the mapping stats.]
Description []
SideEffects []
SeeAlso []
Definition at line 314 of file mapperCreate.c.
00315 { 00316 FILE * pTable; 00317 pTable = fopen( "map_stats.txt", "a+" ); 00318 fprintf( pTable, "%s ", pName ); 00319 fprintf( pTable, "%4.2f ", Area ); 00320 fprintf( pTable, "%4.2f ", Delay ); 00321 fprintf( pTable, "%4.2f\n", (float)(Time)/(float)(CLOCKS_PER_SEC) ); 00322 fclose( pTable ); 00323 }
void Map_ManPrintTimeStats | ( | Map_Man_t * | p | ) |
Function*************************************************************
Synopsis [Deallocates the mapping manager.]
Description []
SideEffects []
SeeAlso []
Definition at line 286 of file mapperCreate.c.
00287 { 00288 printf( "N-canonical = %d. Matchings = %d. Phases = %d. ", p->nCanons, p->nMatches, p->nPhases ); 00289 printf( "Choice nodes = %d. Choices = %d.\n", p->nChoiceNodes, p->nChoices ); 00290 PRT( "ToMap", p->timeToMap ); 00291 PRT( "Cuts ", p->timeCuts ); 00292 PRT( "Truth", p->timeTruth ); 00293 PRT( "Match", p->timeMatch ); 00294 PRT( "Area ", p->timeArea ); 00295 PRT( "Sweep", p->timeSweep ); 00296 PRT( "ToNet", p->timeToNet ); 00297 PRT( "TOTAL", p->timeTotal ); 00298 if ( p->time1 ) { PRT( "time1", p->time1 ); } 00299 if ( p->time2 ) { PRT( "time2", p->time2 ); } 00300 if ( p->time3 ) { PRT( "time3", p->time3 ); } 00301 }
float Map_ManReadAreaFinal | ( | Map_Man_t * | p | ) |
Definition at line 55 of file mapperCreate.c.
00055 { return p->AreaFinal; }
Map_Node_t* Map_ManReadConst1 | ( | Map_Man_t * | p | ) |
Definition at line 51 of file mapperCreate.c.
00051 { return p->pConst1; }
int Map_ManReadFanoutViolations | ( | Map_Man_t * | p | ) |
Definition at line 67 of file mapperCreate.c.
00067 { return p->nFanoutViolations; }
Mio_Library_t* Map_ManReadGenLib | ( | Map_Man_t * | p | ) |
Definition at line 53 of file mapperCreate.c.
Map_Time_t* Map_ManReadInputArrivals | ( | Map_Man_t * | p | ) |
Definition at line 52 of file mapperCreate.c.
00052 { return p->pInputArrivals;}
int Map_ManReadInputNum | ( | Map_Man_t * | p | ) |
FUNCTION DEFINITIONS ///Function*************************************************************
Synopsis [Reads parameters from the mapping manager.]
Description []
SideEffects []
SeeAlso []
Definition at line 47 of file mapperCreate.c.
00047 { return p->nInputs; }
Map_Node_t** Map_ManReadInputs | ( | Map_Man_t * | p | ) |
Definition at line 49 of file mapperCreate.c.
00049 { return p->pInputs; }
int Map_ManReadOutputNum | ( | Map_Man_t * | p | ) |
Definition at line 48 of file mapperCreate.c.
00048 { return p->nOutputs; }
Map_Node_t** Map_ManReadOutputs | ( | Map_Man_t * | p | ) |
Definition at line 50 of file mapperCreate.c.
00050 { return p->pOutputs; }
float Map_ManReadRequiredGlo | ( | Map_Man_t * | p | ) |
Definition at line 56 of file mapperCreate.c.
00056 { return p->fRequiredGlo; }
Definition at line 54 of file mapperCreate.c.
00054 { return p->fVerbose; }
void Map_ManSetAreaRecovery | ( | Map_Man_t * | p, | |
int | fAreaRecovery | |||
) |
Definition at line 62 of file mapperCreate.c.
00062 { p->fAreaRecovery = fAreaRecovery;}
void Map_ManSetChoiceNodeNum | ( | Map_Man_t * | p, | |
int | nChoiceNodes | |||
) |
Definition at line 69 of file mapperCreate.c.
00069 { p->nChoiceNodes = nChoiceNodes; }
void Map_ManSetChoiceNum | ( | Map_Man_t * | p, | |
int | nChoices | |||
) |
Definition at line 70 of file mapperCreate.c.
00070 { p->nChoices = nChoices; }
void Map_ManSetDelayTarget | ( | Map_Man_t * | p, | |
float | DelayTarget | |||
) |
Definition at line 63 of file mapperCreate.c.
00063 { p->DelayTarget = DelayTarget;}
void Map_ManSetFanoutViolations | ( | Map_Man_t * | p, | |
int | nVio | |||
) |
Definition at line 68 of file mapperCreate.c.
00068 { p->nFanoutViolations = nVio; }
void Map_ManSetInputArrivals | ( | Map_Man_t * | p, | |
Map_Time_t * | pArrivals | |||
) |
Definition at line 64 of file mapperCreate.c.
00064 { p->pInputArrivals = pArrivals;}
void Map_ManSetNumIterations | ( | Map_Man_t * | p, | |
int | nIterations | |||
) |
Definition at line 66 of file mapperCreate.c.
00066 { p->nIterations = nIterations; }
Definition at line 65 of file mapperCreate.c.
00065 { p->fObeyFanoutLimits = fObeyFanoutLimits; }
void Map_ManSetOutputNames | ( | Map_Man_t * | p, | |
char ** | ppNames | |||
) |
Definition at line 61 of file mapperCreate.c.
00061 { p->ppOutputNames = ppNames; }
void Map_ManSetSwitching | ( | Map_Man_t * | p, | |
int | fSwitching | |||
) |
Definition at line 72 of file mapperCreate.c.
00072 { p->fSwitching = fSwitching; }
void Map_ManSetTimeSweep | ( | Map_Man_t * | p, | |
int | Time | |||
) |
Definition at line 59 of file mapperCreate.c.
00059 { p->timeSweep = Time; }
void Map_ManSetTimeToMap | ( | Map_Man_t * | p, | |
int | Time | |||
) |
Definition at line 57 of file mapperCreate.c.
00057 { p->timeToMap = Time; }
void Map_ManSetTimeToNet | ( | Map_Man_t * | p, | |
int | Time | |||
) |
Definition at line 58 of file mapperCreate.c.
00058 { p->timeToNet = Time; }
void Map_ManSetTimeTotal | ( | Map_Man_t * | p, | |
int | Time | |||
) |
Definition at line 60 of file mapperCreate.c.
00060 { p->timeTotal = Time; }
void Map_ManSetVerbose | ( | Map_Man_t * | p, | |
int | fVerbose | |||
) |
Definition at line 71 of file mapperCreate.c.
00071 { p->fVerbose = fVerbose; }
Map_Node_t* Map_NodeAnd | ( | Map_Man_t * | p, | |
Map_Node_t * | p1, | |||
Map_Node_t * | p2 | |||
) |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 514 of file mapperCreate.c.
00515 { 00516 Map_Node_t * pNode; 00517 pNode = Map_TableLookup( p, p1, p2 ); 00518 return pNode; 00519 }
int Map_NodeComparePhase | ( | Map_Node_t * | p1, | |
Map_Node_t * | p2 | |||
) |
Definition at line 112 of file mapperCreate.c.
00112 { assert( !Map_IsComplement(p1) ); assert( !Map_IsComplement(p2) ); return p1->fInv ^ p2->fInv; }
Map_Node_t* Map_NodeCreate | ( | Map_Man_t * | p, | |
Map_Node_t * | p1, | |||
Map_Node_t * | p2 | |||
) |
Function*************************************************************
Synopsis [Creates a new node.]
Description [This procedure should be called to create the constant node and the PI nodes first.]
SideEffects []
SeeAlso []
Definition at line 337 of file mapperCreate.c.
00338 { 00339 Map_Node_t * pNode; 00340 // create the node 00341 pNode = (Map_Node_t *)Extra_MmFixedEntryFetch( p->mmNodes ); 00342 memset( pNode, 0, sizeof(Map_Node_t) ); 00343 pNode->tRequired[0].Rise = pNode->tRequired[0].Fall = pNode->tRequired[0].Worst = MAP_FLOAT_LARGE; 00344 pNode->tRequired[1].Rise = pNode->tRequired[1].Fall = pNode->tRequired[1].Worst = MAP_FLOAT_LARGE; 00345 pNode->p1 = p1; 00346 pNode->p2 = p2; 00347 pNode->p = p; 00348 // set the number of this node 00349 pNode->Num = p->nNodes++; 00350 // place to store the fanouts 00351 // pNode->vFanouts = Map_NodeVecAlloc( 5 ); 00352 // store this node in the internal array 00353 if ( pNode->Num >= 0 ) 00354 Map_NodeVecPush( p->vNodesAll, pNode ); 00355 else 00356 pNode->fInv = 1; 00357 // set the level of this node 00358 if ( p1 ) 00359 { 00360 #ifdef MAP_ALLOCATE_FANOUT 00361 // create the fanout info 00362 Map_NodeAddFaninFanout( Map_Regular(p1), pNode ); 00363 Map_NodeAddFaninFanout( Map_Regular(p2), pNode ); 00364 #endif 00365 pNode->Level = 1 + MAP_MAX(Map_Regular(pNode->p1)->Level, Map_Regular(pNode->p2)->Level); 00366 pNode->fInv = Map_NodeIsSimComplement(p1) & Map_NodeIsSimComplement(p2); 00367 } 00368 // reference the inputs (will be used to compute the number of fanouts) 00369 if ( p1 ) Map_NodeRef(p1); 00370 if ( p2 ) Map_NodeRef(p2); 00371 00372 pNode->nRefEst[0] = pNode->nRefEst[1] = -1; 00373 return pNode; 00374 }
Map_Node_t* Map_NodeExor | ( | Map_Man_t * | p, | |
Map_Node_t * | p1, | |||
Map_Node_t * | p2 | |||
) |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 550 of file mapperCreate.c.
00551 { 00552 return Map_NodeMux( p, p1, Map_Not(p2), p2 ); 00553 }
int Map_NodeIsAnd | ( | Map_Node_t * | p | ) |
Definition at line 111 of file mapperCreate.c.
00111 { return (Map_Regular(p))->p1 != NULL; }
int Map_NodeIsConst | ( | Map_Node_t * | p | ) |
Function*************************************************************
Synopsis [Checks the type of the node.]
Description []
SideEffects []
SeeAlso []
Definition at line 109 of file mapperCreate.c.
00109 { return (Map_Regular(p))->Num == -1; }
int Map_NodeIsVar | ( | Map_Node_t * | p | ) |
Definition at line 110 of file mapperCreate.c.
00110 { return (Map_Regular(p))->p1 == NULL && (Map_Regular(p))->Num >= 0; }
Map_Node_t* Map_NodeMux | ( | Map_Man_t * | p, | |
Map_Node_t * | pC, | |||
Map_Node_t * | pT, | |||
Map_Node_t * | pE | |||
) |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 566 of file mapperCreate.c.
00567 { 00568 Map_Node_t * pAnd1, * pAnd2, * pRes; 00569 pAnd1 = Map_TableLookup( p, pC, pT ); 00570 pAnd2 = Map_TableLookup( p, Map_Not(pC), pE ); 00571 pRes = Map_NodeOr( p, pAnd1, pAnd2 ); 00572 return pRes; 00573 }
Map_Node_t* Map_NodeOr | ( | Map_Man_t * | p, | |
Map_Node_t * | p1, | |||
Map_Node_t * | p2 | |||
) |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 532 of file mapperCreate.c.
00533 { 00534 Map_Node_t * pNode; 00535 pNode = Map_Not( Map_TableLookup( p, Map_Not(p1), Map_Not(p2) ) ); 00536 return pNode; 00537 }
Map_Cut_t* Map_NodeReadCutBest | ( | Map_Node_t * | p, | |
int | fPhase | |||
) |
Definition at line 90 of file mapperCreate.c.
00090 { return p->pCutBest[fPhase]; }
Map_Cut_t* Map_NodeReadCuts | ( | Map_Node_t * | p | ) |
Definition at line 89 of file mapperCreate.c.
00089 { return p->pCuts; }
char* Map_NodeReadData | ( | Map_Node_t * | p, | |
int | fPhase | |||
) |
Definition at line 86 of file mapperCreate.c.
int Map_NodeReadLevel | ( | Map_Node_t * | p | ) |
Definition at line 88 of file mapperCreate.c.
00088 { return Map_Regular(p)->Level; }
Map_Man_t* Map_NodeReadMan | ( | Map_Node_t * | p | ) |
Function*************************************************************
Synopsis [Reads parameters from the mapping node.]
Description []
SideEffects []
SeeAlso []
Definition at line 85 of file mapperCreate.c.
00085 { return p->p; }
int Map_NodeReadNum | ( | Map_Node_t * | p | ) |
Definition at line 87 of file mapperCreate.c.
00087 { return p->Num; }
Map_Node_t* Map_NodeReadOne | ( | Map_Node_t * | p | ) |
Definition at line 91 of file mapperCreate.c.
00091 { return p->p1; }
Map_Node_t* Map_NodeReadTwo | ( | Map_Node_t * | p | ) |
Definition at line 92 of file mapperCreate.c.
00092 { return p->p2; }
void Map_NodeSetChoice | ( | Map_Man_t * | pMan, | |
Map_Node_t * | pNodeOld, | |||
Map_Node_t * | pNodeNew | |||
) |
Function*************************************************************
Synopsis [Sets the node to be equivalent to the given one.]
Description [This procedure is a work-around for the equivalence check. Does not verify the equivalence. Use at the user's risk.]
SideEffects []
SeeAlso []
Definition at line 588 of file mapperCreate.c.
void Map_NodeSetData | ( | Map_Node_t * | p, | |
int | fPhase, | |||
char * | pData | |||
) |
Definition at line 93 of file mapperCreate.c.
void Map_NodeSetNextE | ( | Map_Node_t * | p, | |
Map_Node_t * | pNextE | |||
) |
Definition at line 94 of file mapperCreate.c.
00094 { p->pNextE = pNextE; }
void Map_NodeSetRepr | ( | Map_Node_t * | p, | |
Map_Node_t * | pRepr | |||
) |
Definition at line 95 of file mapperCreate.c.
00095 { p->pRepr = pRepr; }
void Map_NodeSetSwitching | ( | Map_Node_t * | p, | |
float | Switching | |||
) |
Definition at line 96 of file mapperCreate.c.
00096 { p->Switching = Switching; }
float Map_SuperLibReadAreaInv | ( | Map_SuperLib_t * | p | ) |
Definition at line 157 of file mapperCreate.c.
00157 { return p->AreaInv; }
Map_Time_t Map_SuperLibReadDelayInv | ( | Map_SuperLib_t * | p | ) |
Definition at line 158 of file mapperCreate.c.
00158 { return p->tDelayInv;}
Mio_Library_t* Map_SuperLibReadGenLib | ( | Map_SuperLib_t * | p | ) |
Definition at line 156 of file mapperCreate.c.
00156 { return p->pGenlib; }
int Map_SuperLibReadVarsMax | ( | Map_SuperLib_t * | p | ) |
Definition at line 159 of file mapperCreate.c.
00159 { return p->nVarsMax; }
int Map_SuperReadFaninNum | ( | Map_Super_t * | p | ) |
Definition at line 150 of file mapperCreate.c.
00150 { return p->nFanins; }
Map_Super_t** Map_SuperReadFanins | ( | Map_Super_t * | p | ) |
Definition at line 149 of file mapperCreate.c.
00149 { return p->pFanins; }
int Map_SuperReadFanoutLimit | ( | Map_Super_t * | p | ) |
Definition at line 154 of file mapperCreate.c.
00154 { return p->nFanLimit;}
char* Map_SuperReadFormula | ( | Map_Super_t * | p | ) |
Function*************************************************************
Synopsis [Reads parameters from the supergate.]
Description []
SideEffects []
SeeAlso []
Definition at line 146 of file mapperCreate.c.
00146 { return p->pFormula; }
Map_Super_t* Map_SuperReadNext | ( | Map_Super_t * | p | ) |
Definition at line 151 of file mapperCreate.c.
00151 { return p->pNext; }
int Map_SuperReadNum | ( | Map_Super_t * | p | ) |
Definition at line 148 of file mapperCreate.c.
00148 { return p->Num; }
int Map_SuperReadNumPhases | ( | Map_Super_t * | p | ) |
Definition at line 152 of file mapperCreate.c.
00152 { return p->nPhases; }
unsigned char* Map_SuperReadPhases | ( | Map_Super_t * | p | ) |
Definition at line 153 of file mapperCreate.c.
00153 { return p->uPhases; }
Mio_Gate_t* Map_SuperReadRoot | ( | Map_Super_t * | p | ) |
Definition at line 147 of file mapperCreate.c.
00147 { return p->pRoot; }
void Map_TableCreate | ( | Map_Man_t * | pMan | ) | [static] |
CFile****************************************************************
FileName [mapperCreate.c]
PackageName [MVSIS 1.3: Multi-valued logic synthesis system.]
Synopsis [Generic technology mapping engine.]
Author [MVSIS Group]
Affiliation [UC Berkeley]
Date [Ver. 2.0. Started - June 1, 2004.]
Revision [
] DECLARATIONS ///
Function*************************************************************
Synopsis [Create the unique table of AND gates.]
Description []
SideEffects []
SeeAlso []
Definition at line 387 of file mapperCreate.c.
00388 { 00389 assert( pMan->pBins == NULL ); 00390 pMan->nBins = Cudd_Prime(5000); 00391 pMan->pBins = ALLOC( Map_Node_t *, pMan->nBins ); 00392 memset( pMan->pBins, 0, sizeof(Map_Node_t *) * pMan->nBins ); 00393 pMan->nNodes = 0; 00394 }
Map_Node_t * Map_TableLookup | ( | Map_Man_t * | pMan, | |
Map_Node_t * | p1, | |||
Map_Node_t * | p2 | |||
) | [static] |
Function*************************************************************
Synopsis [Looks up the AND2 node in the unique table.]
Description [This procedure implements one-level hashing. All the nodes are hashed by their children. If the node with the same children was already created, it is returned by the call to this procedure. If it does not exist, this procedure creates a new node with these children. ]
SideEffects []
SeeAlso []
Definition at line 410 of file mapperCreate.c.
00411 { 00412 Map_Node_t * pEnt; 00413 unsigned Key; 00414 00415 if ( p1 == p2 ) 00416 return p1; 00417 if ( p1 == Map_Not(p2) ) 00418 return Map_Not(pMan->pConst1); 00419 if ( Map_NodeIsConst(p1) ) 00420 { 00421 if ( p1 == pMan->pConst1 ) 00422 return p2; 00423 return Map_Not(pMan->pConst1); 00424 } 00425 if ( Map_NodeIsConst(p2) ) 00426 { 00427 if ( p2 == pMan->pConst1 ) 00428 return p1; 00429 return Map_Not(pMan->pConst1); 00430 } 00431 00432 if ( Map_Regular(p1)->Num > Map_Regular(p2)->Num ) 00433 pEnt = p1, p1 = p2, p2 = pEnt; 00434 00435 Key = Map_HashKey2( p1, p2, pMan->nBins ); 00436 for ( pEnt = pMan->pBins[Key]; pEnt; pEnt = pEnt->pNext ) 00437 if ( pEnt->p1 == p1 && pEnt->p2 == p2 ) 00438 return pEnt; 00439 // resize the table 00440 if ( pMan->nNodes >= 2 * pMan->nBins ) 00441 { 00442 Map_TableResize( pMan ); 00443 Key = Map_HashKey2( p1, p2, pMan->nBins ); 00444 } 00445 // create the new node 00446 pEnt = Map_NodeCreate( pMan, p1, p2 ); 00447 // add the node to the corresponding linked list in the table 00448 pEnt->pNext = pMan->pBins[Key]; 00449 pMan->pBins[Key] = pEnt; 00450 return pEnt; 00451 }
void Map_TableResize | ( | Map_Man_t * | pMan | ) | [static] |
Function*************************************************************
Synopsis [Resizes the table.]
Description []
SideEffects []
SeeAlso []
Definition at line 465 of file mapperCreate.c.
00466 { 00467 Map_Node_t ** pBinsNew; 00468 Map_Node_t * pEnt, * pEnt2; 00469 int nBinsNew, Counter, i, clk; 00470 unsigned Key; 00471 00472 clk = clock(); 00473 // get the new table size 00474 nBinsNew = Cudd_Prime(2 * pMan->nBins); 00475 // allocate a new array 00476 pBinsNew = ALLOC( Map_Node_t *, nBinsNew ); 00477 memset( pBinsNew, 0, sizeof(Map_Node_t *) * nBinsNew ); 00478 // rehash the entries from the old table 00479 Counter = 0; 00480 for ( i = 0; i < pMan->nBins; i++ ) 00481 for ( pEnt = pMan->pBins[i], pEnt2 = pEnt? pEnt->pNext: NULL; pEnt; 00482 pEnt = pEnt2, pEnt2 = pEnt? pEnt->pNext: NULL ) 00483 { 00484 Key = Map_HashKey2( pEnt->p1, pEnt->p2, nBinsNew ); 00485 pEnt->pNext = pBinsNew[Key]; 00486 pBinsNew[Key] = pEnt; 00487 Counter++; 00488 } 00489 assert( Counter == pMan->nNodes - pMan->nInputs ); 00490 if ( pMan->fVerbose ) 00491 { 00492 // printf( "Increasing the unique table size from %6d to %6d. ", pMan->nBins, nBinsNew ); 00493 // PRT( "Time", clock() - clk ); 00494 } 00495 // replace the table and the parameters 00496 free( pMan->pBins ); 00497 pMan->pBins = pBinsNew; 00498 pMan->nBins = nBinsNew; 00499 }