abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
mapperCreate.c File Reference
#include "mapperInt.h"

Go to the source code of this file.

Functions

static
ABC_NAMESPACE_IMPL_START void 
Map_TableCreate (Map_Man_t *p)
 DECLARATIONS ///. More...
 
static void Map_TableResize (Map_Man_t *p)
 
static unsigned Map_HashKey2 (Map_Node_t *p0, Map_Node_t *p1, int TableSize)
 
int Map_ManReadInputNum (Map_Man_t *p)
 FUNCTION DEFINITIONS ///. More...
 
int Map_ManReadOutputNum (Map_Man_t *p)
 
int Map_ManReadBufNum (Map_Man_t *p)
 
Map_Node_t ** Map_ManReadInputs (Map_Man_t *p)
 
Map_Node_t ** Map_ManReadOutputs (Map_Man_t *p)
 
Map_Node_t ** Map_ManReadBufs (Map_Man_t *p)
 
Map_Node_tMap_ManReadBufDriver (Map_Man_t *p, int i)
 
Map_Node_tMap_ManReadConst1 (Map_Man_t *p)
 
Map_Time_tMap_ManReadInputArrivals (Map_Man_t *p)
 
Map_Time_tMap_ManReadOutputRequireds (Map_Man_t *p)
 
Mio_Library_tMap_ManReadGenLib (Map_Man_t *p)
 
int Map_ManReadVerbose (Map_Man_t *p)
 
float Map_ManReadAreaFinal (Map_Man_t *p)
 
float Map_ManReadRequiredGlo (Map_Man_t *p)
 
void Map_ManSetOutputNames (Map_Man_t *p, char **ppNames)
 
void Map_ManSetAreaRecovery (Map_Man_t *p, int fAreaRecovery)
 
void Map_ManSetDelayTarget (Map_Man_t *p, float DelayTarget)
 
void Map_ManSetInputArrivals (Map_Man_t *p, Map_Time_t *pArrivals)
 
void Map_ManSetOutputRequireds (Map_Man_t *p, Map_Time_t *pRequireds)
 
void Map_ManSetObeyFanoutLimits (Map_Man_t *p, int fObeyFanoutLimits)
 
void Map_ManSetNumIterations (Map_Man_t *p, int nIterations)
 
int Map_ManReadFanoutViolations (Map_Man_t *p)
 
void Map_ManSetFanoutViolations (Map_Man_t *p, int nVio)
 
void Map_ManSetChoiceNodeNum (Map_Man_t *p, int nChoiceNodes)
 
void Map_ManSetChoiceNum (Map_Man_t *p, int nChoices)
 
void Map_ManSetVerbose (Map_Man_t *p, int fVerbose)
 
void Map_ManSetSwitching (Map_Man_t *p, int fSwitching)
 
Map_Man_tMap_NodeReadMan (Map_Node_t *p)
 
char * Map_NodeReadData (Map_Node_t *p, int fPhase)
 
int Map_NodeReadNum (Map_Node_t *p)
 
int Map_NodeReadLevel (Map_Node_t *p)
 
Map_Cut_tMap_NodeReadCuts (Map_Node_t *p)
 
Map_Cut_tMap_NodeReadCutBest (Map_Node_t *p, int fPhase)
 
Map_Node_tMap_NodeReadOne (Map_Node_t *p)
 
Map_Node_tMap_NodeReadTwo (Map_Node_t *p)
 
void Map_NodeSetData (Map_Node_t *p, int fPhase, char *pData)
 
void Map_NodeSetNextE (Map_Node_t *p, Map_Node_t *pNextE)
 
void Map_NodeSetRepr (Map_Node_t *p, Map_Node_t *pRepr)
 
void Map_NodeSetSwitching (Map_Node_t *p, float Switching)
 
int Map_NodeIsConst (Map_Node_t *p)
 
int Map_NodeIsVar (Map_Node_t *p)
 
int Map_NodeIsBuf (Map_Node_t *p)
 
int Map_NodeIsAnd (Map_Node_t *p)
 
int Map_NodeComparePhase (Map_Node_t *p1, Map_Node_t *p2)
 
Map_Super_tMap_CutReadSuperBest (Map_Cut_t *p, int fPhase)
 
Map_Super_tMap_CutReadSuper0 (Map_Cut_t *p)
 
Map_Super_tMap_CutReadSuper1 (Map_Cut_t *p)
 
int Map_CutReadLeavesNum (Map_Cut_t *p)
 
Map_Node_t ** Map_CutReadLeaves (Map_Cut_t *p)
 
unsigned Map_CutReadPhaseBest (Map_Cut_t *p, int fPhase)
 
unsigned Map_CutReadPhase0 (Map_Cut_t *p)
 
unsigned Map_CutReadPhase1 (Map_Cut_t *p)
 
Map_Cut_tMap_CutReadNext (Map_Cut_t *p)
 
char * Map_SuperReadFormula (Map_Super_t *p)
 
Mio_Gate_tMap_SuperReadRoot (Map_Super_t *p)
 
int Map_SuperReadNum (Map_Super_t *p)
 
Map_Super_t ** Map_SuperReadFanins (Map_Super_t *p)
 
int Map_SuperReadFaninNum (Map_Super_t *p)
 
Map_Super_tMap_SuperReadNext (Map_Super_t *p)
 
int Map_SuperReadNumPhases (Map_Super_t *p)
 
unsigned char * Map_SuperReadPhases (Map_Super_t *p)
 
int Map_SuperReadFanoutLimit (Map_Super_t *p)
 
Mio_Library_tMap_SuperLibReadGenLib (Map_SuperLib_t *p)
 
float Map_SuperLibReadAreaInv (Map_SuperLib_t *p)
 
Map_Time_t Map_SuperLibReadDelayInv (Map_SuperLib_t *p)
 
int Map_SuperLibReadVarsMax (Map_SuperLib_t *p)
 
Map_Man_tMap_ManCreate (int nInputs, int nOutputs, int fVerbose)
 FUNCTION DEFINITIONS ///. More...
 
void Map_ManFree (Map_Man_t *p)
 
void Map_ManCreateNodeDelays (Map_Man_t *p, int LogFan)
 
void Map_ManPrintTimeStats (Map_Man_t *p)
 
void Map_ManPrintStatsToFile (char *pName, float Area, float Delay, abctime Time)
 
Map_Node_tMap_NodeCreate (Map_Man_t *p, Map_Node_t *p1, Map_Node_t *p2)
 
Map_Node_tMap_NodeAnd (Map_Man_t *pMan, Map_Node_t *p1, Map_Node_t *p2)
 
Map_Node_tMap_NodeBuf (Map_Man_t *p, Map_Node_t *p1)
 
void Map_NodeSetChoice (Map_Man_t *pMan, Map_Node_t *pNodeOld, Map_Node_t *pNodeNew)
 

Function Documentation

Map_Node_t** Map_CutReadLeaves ( Map_Cut_t p)

Definition at line 133 of file mapperCreate.c.

133 { return p->ppLeaves; }
Map_Node_t * ppLeaves[6]
Definition: mapperInt.h:265
int Map_CutReadLeavesNum ( Map_Cut_t p)

Definition at line 132 of file mapperCreate.c.

132 { return p->nLeaves; }
Map_Cut_t* Map_CutReadNext ( Map_Cut_t p)

Definition at line 137 of file mapperCreate.c.

137 { return p->pNext; }
Map_Cut_t * pNext
Definition: mapperInt.h:262
unsigned Map_CutReadPhase0 ( Map_Cut_t p)

Definition at line 135 of file mapperCreate.c.

135 { return p->M[0].uPhaseBest;}
unsigned uPhaseBest
Definition: mapperInt.h:252
Map_Match_t M[2]
Definition: mapperInt.h:271
unsigned Map_CutReadPhase1 ( Map_Cut_t p)

Definition at line 136 of file mapperCreate.c.

136 { return p->M[1].uPhaseBest;}
unsigned uPhaseBest
Definition: mapperInt.h:252
Map_Match_t M[2]
Definition: mapperInt.h:271
unsigned Map_CutReadPhaseBest ( Map_Cut_t p,
int  fPhase 
)

Definition at line 134 of file mapperCreate.c.

134 { return p->M[fPhase].uPhaseBest;}
unsigned uPhaseBest
Definition: mapperInt.h:252
Map_Match_t M[2]
Definition: mapperInt.h:271
Map_Super_t* Map_CutReadSuper0 ( Map_Cut_t p)

Definition at line 130 of file mapperCreate.c.

130 { return p->M[0].pSuperBest;}
Map_Super_t * pSuperBest
Definition: mapperInt.h:253
Map_Match_t M[2]
Definition: mapperInt.h:271
Map_Super_t* Map_CutReadSuper1 ( Map_Cut_t p)

Definition at line 131 of file mapperCreate.c.

131 { return p->M[1].pSuperBest;}
Map_Super_t * pSuperBest
Definition: mapperInt.h:253
Map_Match_t M[2]
Definition: mapperInt.h:271
Map_Super_t* Map_CutReadSuperBest ( Map_Cut_t p,
int  fPhase 
)

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

Synopsis [Reads parameters from the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 129 of file mapperCreate.c.

129 { return p->M[fPhase].pSuperBest;}
Map_Super_t * pSuperBest
Definition: mapperInt.h:253
Map_Match_t M[2]
Definition: mapperInt.h:271
static unsigned Map_HashKey2 ( Map_Node_t p0,
Map_Node_t p1,
int  TableSize 
)
inlinestatic

Definition at line 32 of file mapperCreate.c.

32 { return (unsigned)(((ABC_PTRUINT_T)(p0) + (ABC_PTRUINT_T)(p1) * 12582917) % TableSize); }
Map_Man_t* Map_ManCreate ( int  nInputs,
int  nOutputs,
int  fVerbose 
)

FUNCTION DEFINITIONS ///.

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 184 of file mapperCreate.c.

185 {
186  Map_Man_t * p;
187  int i;
188 
189  // derive the supergate library
190  if ( Abc_FrameReadLibSuper() == NULL )
191  {
192  printf( "The supergate library is not specified. Use \"read_super\".\n" );
193  return NULL;
194  }
195 
196  // start the manager
197  p = ABC_ALLOC( Map_Man_t, 1 );
198  memset( p, 0, sizeof(Map_Man_t) );
199  p->pSuperLib = (Map_SuperLib_t *)Abc_FrameReadLibSuper();
200  p->nVarsMax = p->pSuperLib->nVarsMax;
201  p->fVerbose = fVerbose;
202  p->fEpsilon = (float)0.001;
203  assert( p->nVarsMax > 0 );
204 
205  if ( p->nVarsMax == 5 )
206  Extra_Truth4VarN( &p->uCanons, &p->uPhases, &p->pCounters, 8 );
207 
208  // start various data structures
209  Map_TableCreate( p );
210  Map_MappingSetupTruthTables( p->uTruths );
211  Map_MappingSetupTruthTablesLarge( p->uTruthsLarge );
212 // printf( "Node = %d bytes. Cut = %d bytes. Super = %d bytes.\n", sizeof(Map_Node_t), sizeof(Map_Cut_t), sizeof(Map_Super_t) );
213  p->mmNodes = Extra_MmFixedStart( sizeof(Map_Node_t) );
214  p->mmCuts = Extra_MmFixedStart( sizeof(Map_Cut_t) );
215 
216  // make sure the constant node will get index -1
217  p->nNodes = -1;
218  // create the constant node
219  p->pConst1 = Map_NodeCreate( p, NULL, NULL );
220  p->vMapObjs = Map_NodeVecAlloc( 100 );
221  p->vMapBufs = Map_NodeVecAlloc( 100 );
222  p->vVisited = Map_NodeVecAlloc( 100 );
223 
224  // create the PI nodes
225  p->nInputs = nInputs;
226  p->pInputs = ABC_ALLOC( Map_Node_t *, nInputs );
227  for ( i = 0; i < nInputs; i++ )
228  p->pInputs[i] = Map_NodeCreate( p, NULL, NULL );
229 
230  // create the place for the output nodes
231  p->nOutputs = nOutputs;
232  p->pOutputs = ABC_ALLOC( Map_Node_t *, nOutputs );
233  memset( p->pOutputs, 0, sizeof(Map_Node_t *) * nOutputs );
234  return p;
235 }
char * memset()
Map_NodeVec_t * Map_NodeVecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: mapperVec.c:45
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static ABC_NAMESPACE_IMPL_START void Map_TableCreate(Map_Man_t *p)
DECLARATIONS ///.
Definition: mapperCreate.c:424
Extra_MmFixed_t * Extra_MmFixedStart(int nEntrySize)
ABC_DLL void * Abc_FrameReadLibSuper()
Definition: mainFrame.c:58
void Extra_Truth4VarN(unsigned short **puCanons, char ***puPhases, char **ppCounters, int nPhasesMax)
typedefABC_NAMESPACE_HEADER_START struct Map_ManStruct_t_ Map_Man_t
INCLUDES ///.
Definition: mapper.h:40
Map_Node_t * Map_NodeCreate(Map_Man_t *p, Map_Node_t *p1, Map_Node_t *p2)
Definition: mapperCreate.c:364
#define assert(ex)
Definition: util_old.h:213
void Map_MappingSetupTruthTablesLarge(unsigned uTruths[][32])
Definition: mapperUtils.c:361
void Map_MappingSetupTruthTables(unsigned uTruths[][2])
Definition: mapperUtils.c:335
void Map_ManCreateNodeDelays ( Map_Man_t p,
int  LogFan 
)

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

Synopsis [Creates node delays.]

Description []

SideEffects []

SeeAlso []

Definition at line 284 of file mapperCreate.c.

285 {
286  Map_Node_t * pNode;
287  int k;
288  assert( p->pNodeDelays == NULL );
289  p->pNodeDelays = ABC_CALLOC( float, p->vMapObjs->nSize );
290  for ( k = 0; k < p->vMapObjs->nSize; k++ )
291  {
292  pNode = p->vMapObjs->pArray[k];
293  if ( pNode->nRefs == 0 )
294  continue;
295  p->pNodeDelays[k] = 0.014426 * LogFan * p->pSuperLib->tDelayInv.Worst * log( (double)pNode->nRefs ); // 1.4426 = 1/ln(2)
296 // printf( "%d = %d (%.2f) ", k, pNode->nRefs, p->pNodeDelays[k] );
297  }
298 // printf( "\n" );
299 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
void Map_ManFree ( Map_Man_t p)

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

Synopsis [Deallocates the mapping manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 248 of file mapperCreate.c.

249 {
250 // int i;
251 // for ( i = 0; i < p->vMapObjs->nSize; i++ )
252 // Map_NodeVecFree( p->vMapObjs->pArray[i]->vFanouts );
253 // Map_NodeVecFree( p->pConst1->vFanouts );
254  Map_NodeVecFree( p->vMapObjs );
255  Map_NodeVecFree( p->vMapBufs );
256  Map_NodeVecFree( p->vVisited );
257  if ( p->uCanons ) ABC_FREE( p->uCanons );
258  if ( p->uPhases ) ABC_FREE( p->uPhases );
259  if ( p->pCounters ) ABC_FREE( p->pCounters );
260  Extra_MmFixedStop( p->mmNodes );
261  Extra_MmFixedStop( p->mmCuts );
262  ABC_FREE( p->pNodeDelays );
263  ABC_FREE( p->pInputArrivals );
264  ABC_FREE( p->pOutputRequireds );
265  ABC_FREE( p->pInputs );
266  ABC_FREE( p->pOutputs );
267  ABC_FREE( p->pBins );
268  ABC_FREE( p->ppOutputNames );
269  ABC_FREE( p );
270 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Extra_MmFixedStop(Extra_MmFixed_t *p)
void Map_NodeVecFree(Map_NodeVec_t *p)
Definition: mapperVec.c:68
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Map_ManPrintStatsToFile ( char *  pName,
float  Area,
float  Delay,
abctime  Time 
)

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

Synopsis [Prints the mapping stats.]

Description []

SideEffects []

SeeAlso []

Definition at line 341 of file mapperCreate.c.

342 {
343  FILE * pTable;
344  pTable = fopen( "map_stats.txt", "a+" );
345  fprintf( pTable, "%s ", pName );
346  fprintf( pTable, "%4.2f ", Area );
347  fprintf( pTable, "%4.2f ", Delay );
348  fprintf( pTable, "%4.2f\n", (float)(Time)/(float)(CLOCKS_PER_SEC) );
349  fclose( pTable );
350 }
void Map_ManPrintTimeStats ( Map_Man_t p)

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

Synopsis [Deallocates the mapping manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 313 of file mapperCreate.c.

314 {
315  printf( "N-canonical = %d. Matchings = %d. Phases = %d. ", p->nCanons, p->nMatches, p->nPhases );
316  printf( "Choice nodes = %d. Choices = %d.\n", p->nChoiceNodes, p->nChoices );
317  ABC_PRT( "ToMap", p->timeToMap );
318  ABC_PRT( "Cuts ", p->timeCuts );
319  ABC_PRT( "Truth", p->timeTruth );
320  ABC_PRT( "Match", p->timeMatch );
321  ABC_PRT( "Area ", p->timeArea );
322  ABC_PRT( "Sweep", p->timeSweep );
323  ABC_PRT( "ToNet", p->timeToNet );
324  ABC_PRT( "TOTAL", p->timeTotal );
325  if ( p->time1 ) { ABC_PRT( "time1", p->time1 ); }
326  if ( p->time2 ) { ABC_PRT( "time2", p->time2 ); }
327  if ( p->time3 ) { ABC_PRT( "time3", p->time3 ); }
328 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_PRT(a, t)
Definition: abc_global.h:220
float Map_ManReadAreaFinal ( Map_Man_t p)

Definition at line 61 of file mapperCreate.c.

61 { return p->AreaFinal; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Map_Node_t* Map_ManReadBufDriver ( Map_Man_t p,
int  i 
)

Definition at line 55 of file mapperCreate.c.

55 { return Map_ManReadBufs(p)[i]->p1; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Map_Node_t ** Map_ManReadBufs(Map_Man_t *p)
Definition: mapperCreate.c:54
Map_Node_t * p1
Definition: mapperInt.h:221
int Map_ManReadBufNum ( Map_Man_t p)

Definition at line 51 of file mapperCreate.c.

51 { return Map_NodeVecReadSize(p->vMapBufs); }
int Map_NodeVecReadSize(Map_NodeVec_t *p)
Definition: mapperVec.c:122
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Map_Node_t** Map_ManReadBufs ( Map_Man_t p)

Definition at line 54 of file mapperCreate.c.

54 { return Map_NodeVecReadArray(p->vMapBufs); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Map_Node_t ** Map_NodeVecReadArray(Map_NodeVec_t *p)
Definition: mapperVec.c:106
Map_Node_t* Map_ManReadConst1 ( Map_Man_t p)

Definition at line 56 of file mapperCreate.c.

56 { return p->pConst1; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Map_ManReadFanoutViolations ( Map_Man_t p)

Definition at line 70 of file mapperCreate.c.

70 { return p->nFanoutViolations; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Mio_Library_t* Map_ManReadGenLib ( Map_Man_t p)

Definition at line 59 of file mapperCreate.c.

59 { return p->pSuperLib->pGenlib; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Map_Time_t* Map_ManReadInputArrivals ( Map_Man_t p)

Definition at line 57 of file mapperCreate.c.

57 { return p->pInputArrivals; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Map_ManReadInputNum ( Map_Man_t p)

FUNCTION DEFINITIONS ///.

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

Synopsis [Reads parameters from the mapping manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 49 of file mapperCreate.c.

49 { return p->nInputs; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Map_Node_t** Map_ManReadInputs ( Map_Man_t p)

Definition at line 52 of file mapperCreate.c.

52 { return p->pInputs; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Map_ManReadOutputNum ( Map_Man_t p)

Definition at line 50 of file mapperCreate.c.

50 { return p->nOutputs; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Map_Time_t* Map_ManReadOutputRequireds ( Map_Man_t p)

Definition at line 58 of file mapperCreate.c.

58 { return p->pOutputRequireds; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Map_Node_t** Map_ManReadOutputs ( Map_Man_t p)

Definition at line 53 of file mapperCreate.c.

53 { return p->pOutputs; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
float Map_ManReadRequiredGlo ( Map_Man_t p)

Definition at line 62 of file mapperCreate.c.

62 { return p->fRequiredGlo; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Map_ManReadVerbose ( Map_Man_t p)

Definition at line 60 of file mapperCreate.c.

60 { return p->fVerbose; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Map_ManSetAreaRecovery ( Map_Man_t p,
int  fAreaRecovery 
)

Definition at line 64 of file mapperCreate.c.

64 { p->fAreaRecovery = fAreaRecovery;}
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Map_ManSetChoiceNodeNum ( Map_Man_t p,
int  nChoiceNodes 
)

Definition at line 72 of file mapperCreate.c.

72 { p->nChoiceNodes = nChoiceNodes; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Map_ManSetChoiceNum ( Map_Man_t p,
int  nChoices 
)

Definition at line 73 of file mapperCreate.c.

73 { p->nChoices = nChoices; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Map_ManSetDelayTarget ( Map_Man_t p,
float  DelayTarget 
)

Definition at line 65 of file mapperCreate.c.

65 { p->DelayTarget = DelayTarget;}
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Map_ManSetFanoutViolations ( Map_Man_t p,
int  nVio 
)

Definition at line 71 of file mapperCreate.c.

71 { p->nFanoutViolations = nVio; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Map_ManSetInputArrivals ( Map_Man_t p,
Map_Time_t pArrivals 
)

Definition at line 66 of file mapperCreate.c.

66 { p->pInputArrivals = pArrivals; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Map_ManSetNumIterations ( Map_Man_t p,
int  nIterations 
)

Definition at line 69 of file mapperCreate.c.

69 { p->nIterations = nIterations; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Map_ManSetObeyFanoutLimits ( Map_Man_t p,
int  fObeyFanoutLimits 
)

Definition at line 68 of file mapperCreate.c.

68 { p->fObeyFanoutLimits = fObeyFanoutLimits; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Map_ManSetOutputNames ( Map_Man_t p,
char **  ppNames 
)

Definition at line 63 of file mapperCreate.c.

63 { p->ppOutputNames = ppNames;}
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Map_ManSetOutputRequireds ( Map_Man_t p,
Map_Time_t pRequireds 
)

Definition at line 67 of file mapperCreate.c.

67 { p->pOutputRequireds = pRequireds; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Map_ManSetSwitching ( Map_Man_t p,
int  fSwitching 
)

Definition at line 75 of file mapperCreate.c.

75 { p->fSwitching = fSwitching; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Map_ManSetVerbose ( Map_Man_t p,
int  fVerbose 
)

Definition at line 74 of file mapperCreate.c.

74 { p->fVerbose = fVerbose; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Map_Node_t* Map_NodeAnd ( Map_Man_t pMan,
Map_Node_t p1,
Map_Node_t p2 
)

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 447 of file mapperCreate.c.

448 {
449  Map_Node_t * pEnt;
450  unsigned Key;
451 
452  if ( p1 == p2 )
453  return p1;
454  if ( p1 == Map_Not(p2) )
455  return Map_Not(pMan->pConst1);
456  if ( Map_NodeIsConst(p1) )
457  {
458  if ( p1 == pMan->pConst1 )
459  return p2;
460  return Map_Not(pMan->pConst1);
461  }
462  if ( Map_NodeIsConst(p2) )
463  {
464  if ( p2 == pMan->pConst1 )
465  return p1;
466  return Map_Not(pMan->pConst1);
467  }
468 
469  if ( Map_Regular(p1)->Num > Map_Regular(p2)->Num )
470  pEnt = p1, p1 = p2, p2 = pEnt;
471 
472  Key = Map_HashKey2( p1, p2, pMan->nBins );
473  for ( pEnt = pMan->pBins[Key]; pEnt; pEnt = pEnt->pNext )
474  if ( pEnt->p1 == p1 && pEnt->p2 == p2 )
475  return pEnt;
476  // resize the table
477  if ( pMan->nNodes >= 2 * pMan->nBins )
478  {
479  Map_TableResize( pMan );
480  Key = Map_HashKey2( p1, p2, pMan->nBins );
481  }
482  // create the new node
483  pEnt = Map_NodeCreate( pMan, p1, p2 );
484  // add the node to the corresponding linked list in the table
485  pEnt->pNext = pMan->pBins[Key];
486  pMan->pBins[Key] = pEnt;
487  return pEnt;
488 }
Map_Node_t * pNext
Definition: mapperInt.h:205
static unsigned Map_HashKey2(Map_Node_t *p0, Map_Node_t *p1, int TableSize)
Definition: mapperCreate.c:32
int Map_NodeIsConst(Map_Node_t *p)
Definition: mapperCreate.c:112
static void Map_TableResize(Map_Man_t *p)
Definition: mapperCreate.c:502
Map_Node_t * p2
Definition: mapperInt.h:222
Map_Node_t * p1
Definition: mapperInt.h:221
#define Map_Regular(p)
Definition: mapper.h:68
Map_Node_t * Map_NodeCreate(Map_Man_t *p, Map_Node_t *p1, Map_Node_t *p2)
Definition: mapperCreate.c:364
#define Map_Not(p)
Definition: mapper.h:69
Map_Node_t* Map_NodeBuf ( Map_Man_t p,
Map_Node_t p1 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 552 of file mapperCreate.c.

553 {
554  Map_Node_t * pNode = Map_NodeCreate( p, p1, NULL );
555  Map_NodeVecPush( p->vMapBufs, pNode );
556  return pNode;
557 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Map_Node_t * Map_NodeCreate(Map_Man_t *p, Map_Node_t *p1, Map_Node_t *p2)
Definition: mapperCreate.c:364
void Map_NodeVecPush(Map_NodeVec_t *p, Map_Node_t *Entry)
Definition: mapperVec.c:190
int Map_NodeComparePhase ( Map_Node_t p1,
Map_Node_t p2 
)

Definition at line 116 of file mapperCreate.c.

116 { assert( !Map_IsComplement(p1) ); assert( !Map_IsComplement(p2) ); return p1->fInv ^ p2->fInv; }
#define Map_IsComplement(p)
GLOBAL VARIABLES ///.
Definition: mapper.h:67
#define assert(ex)
Definition: util_old.h:213
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 364 of file mapperCreate.c.

365 {
366  Map_Node_t * pNode;
367  // create the node
368  pNode = (Map_Node_t *)Extra_MmFixedEntryFetch( p->mmNodes );
369  memset( pNode, 0, sizeof(Map_Node_t) );
370  pNode->tRequired[0].Rise = pNode->tRequired[0].Fall = pNode->tRequired[0].Worst = MAP_FLOAT_LARGE;
371  pNode->tRequired[1].Rise = pNode->tRequired[1].Fall = pNode->tRequired[1].Worst = MAP_FLOAT_LARGE;
372  pNode->p1 = p1;
373  pNode->p2 = p2;
374  pNode->p = p;
375  // set the number of this node
376  pNode->Num = p->nNodes++;
377  // place to store the fanouts
378 // pNode->vFanouts = Map_NodeVecAlloc( 5 );
379  // store this node in the internal array
380  if ( pNode->Num >= 0 )
381  Map_NodeVecPush( p->vMapObjs, pNode );
382  else
383  pNode->fInv = 1;
384  // set the level of this node
385  if ( p1 )
386  {
387 #ifdef MAP_ALLOCATE_FANOUT
388  // create the fanout info
389  Map_NodeAddFaninFanout( Map_Regular(p1), pNode );
390  if ( p2 )
391  Map_NodeAddFaninFanout( Map_Regular(p2), pNode );
392 #endif
393 
394  if ( p2 )
395  {
396  pNode->Level = 1 + MAP_MAX(Map_Regular(pNode->p1)->Level, Map_Regular(pNode->p2)->Level);
398  }
399  else
400  {
401  pNode->Level = Map_Regular(pNode->p1)->Level;
402  pNode->fInv = Map_NodeIsSimComplement(p1);
403  }
404  }
405  // reference the inputs (will be used to compute the number of fanouts)
406  if ( p1 ) Map_NodeRef(p1);
407  if ( p2 ) Map_NodeRef(p2);
408 
409  pNode->nRefEst[0] = pNode->nRefEst[1] = -1;
410  return pNode;
411 }
char * memset()
void Map_NodeAddFaninFanout(Map_Node_t *pFanin, Map_Node_t *pFanout)
Map_Man_t * p
Definition: mapperInt.h:204
#define MAP_FLOAT_LARGE
Definition: mapperInt.h:60
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Map_Time_t tRequired[2]
Definition: mapperInt.h:236
char * Extra_MmFixedEntryFetch(Extra_MmFixed_t *p)
unsigned Level
Definition: mapperInt.h:214
#define Map_NodeRef(p)
Definition: mapperInt.h:74
Map_Node_t * p2
Definition: mapperInt.h:222
Map_Node_t * p1
Definition: mapperInt.h:221
float nRefEst[3]
Definition: mapperInt.h:217
#define Map_Regular(p)
Definition: mapper.h:68
void Map_NodeVecPush(Map_NodeVec_t *p, Map_Node_t *Entry)
Definition: mapperVec.c:190
#define Map_NodeIsSimComplement(p)
Definition: mapperInt.h:83
#define MAP_MAX(a, b)
Definition: mapperInt.h:57
int Map_NodeIsAnd ( Map_Node_t p)

Definition at line 115 of file mapperCreate.c.

115 { return (Map_Regular(p))->p1 != NULL && (Map_Regular(p))->p2 != NULL; }
#define Map_Regular(p)
Definition: mapper.h:68
int Map_NodeIsBuf ( Map_Node_t p)

Definition at line 114 of file mapperCreate.c.

114 { return (Map_Regular(p))->p1 != NULL && (Map_Regular(p))->p2 == NULL; }
#define Map_Regular(p)
Definition: mapper.h:68
int Map_NodeIsConst ( Map_Node_t p)

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

Synopsis [Checks the type of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 112 of file mapperCreate.c.

112 { return (Map_Regular(p))->Num == -1; }
#define Map_Regular(p)
Definition: mapper.h:68
int Map_NodeIsVar ( Map_Node_t p)

Definition at line 113 of file mapperCreate.c.

113 { return (Map_Regular(p))->p1 == NULL && (Map_Regular(p))->Num >= 0; }
#define Map_Regular(p)
Definition: mapper.h:68
Map_Cut_t* Map_NodeReadCutBest ( Map_Node_t p,
int  fPhase 
)

Definition at line 93 of file mapperCreate.c.

93 { return p->pCutBest[fPhase]; }
Map_Cut_t * pCutBest[2]
Definition: mapperInt.h:239
Map_Cut_t* Map_NodeReadCuts ( Map_Node_t p)

Definition at line 92 of file mapperCreate.c.

92 { return p->pCuts; }
Map_Cut_t * pCuts
Definition: mapperInt.h:240
char* Map_NodeReadData ( Map_Node_t p,
int  fPhase 
)

Definition at line 89 of file mapperCreate.c.

89 { return fPhase? p->pData1 : p->pData0; }
int Map_NodeReadLevel ( Map_Node_t p)

Definition at line 91 of file mapperCreate.c.

91 { return Map_Regular(p)->Level; }
#define Map_Regular(p)
Definition: mapper.h:68
Map_Man_t* Map_NodeReadMan ( Map_Node_t p)

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

Synopsis [Reads parameters from the mapping node.]

Description []

SideEffects []

SeeAlso []

Definition at line 88 of file mapperCreate.c.

88 { return p->p; }
Map_Man_t * p
Definition: mapperInt.h:204
int Map_NodeReadNum ( Map_Node_t p)

Definition at line 90 of file mapperCreate.c.

90 { return p->Num; }
Map_Node_t* Map_NodeReadOne ( Map_Node_t p)

Definition at line 94 of file mapperCreate.c.

94 { return p->p1; }
Map_Node_t * p1
Definition: mapperInt.h:221
Map_Node_t* Map_NodeReadTwo ( Map_Node_t p)

Definition at line 95 of file mapperCreate.c.

95 { return p->p2; }
Map_Node_t * p2
Definition: mapperInt.h:222
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 571 of file mapperCreate.c.

572 {
573  pNodeNew->pNextE = pNodeOld->pNextE;
574  pNodeOld->pNextE = pNodeNew;
575  pNodeNew->pRepr = pNodeOld;
576 }
Map_Node_t * pNextE
Definition: mapperInt.h:223
Map_Node_t * pRepr
Definition: mapperInt.h:224
void Map_NodeSetData ( Map_Node_t p,
int  fPhase,
char *  pData 
)

Definition at line 96 of file mapperCreate.c.

96 { if (fPhase) p->pData1 = pData; else p->pData0 = pData; }
void Map_NodeSetNextE ( Map_Node_t p,
Map_Node_t pNextE 
)

Definition at line 97 of file mapperCreate.c.

97 { p->pNextE = pNextE; }
Map_Node_t * pNextE
Definition: mapperInt.h:223
void Map_NodeSetRepr ( Map_Node_t p,
Map_Node_t pRepr 
)

Definition at line 98 of file mapperCreate.c.

98 { p->pRepr = pRepr; }
Map_Node_t * pRepr
Definition: mapperInt.h:224
void Map_NodeSetSwitching ( Map_Node_t p,
float  Switching 
)

Definition at line 99 of file mapperCreate.c.

99 { p->Switching = Switching; }
float Map_SuperLibReadAreaInv ( Map_SuperLib_t p)

Definition at line 161 of file mapperCreate.c.

161 { return p->AreaInv; }
Map_Time_t Map_SuperLibReadDelayInv ( Map_SuperLib_t p)

Definition at line 162 of file mapperCreate.c.

162 { return p->tDelayInv;}
Map_Time_t tDelayInv
Definition: mapperInt.h:189
Mio_Library_t* Map_SuperLibReadGenLib ( Map_SuperLib_t p)

Definition at line 160 of file mapperCreate.c.

160 { return p->pGenlib; }
Mio_Library_t * pGenlib
Definition: mapperInt.h:169
int Map_SuperLibReadVarsMax ( Map_SuperLib_t p)

Definition at line 163 of file mapperCreate.c.

163 { return p->nVarsMax; }
int Map_SuperReadFaninNum ( Map_Super_t p)

Definition at line 154 of file mapperCreate.c.

154 { return p->nFanins; }
unsigned nFanins
Definition: mapperInt.h:280
Map_Super_t** Map_SuperReadFanins ( Map_Super_t p)

Definition at line 153 of file mapperCreate.c.

153 { return p->pFanins; }
Map_Super_t * pFanins[6]
Definition: mapperInt.h:287
int Map_SuperReadFanoutLimit ( Map_Super_t p)

Definition at line 158 of file mapperCreate.c.

158 { return p->nFanLimit;}
unsigned nFanLimit
Definition: mapperInt.h:282
char* Map_SuperReadFormula ( Map_Super_t p)

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

Synopsis [Reads parameters from the supergate.]

Description []

SideEffects []

SeeAlso []

Definition at line 150 of file mapperCreate.c.

150 { return p->pFormula; }
Map_Super_t* Map_SuperReadNext ( Map_Super_t p)

Definition at line 155 of file mapperCreate.c.

155 { return p->pNext; }
Map_Super_t * pNext
Definition: mapperInt.h:295
int Map_SuperReadNum ( Map_Super_t p)

Definition at line 152 of file mapperCreate.c.

152 { return p->Num; }
int Map_SuperReadNumPhases ( Map_Super_t p)

Definition at line 156 of file mapperCreate.c.

156 { return p->nPhases; }
unsigned nPhases
Definition: mapperInt.h:284
unsigned char* Map_SuperReadPhases ( Map_Super_t p)

Definition at line 157 of file mapperCreate.c.

157 { return p->uPhases; }
unsigned char uPhases[4]
Definition: mapperInt.h:285
Mio_Gate_t* Map_SuperReadRoot ( Map_Super_t p)

Definition at line 151 of file mapperCreate.c.

151 { return p->pRoot; }
Mio_Gate_t * pRoot
Definition: mapperInt.h:288
void Map_TableCreate ( Map_Man_t pMan)
static

DECLARATIONS ///.

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 [

Id:
mapperCreate.c,v 1.15 2005/02/28 05:34:26 alanmi Exp

]

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

Synopsis [Create the unique table of AND gates.]

Description []

SideEffects []

SeeAlso []

Definition at line 424 of file mapperCreate.c.

425 {
426  assert( pMan->pBins == NULL );
427  pMan->nBins = Abc_PrimeCudd(5000);
428  pMan->pBins = ABC_ALLOC( Map_Node_t *, pMan->nBins );
429  memset( pMan->pBins, 0, sizeof(Map_Node_t *) * pMan->nBins );
430  pMan->nNodes = 0;
431 }
char * memset()
static int Abc_PrimeCudd(unsigned int p)
Definition: abc_global.h:383
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
#define assert(ex)
Definition: util_old.h:213
void Map_TableResize ( Map_Man_t pMan)
static

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

Synopsis [Resizes the table.]

Description []

SideEffects []

SeeAlso []

Definition at line 502 of file mapperCreate.c.

503 {
504  Map_Node_t ** pBinsNew;
505  Map_Node_t * pEnt, * pEnt2;
506  int nBinsNew, Counter, i;
507  abctime clk;
508  unsigned Key;
509 
510 clk = Abc_Clock();
511  // get the new table size
512  nBinsNew = Abc_PrimeCudd(2 * pMan->nBins);
513  // allocate a new array
514  pBinsNew = ABC_ALLOC( Map_Node_t *, nBinsNew );
515  memset( pBinsNew, 0, sizeof(Map_Node_t *) * nBinsNew );
516  // rehash the entries from the old table
517  Counter = 0;
518  for ( i = 0; i < pMan->nBins; i++ )
519  for ( pEnt = pMan->pBins[i], pEnt2 = pEnt? pEnt->pNext: NULL; pEnt;
520  pEnt = pEnt2, pEnt2 = pEnt? pEnt->pNext: NULL )
521  {
522  Key = Map_HashKey2( pEnt->p1, pEnt->p2, nBinsNew );
523  pEnt->pNext = pBinsNew[Key];
524  pBinsNew[Key] = pEnt;
525  Counter++;
526  }
527  assert( Counter == pMan->nNodes - pMan->nInputs );
528  if ( pMan->fVerbose )
529  {
530 // printf( "Increasing the unique table size from %6d to %6d. ", pMan->nBins, nBinsNew );
531 // ABC_PRT( "Time", Abc_Clock() - clk );
532  }
533  // replace the table and the parameters
534  ABC_FREE( pMan->pBins );
535  pMan->pBins = pBinsNew;
536  pMan->nBins = nBinsNew;
537 }
char * memset()
static int Abc_PrimeCudd(unsigned int p)
Definition: abc_global.h:383
Map_Node_t * pNext
Definition: mapperInt.h:205
static unsigned Map_HashKey2(Map_Node_t *p0, Map_Node_t *p1, int TableSize)
Definition: mapperCreate.c:32
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Counter
Map_Node_t * p2
Definition: mapperInt.h:222
Map_Node_t * p1
Definition: mapperInt.h:221
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define assert(ex)
Definition: util_old.h:213
ABC_INT64_T abctime
Definition: abc_global.h:278