ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
mapperUtils.c File Reference
#include "mapperInt.h"
Include dependency graph for mapperUtils.c:

Go to the source code of this file.

Macros

#define MAP_CO_LIST_SIZE   5
 DECLARATIONS ///.
 

Functions

void Map_MappingDfs_rec (Map_Node_t *pNode, Map_NodeVec_t *vNodes, int fCollectEquiv)
 FUNCTION DEFINITIONS ///.
 
Map_NodeVec_tMap_MappingDfs (Map_Man_t *pMan, int fCollectEquiv)
 
int Map_MappingCountLevels (Map_Man_t *pMan)
 
void Map_MappingUnmark (Map_Man_t *pMan)
 
void Map_MappingUnmark_rec (Map_Node_t *pNode)
 
void Map_MappingMark_rec (Map_Node_t *pNode)
 
void Map_MappingPrintOutputArrivals (Map_Man_t *p)
 
void Map_MappingSetupTruthTables (unsigned uTruths[][2])
 
void Map_MappingSetupTruthTablesLarge (unsigned uTruths[][32])
 
void Map_MappingSetupMask (unsigned uMask[], int nVarsMax)
 
int Map_ManCheckConsistency (Map_Man_t *p)
 
int Map_MappingNodeIsViolator (Map_Node_t *pNode, Map_Cut_t *pCut, int fPosPol)
 
float Map_MappingGetAreaFlow (Map_Man_t *p)
 
int Map_CompareNodesByLevel (Map_Node_t **ppS1, Map_Node_t **ppS2)
 
void Map_MappingSortByLevel (Map_Man_t *pMan, Map_NodeVec_t *vNodes)
 
int Map_CompareNodesByPointer (Map_Node_t **ppS1, Map_Node_t **ppS2)
 
int Map_MappingCountDoubles (Map_Man_t *pMan, Map_NodeVec_t *vNodes)
 
st__tableMap_CreateTableGate2Super (Map_Man_t *pMan)
 
void Map_ManCleanData (Map_Man_t *p)
 
void Map_MappingExpandTruth (unsigned uTruth[2], int nVars)
 
float Map_MappingComputeDelayWithFanouts (Map_Man_t *p)
 
int Map_MappingGetMaxLevel (Map_Man_t *pMan)
 
int Map_MappingUpdateLevel_rec (Map_Man_t *pMan, Map_Node_t *pNode, int fMaximum)
 
void Map_MappingSetChoiceLevels (Map_Man_t *pMan)
 
void Map_MappingReportChoices (Map_Man_t *pMan)
 

Macro Definition Documentation

◆ MAP_CO_LIST_SIZE

#define MAP_CO_LIST_SIZE   5

DECLARATIONS ///.

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

FileName [mapperUtils.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
mapperUtils.c,v 1.8 2004/11/03 22:41:45 satrajit Exp

]

Definition at line 28 of file mapperUtils.c.

Function Documentation

◆ Map_CompareNodesByLevel()

int Map_CompareNodesByLevel ( Map_Node_t ** ppS1,
Map_Node_t ** ppS2 )

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

Synopsis [Compares the supergates by their level.]

Description []

SideEffects []

SeeAlso []

Definition at line 522 of file mapperUtils.c.

523{
524 Map_Node_t * pN1 = Map_Regular(*ppS1);
525 Map_Node_t * pN2 = Map_Regular(*ppS2);
526 if ( pN1->Level > pN2->Level )
527 return -1;
528 if ( pN1->Level < pN2->Level )
529 return 1;
530 return 0;
531}
#define Map_Regular(p)
Definition mapper.h:68
struct Map_NodeStruct_t_ Map_Node_t
Definition mapper.h:41
Here is the caller graph for this function:

◆ Map_CompareNodesByPointer()

int Map_CompareNodesByPointer ( Map_Node_t ** ppS1,
Map_Node_t ** ppS2 )

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

Synopsis [Compares the supergates by their pointer.]

Description []

SideEffects []

SeeAlso []

Definition at line 563 of file mapperUtils.c.

564{
565 if ( *ppS1 < *ppS2 )
566 return -1;
567 if ( *ppS1 > *ppS2 )
568 return 1;
569 return 0;
570}

◆ Map_CreateTableGate2Super()

st__table * Map_CreateTableGate2Super ( Map_Man_t * pMan)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 613 of file mapperUtils.c.

614{
615 Map_Super_t * pSuper;
616 st__table * tTable;
617 int i, nInputs, v;
619 for ( i = 0; i < pMan->pSuperLib->nSupersAll; i++ )
620 {
621 pSuper = pMan->pSuperLib->ppSupers[i];
622 if ( pSuper->nGates == 1 )
623 {
624 // skip different versions of the same root gate
625 nInputs = Mio_GateReadPinNum(pSuper->pRoot);
626 for ( v = 0; v < nInputs; v++ )
627 if ( pSuper->pFanins[v]->Num != nInputs - 1 - v )
628 break;
629 if ( v != nInputs )
630 continue;
631// printf( "%s\n", Mio_GateReadName(pSuper->pRoot) );
632 if ( st__insert( tTable, (char *)pSuper->pRoot, (char *)pSuper ) )
633 {
634 assert( 0 );
635 }
636 }
637 }
638 return tTable;
639}
struct Map_SuperStruct_t_ Map_Super_t
Definition mapper.h:45
int Mio_GateReadPinNum(Mio_Gate_t *pGate)
Definition mioApi.c:177
int st__strhash(const char *string, int modulus)
Definition st.c:449
st__table * st__init_table(st__compare_func_type compare, st__hash_func_type hash)
Definition st.c:72
int st__insert(st__table *table, const char *key, char *value)
Definition st.c:171
Mio_Gate_t * pRoot
Definition mapperInt.h:292
Map_Super_t * pFanins[6]
Definition mapperInt.h:291
Definition st.h:52
#define assert(ex)
Definition util_old.h:213
int strcmp()
Here is the call graph for this function:

◆ Map_ManCheckConsistency()

int Map_ManCheckConsistency ( Map_Man_t * p)

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

Synopsis [Verify one useful property.]

Description [This procedure verifies one useful property. After the FRAIG construction with choice nodes is over, each primary node should have fanins that are primary nodes. The primary nodes is the one that does not have pNode->pRepr set to point to another node.]

SideEffects []

SeeAlso []

Definition at line 427 of file mapperUtils.c.

428{
429 Map_Node_t * pNode;
430 Map_NodeVec_t * pVec;
431 int i;
432 pVec = Map_MappingDfs( p, 0 );
433 for ( i = 0; i < pVec->nSize; i++ )
434 {
435 pNode = pVec->pArray[i];
436 if ( Map_NodeIsVar(pNode) )
437 {
438 if ( pNode->pRepr )
439 printf( "Primary input %d is a secondary node.\n", pNode->Num );
440 }
441 else if ( Map_NodeIsConst(pNode) )
442 {
443 if ( pNode->pRepr )
444 printf( "Constant 1 %d is a secondary node.\n", pNode->Num );
445 }
446 else
447 {
448 if ( pNode->pRepr )
449 printf( "Internal node %d is a secondary node.\n", pNode->Num );
450 if ( Map_Regular(pNode->p1)->pRepr )
451 printf( "Internal node %d has first fanin that is a secondary node.\n", pNode->Num );
452 if ( Map_Regular(pNode->p2)->pRepr )
453 printf( "Internal node %d has second fanin that is a secondary node.\n", pNode->Num );
454 }
455 }
456 Map_NodeVecFree( pVec );
457 return 1;
458}
Cube * p
Definition exorList.c:222
void Map_NodeVecFree(Map_NodeVec_t *p)
Definition mapperVec.c:68
Map_NodeVec_t * Map_MappingDfs(Map_Man_t *pMan, int fCollectEquiv)
Definition mapperUtils.c:77
int Map_NodeIsConst(Map_Node_t *p)
int Map_NodeIsVar(Map_Node_t *p)
struct Map_NodeVecStruct_t_ Map_NodeVec_t
Definition mapper.h:42
Map_Node_t * pRepr
Definition mapperInt.h:228
Map_Node_t * p2
Definition mapperInt.h:226
Map_Node_t * p1
Definition mapperInt.h:225
Map_Node_t ** pArray
Definition mapperInt.h:305
Here is the call graph for this function:

◆ Map_ManCleanData()

void Map_ManCleanData ( Map_Man_t * p)

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

Synopsis [Get the FRAIG node with phase.]

Description []

SideEffects []

SeeAlso []

Definition at line 652 of file mapperUtils.c.

653{
654 int i;
655 for ( i = 0; i < p->vMapObjs->nSize; i++ )
656 p->vMapObjs->pArray[i]->pData0 = p->vMapObjs->pArray[i]->pData1 = 0;
657}
Here is the caller graph for this function:

◆ Map_MappingComputeDelayWithFanouts()

float Map_MappingComputeDelayWithFanouts ( Map_Man_t * p)

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

Synopsis [Compute the arrival times.]

Description []

SideEffects []

SeeAlso []

Definition at line 713 of file mapperUtils.c.

714{
715 Map_Node_t * pNode;
716 float Result;
717 int i;
718 for ( i = 0; i < p->vMapObjs->nSize; i++ )
719 {
720 // skip primary inputs
721 pNode = p->vMapObjs->pArray[i];
722 if ( !Map_NodeIsAnd( pNode ) )
723 continue;
724 // skip a secondary node
725 if ( pNode->pRepr )
726 continue;
727 // count the switching nodes
728 if ( pNode->nRefAct[0] > 0 )
729 Map_TimeCutComputeArrival( pNode, pNode->pCutBest[0], 0, MAP_FLOAT_LARGE );
730 if ( pNode->nRefAct[1] > 0 )
731 Map_TimeCutComputeArrival( pNode, pNode->pCutBest[1], 1, MAP_FLOAT_LARGE );
732 }
734 printf( "Max arrival times with fanouts = %10.2f.\n", Result );
735 return Result;
736}
float Map_TimeComputeArrivalMax(Map_Man_t *p)
DECLARATIONS ///.
Definition mapperTime.c:45
#define MAP_FLOAT_LARGE
Definition mapperInt.h:61
float Map_TimeCutComputeArrival(Map_Node_t *pNode, Map_Cut_t *pCut, int fPhase, float tWorstCaseLimit)
Definition mapperTime.c:75
int Map_NodeIsAnd(Map_Node_t *p)
Map_Cut_t * pCutBest[2]
Definition mapperInt.h:243
Here is the call graph for this function:

◆ Map_MappingCountDoubles()

int Map_MappingCountDoubles ( Map_Man_t * pMan,
Map_NodeVec_t * vNodes )

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

Synopsis [Counts how many AIG nodes are mapped in both polarities.]

Description []

SideEffects []

SeeAlso []

Definition at line 583 of file mapperUtils.c.

584{
585 Map_Node_t * pNode;
586 int Counter, i;
587 // count the number of equal adjacent nodes
588 Counter = 0;
589 for ( i = 0; i < vNodes->nSize; i++ )
590 {
591 pNode = vNodes->pArray[i];
592 if ( !Map_NodeIsAnd(pNode) )
593 continue;
594 if ( (pNode->nRefAct[0] && pNode->pCutBest[0]) &&
595 (pNode->nRefAct[1] && pNode->pCutBest[1]) )
596 Counter++;
597 }
598 return Counter;
599}
Here is the call graph for this function:

◆ Map_MappingCountLevels()

int Map_MappingCountLevels ( Map_Man_t * pMan)

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

Synopsis [Computes the number of logic levels not counting PIs/POs.]

Description []

SideEffects [Note that this procedure will reassign the levels assigned originally by NodeCreate() because it counts the number of levels with choices differently!]

SeeAlso []

Definition at line 105 of file mapperUtils.c.

106{
107 int i, LevelsMax, LevelsCur;
108 // perform the traversal
109 LevelsMax = -1;
110 for ( i = 0; i < pMan->nOutputs; i++ )
111 {
112 LevelsCur = Map_MappingCountLevels_rec( Map_Regular(pMan->pOutputs[i]) );
113 if ( LevelsMax < LevelsCur )
114 LevelsMax = LevelsCur;
115 }
116 for ( i = 0; i < pMan->nOutputs; i++ )
117 Map_MappingUnmark_rec( Map_Regular(pMan->pOutputs[i]) );
118 return LevelsMax;
119}
void Map_MappingUnmark_rec(Map_Node_t *pNode)
Here is the call graph for this function:

◆ Map_MappingDfs()

Map_NodeVec_t * Map_MappingDfs ( Map_Man_t * pMan,
int fCollectEquiv )

Definition at line 77 of file mapperUtils.c.

78{
79 Map_NodeVec_t * vNodes;
80 int i;
81 // perform the traversal
82 vNodes = Map_NodeVecAlloc( 100 );
83 for ( i = 0; i < pMan->nOutputs; i++ )
84 Map_MappingDfs_rec( Map_Regular(pMan->pOutputs[i]), vNodes, fCollectEquiv );
85 for ( i = 0; i < vNodes->nSize; i++ )
86 vNodes->pArray[i]->fMark0 = 0;
87// for ( i = 0; i < pMan->nOutputs; i++ )
88// Map_MappingUnmark_rec( Map_Regular(pMan->pOutputs[i]) );
89 return vNodes;
90}
Map_NodeVec_t * Map_NodeVecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition mapperVec.c:45
void Map_MappingDfs_rec(Map_Node_t *pNode, Map_NodeVec_t *vNodes, int fCollectEquiv)
FUNCTION DEFINITIONS ///.
Definition mapperUtils.c:56
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Map_MappingDfs_rec()

void Map_MappingDfs_rec ( Map_Node_t * pNode,
Map_NodeVec_t * vNodes,
int fCollectEquiv )

FUNCTION DEFINITIONS ///.

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

Synopsis [Computes the DFS ordering of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 56 of file mapperUtils.c.

57{
58 assert( !Map_IsComplement(pNode) );
59 if ( pNode->fMark0 )
60 return;
61 // visit the transitive fanin
62 if ( Map_NodeIsAnd(pNode) )
63 {
64 Map_MappingDfs_rec( Map_Regular(pNode->p1), vNodes, fCollectEquiv );
65 Map_MappingDfs_rec( Map_Regular(pNode->p2), vNodes, fCollectEquiv );
66 }
67 // visit the equivalent nodes
68 if ( fCollectEquiv && pNode->pNextE )
69 Map_MappingDfs_rec( pNode->pNextE, vNodes, fCollectEquiv );
70 // make sure the node is not visited through the equivalent nodes
71 assert( pNode->fMark0 == 0 );
72 // mark the node as visited
73 pNode->fMark0 = 1;
74 // add the node to the list
75 Map_NodeVecPush( vNodes, pNode );
76}
void Map_NodeVecPush(Map_NodeVec_t *p, Map_Node_t *Entry)
Definition mapperVec.c:190
#define Map_IsComplement(p)
GLOBAL VARIABLES ///.
Definition mapper.h:67
Map_Node_t * pNextE
Definition mapperInt.h:227
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Map_MappingExpandTruth()

void Map_MappingExpandTruth ( unsigned uTruth[2],
int nVars )

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

Synopsis [Expand the truth table]

Description []

SideEffects []

SeeAlso []

Definition at line 670 of file mapperUtils.c.

671{
672 assert( nVars < 7 );
673 if ( nVars == 6 )
674 return;
675 if ( nVars < 5 )
676 {
677 uTruth[0] &= MAP_MASK( (1<<nVars) );
678 uTruth[0] = Map_MappingExpandTruth_rec( uTruth[0], nVars );
679 }
680 uTruth[1] = uTruth[0];
681}
#define MAP_MASK(n)
INCLUDES ///.
Definition mapperInt.h:52

◆ Map_MappingGetAreaFlow()

float Map_MappingGetAreaFlow ( Map_Man_t * p)

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

Synopsis [Computes the total are flow of the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 487 of file mapperUtils.c.

488{
489 Map_Node_t * pNode;
490 Map_Cut_t * pCut;
491 float aFlowFlowTotal = 0;
492 int fPosPol, i;
493 for ( i = 0; i < p->nOutputs; i++ )
494 {
495 pNode = Map_Regular(p->pOutputs[i]);
496 if ( !Map_NodeIsAnd(pNode) )
497 continue;
498 fPosPol = !Map_IsComplement(p->pOutputs[i]);
499 pCut = pNode->pCutBest[fPosPol];
500 if ( pCut == NULL )
501 {
502 fPosPol = !fPosPol;
503 pCut = pNode->pCutBest[fPosPol];
504 }
505 aFlowFlowTotal += pNode->pCutBest[fPosPol]->M[fPosPol].AreaFlow;
506 }
507 return aFlowFlowTotal;
508}
struct Map_CutStruct_t_ Map_Cut_t
Definition mapper.h:43
Map_Match_t M[2]
Definition mapperInt.h:275
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Map_MappingGetMaxLevel()

int Map_MappingGetMaxLevel ( Map_Man_t * pMan)

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

Synopsis [Sets up the mask.]

Description []

SideEffects []

SeeAlso []

Definition at line 750 of file mapperUtils.c.

751{
752 int nLevelMax, i;
753 nLevelMax = 0;
754 for ( i = 0; i < pMan->nOutputs; i++ )
755 nLevelMax = ((unsigned)nLevelMax) > Map_Regular(pMan->pOutputs[i])->Level?
756 nLevelMax : Map_Regular(pMan->pOutputs[i])->Level;
757 return nLevelMax;
758}
Here is the caller graph for this function:

◆ Map_MappingMark_rec()

void Map_MappingMark_rec ( Map_Node_t * pNode)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 207 of file mapperUtils.c.

208{
209 assert( !Map_IsComplement(pNode) );
210 if ( pNode->fMark0 == 1 )
211 return;
212 pNode->fMark0 = 1;
213 if ( !Map_NodeIsAnd(pNode) )
214 return;
215 // visit the transitive fanin of the selected cut
218}
void Map_MappingMark_rec(Map_Node_t *pNode)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Map_MappingNodeIsViolator()

int Map_MappingNodeIsViolator ( Map_Node_t * pNode,
Map_Cut_t * pCut,
int fPosPol )

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

Synopsis [Returns 1 if current mapping of the node violates fanout limits.]

Description []

SideEffects []

SeeAlso []

Definition at line 471 of file mapperUtils.c.

472{
473 return pNode->nRefAct[fPosPol] > (int)pCut->M[fPosPol].pSuperBest->nFanLimit;
474}
Map_Super_t * pSuperBest
Definition mapperInt.h:257

◆ Map_MappingPrintOutputArrivals()

void Map_MappingPrintOutputArrivals ( Map_Man_t * p)

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

Synopsis [Prints a bunch of latest arriving outputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 289 of file mapperUtils.c.

290{
291 int pSorted[MAP_CO_LIST_SIZE];
292 Map_Time_t * pTimes;
293 Map_Node_t * pNode;
294 int fPhase, Limit, i;
295 int MaxNameSize;
296
297 // determine the number of nodes to print
298 Limit = (p->nOutputs > MAP_CO_LIST_SIZE)? MAP_CO_LIST_SIZE : p->nOutputs;
299
300 // determine the order
301 Map_MappingFindLatest( p, pSorted, Limit );
302
303 // determine max size of the node's name
304 MaxNameSize = 0;
305 for ( i = 0; i < Limit; i++ )
306 if ( MaxNameSize < (int)strlen(p->ppOutputNames[pSorted[i]]) )
307 MaxNameSize = strlen(p->ppOutputNames[pSorted[i]]);
308
309 // print the latest outputs
310 for ( i = 0; i < Limit; i++ )
311 {
312 // get the i-th latest output
313 pNode = Map_Regular(p->pOutputs[pSorted[i]]);
314 fPhase =!Map_IsComplement(p->pOutputs[pSorted[i]]);
315 pTimes = pNode->tArrival + fPhase;
316 // print out the best arrival time
317 printf( "Output %-*s : ", MaxNameSize + 3, p->ppOutputNames[pSorted[i]] );
318 printf( "Delay = (%5.2f, %5.2f) ", (double)pTimes->Rise, (double)pTimes->Fall );
319 printf( "%s", fPhase? "POS" : "NEG" );
320 printf( "\n" );
321 }
322}
#define MAP_CO_LIST_SIZE
DECLARATIONS ///.
Definition mapperUtils.c:28
struct Map_TimeStruct_t_ Map_Time_t
Definition mapper.h:49
Map_Time_t tArrival[2]
Definition mapperInt.h:239
int strlen()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Map_MappingReportChoices()

void Map_MappingReportChoices ( Map_Man_t * pMan)

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

Synopsis [Reports statistics on choice nodes.]

Description [The number of choice nodes is the number of primary nodes, which has pNextE set to a pointer. The number of choices is the number of entries in the equivalent-node lists of the primary nodes.]

SideEffects []

SeeAlso []

Definition at line 842 of file mapperUtils.c.

843{
844 Map_Node_t * pNode, * pTemp;
845 int nChoiceNodes, nChoices;
846 int i, LevelMax1, LevelMax2;
847
848 // report the number of levels
849 LevelMax1 = Map_MappingGetMaxLevel( pMan );
850 pMan->nTravIds++;
851 for ( i = 0; i < pMan->nOutputs; i++ )
852 Map_MappingUpdateLevel_rec( pMan, Map_Regular(pMan->pOutputs[i]), 0 );
853 LevelMax2 = Map_MappingGetMaxLevel( pMan );
854
855 // report statistics about choices
856 nChoiceNodes = nChoices = 0;
857 for ( i = 0; i < pMan->vMapObjs->nSize; i++ )
858 {
859 pNode = pMan->vMapObjs->pArray[i];
860 if ( pNode->pRepr == NULL && pNode->pNextE != NULL )
861 { // this is a choice node = the primary node that has equivalent nodes
862 nChoiceNodes++;
863 for ( pTemp = pNode; pTemp; pTemp = pTemp->pNextE )
864 nChoices++;
865 }
866 }
867 printf( "Maximum level: Original = %d. Reduced due to choices = %d.\n", LevelMax1, LevelMax2 );
868 printf( "Choice stats: Choice nodes = %d. Total choices = %d.\n", nChoiceNodes, nChoices );
869}
int Map_MappingGetMaxLevel(Map_Man_t *pMan)
int Map_MappingUpdateLevel_rec(Map_Man_t *pMan, Map_Node_t *pNode, int fMaximum)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Map_MappingSetChoiceLevels()

void Map_MappingSetChoiceLevels ( Map_Man_t * pMan)

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

Synopsis [Resets the levels of the nodes in the choice graph.]

Description [Makes the level of the choice nodes to be equal to the maximum of the level of the nodes in the equivalence class. This way sorting by level leads to the reverse topological order, which is needed for the required time computation.]

SideEffects []

SeeAlso []

Definition at line 821 of file mapperUtils.c.

822{
823 int i;
824 pMan->nTravIds++;
825 for ( i = 0; i < pMan->nOutputs; i++ )
826 Map_MappingUpdateLevel_rec( pMan, Map_Regular(pMan->pOutputs[i]), 1 );
827}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Map_MappingSetupMask()

void Map_MappingSetupMask ( unsigned uMask[],
int nVarsMax )

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

Synopsis [Sets up the mask.]

Description []

SideEffects []

SeeAlso []

Definition at line 402 of file mapperUtils.c.

403{
404 if ( nVarsMax == 6 )
405 uMask[0] = uMask[1] = MAP_FULL;
406 else
407 {
408 uMask[0] = MAP_MASK(1 << nVarsMax);
409 uMask[1] = 0;
410 }
411}
#define MAP_FULL
Definition mapperInt.h:53

◆ Map_MappingSetupTruthTables()

void Map_MappingSetupTruthTables ( unsigned uTruths[][2])

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

Synopsis [Sets up the truth tables.]

Description []

SideEffects []

SeeAlso []

Definition at line 335 of file mapperUtils.c.

336{
337 int m, v;
338 // set up the truth tables
339 for ( m = 0; m < 32; m++ )
340 for ( v = 0; v < 5; v++ )
341 if ( m & (1 << v) )
342 uTruths[v][0] |= (1 << m);
343 // make adjustments for the case of 6 variables
344 for ( v = 0; v < 5; v++ )
345 uTruths[v][1] = uTruths[v][0];
346 uTruths[5][0] = 0;
347 uTruths[5][1] = MAP_FULL;
348}
Here is the caller graph for this function:

◆ Map_MappingSetupTruthTablesLarge()

void Map_MappingSetupTruthTablesLarge ( unsigned uTruths[][32])

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

Synopsis [Sets up the truth tables.]

Description []

SideEffects []

SeeAlso []

Definition at line 361 of file mapperUtils.c.

362{
363 int m, v;
364 // clean everything
365 for ( m = 0; m < 32; m++ )
366 for ( v = 0; v < 10; v++ )
367 uTruths[v][m] = 0;
368 // set up the truth tables
369 for ( m = 0; m < 32; m++ )
370 for ( v = 0; v < 5; v++ )
371 if ( m & (1 << v) )
372 {
373 uTruths[v][0] |= (1 << m);
374 uTruths[v+5][m] = MAP_FULL;
375 }
376 // extend this info for the rest of the first 5 variables
377 for ( m = 0; m < 32; m++ )
378 for ( v = 0; v < 5; v++ )
379 uTruths[v][m] = uTruths[v][0];
380/*
381 // verify
382 for ( m = 0; m < 1024; m++, printf("\n") )
383 for ( v = 0; v < 10; v++ )
384 if ( Map_InfoReadVar( uTruths[v], m ) )
385 printf( "1" );
386 else
387 printf( "0" );
388*/
389}
Here is the caller graph for this function:

◆ Map_MappingSortByLevel()

void Map_MappingSortByLevel ( Map_Man_t * pMan,
Map_NodeVec_t * vNodes )

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

Synopsis [Orders the nodes in the decreasing order of levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 544 of file mapperUtils.c.

545{
546 qsort( (void *)vNodes->pArray, (size_t)vNodes->nSize, sizeof(Map_Node_t *),
547 (int (*)(const void *, const void *)) Map_CompareNodesByLevel );
548// assert( Map_CompareNodesByLevel( vNodes->pArray, vNodes->pArray + vNodes->nSize - 1 ) <= 0 );
549}
int Map_CompareNodesByLevel(Map_Node_t **ppS1, Map_Node_t **ppS2)
Here is the call graph for this function:

◆ Map_MappingUnmark()

void Map_MappingUnmark ( Map_Man_t * pMan)

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

Synopsis [Unmarks the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 163 of file mapperUtils.c.

164{
165 int i;
166 for ( i = 0; i < pMan->nOutputs; i++ )
167 Map_MappingUnmark_rec( Map_Regular(pMan->pOutputs[i]) );
168}
Here is the call graph for this function:

◆ Map_MappingUnmark_rec()

void Map_MappingUnmark_rec ( Map_Node_t * pNode)

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

Synopsis [Recursively unmarks the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 181 of file mapperUtils.c.

182{
183 assert( !Map_IsComplement(pNode) );
184 if ( pNode->fMark0 == 0 )
185 return;
186 pNode->fMark0 = 0;
187 if ( !Map_NodeIsAnd(pNode) )
188 return;
191 // visit the equivalent nodes
192 if ( pNode->pNextE )
194}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Map_MappingUpdateLevel_rec()

int Map_MappingUpdateLevel_rec ( Map_Man_t * pMan,
Map_Node_t * pNode,
int fMaximum )

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

Synopsis [Analyses choice nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 771 of file mapperUtils.c.

772{
773 Map_Node_t * pTemp;
774 int Level1, Level2, LevelE;
775 assert( !Map_IsComplement(pNode) );
776 if ( !Map_NodeIsAnd(pNode) )
777 return pNode->Level;
778 // skip the visited node
779 if ( pNode->TravId == pMan->nTravIds )
780 return pNode->Level;
781 pNode->TravId = pMan->nTravIds;
782 // compute levels of the children nodes
783 Level1 = Map_MappingUpdateLevel_rec( pMan, Map_Regular(pNode->p1), fMaximum );
784 Level2 = Map_MappingUpdateLevel_rec( pMan, Map_Regular(pNode->p2), fMaximum );
785 pNode->Level = 1 + MAP_MAX( Level1, Level2 );
786 if ( pNode->pNextE )
787 {
788 LevelE = Map_MappingUpdateLevel_rec( pMan, pNode->pNextE, fMaximum );
789 if ( fMaximum )
790 {
791 if ( pNode->Level < (unsigned)LevelE )
792 pNode->Level = LevelE;
793 }
794 else
795 {
796 if ( pNode->Level > (unsigned)LevelE )
797 pNode->Level = LevelE;
798 }
799 // set the level of all equivalent nodes to be the same minimum
800 if ( pNode->pRepr == NULL ) // the primary node
801 for ( pTemp = pNode->pNextE; pTemp; pTemp = pTemp->pNextE )
802 pTemp->Level = pNode->Level;
803 }
804 return pNode->Level;
805}
#define MAP_MAX(a, b)
Definition mapperInt.h:58
Here is the call graph for this function:
Here is the caller graph for this function: