28#define MAP_CO_LIST_SIZE 5
30static int Map_MappingCountLevels_rec(
Map_Node_t * pNode );
37static void Map_MappingFindLatest(
Map_Man_t *
p,
int * pNodes,
int nNodesMax );
38static unsigned Map_MappingExpandTruth_rec(
unsigned uTruth,
int nVars );
39static int Map_MappingCountUsedNodes(
Map_Man_t * pMan,
int fChoices );
68 if ( fCollectEquiv && pNode->
pNextE )
83 for ( i = 0; i < pMan->nOutputs; i++ )
85 for ( i = 0; i < vNodes->
nSize; i++ )
107 int i, LevelsMax, LevelsCur;
110 for ( i = 0; i < pMan->nOutputs; i++ )
112 LevelsCur = Map_MappingCountLevels_rec(
Map_Regular(pMan->pOutputs[i]) );
113 if ( LevelsMax < LevelsCur )
114 LevelsMax = LevelsCur;
116 for ( i = 0; i < pMan->nOutputs; i++ )
132int Map_MappingCountLevels_rec(
Map_Node_t * pNode )
145 Level1 = Map_MappingCountLevels_rec(
Map_Regular(pNode->
p1) );
146 Level2 = Map_MappingCountLevels_rec(
Map_Regular(pNode->
p2) );
148 pNode->
Level = 1 + ((Level1>Level2)? Level1: Level2);
166 for ( i = 0; i < pMan->nOutputs; i++ )
239 if ( Arrival1 < Arrival2 )
241 if ( Arrival1 > Arrival2 )
257void Map_MappingFindLatest(
Map_Man_t *
p,
int * pNodes,
int nNodesMax )
260 assert(
p->nOutputs >= nNodesMax );
263 for ( i = 1; i <
p->nOutputs; i++ )
265 for ( k = nNodes - 1; k >= 0; k-- )
266 if ( Map_MappingCompareOutputDelay( &
p->pOutputs[pNodes[k]], &
p->pOutputs[i] ) >= 0 )
268 if ( k == nNodesMax - 1 )
270 if ( nNodes < nNodesMax )
272 for ( v = nNodes - 1; v > k+1; v-- )
273 pNodes[v] = pNodes[v-1];
294 int fPhase, Limit, i;
301 Map_MappingFindLatest(
p, pSorted, Limit );
305 for ( i = 0; i < Limit; i++ )
306 if ( MaxNameSize < (
int)
strlen(
p->ppOutputNames[pSorted[i]]) )
307 MaxNameSize =
strlen(
p->ppOutputNames[pSorted[i]]);
310 for ( i = 0; i < Limit; i++ )
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" );
339 for ( m = 0; m < 32; m++ )
340 for ( v = 0; v < 5; v++ )
342 uTruths[v][0] |= (1 << m);
344 for ( v = 0; v < 5; v++ )
345 uTruths[v][1] = uTruths[v][0];
365 for ( m = 0; m < 32; m++ )
366 for ( v = 0; v < 10; v++ )
369 for ( m = 0; m < 32; m++ )
370 for ( v = 0; v < 5; v++ )
373 uTruths[v][0] |= (1 << m);
377 for ( m = 0; m < 32; m++ )
378 for ( v = 0; v < 5; v++ )
379 uTruths[v][m] = uTruths[v][0];
433 for ( i = 0; i < pVec->
nSize; i++ )
439 printf(
"Primary input %d is a secondary node.\n", pNode->
Num );
444 printf(
"Constant 1 %d is a secondary node.\n", pNode->
Num );
449 printf(
"Internal node %d is a secondary node.\n", pNode->
Num );
451 printf(
"Internal node %d has first fanin that is a secondary node.\n", pNode->
Num );
453 printf(
"Internal node %d has second fanin that is a secondary node.\n", pNode->
Num );
491 float aFlowFlowTotal = 0;
493 for ( i = 0; i <
p->nOutputs; i++ )
507 return aFlowFlowTotal;
589 for ( i = 0; i < vNodes->
nSize; i++ )
591 pNode = vNodes->
pArray[i];
619 for ( i = 0; i < pMan->pSuperLib->nSupersAll; i++ )
621 pSuper = pMan->pSuperLib->ppSupers[i];
622 if ( pSuper->
nGates == 1 )
626 for ( v = 0; v < nInputs; v++ )
627 if ( pSuper->
pFanins[v]->
Num != nInputs - 1 - v )
655 for ( i = 0; i <
p->vMapObjs->nSize; i++ )
656 p->vMapObjs->pArray[i]->pData0 =
p->vMapObjs->pArray[i]->pData1 = 0;
677 uTruth[0] &=
MAP_MASK( (1<<nVars) );
678 uTruth[0] = Map_MappingExpandTruth_rec( uTruth[0], nVars );
680 uTruth[1] = uTruth[0];
694unsigned Map_MappingExpandTruth_rec(
unsigned uTruth,
int nVars )
699 return Map_MappingExpandTruth_rec( uTruth | (uTruth << (1 << nVars)), nVars + 1 );
718 for ( i = 0; i <
p->vMapObjs->nSize; i++ )
721 pNode =
p->vMapObjs->pArray[i];
734 printf(
"Max arrival times with fanouts = %10.2f.\n", Result );
754 for ( i = 0; i < pMan->nOutputs; i++ )
755 nLevelMax = ((
unsigned)nLevelMax) >
Map_Regular(pMan->pOutputs[i])->Level?
774 int Level1, Level2, LevelE;
779 if ( pNode->
TravId == pMan->nTravIds )
781 pNode->
TravId = pMan->nTravIds;
791 if ( pNode->
Level < (
unsigned)LevelE )
792 pNode->
Level = LevelE;
796 if ( pNode->
Level > (
unsigned)LevelE )
797 pNode->
Level = LevelE;
800 if ( pNode->
pRepr == NULL )
801 for ( pTemp = pNode->
pNextE; pTemp; pTemp = pTemp->
pNextE )
825 for ( i = 0; i < pMan->nOutputs; i++ )
845 int nChoiceNodes, nChoices;
846 int i, LevelMax1, LevelMax2;
851 for ( i = 0; i < pMan->nOutputs; i++ )
856 nChoiceNodes = nChoices = 0;
857 for ( i = 0; i < pMan->vMapObjs->nSize; i++ )
859 pNode = pMan->vMapObjs->pArray[i];
860 if ( pNode->
pRepr == NULL && pNode->
pNextE != NULL )
863 for ( pTemp = pNode; pTemp; pTemp = pTemp->
pNextE )
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 );
882int Map_MappingCountUsedNodes(
Map_Man_t * pMan,
int fChoices )
887 Result = vNodes->
nSize;
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
#define MAP_MASK(n)
INCLUDES ///.
Map_NodeVec_t * Map_NodeVecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
void Map_NodeVecFree(Map_NodeVec_t *p)
float Map_TimeComputeArrivalMax(Map_Man_t *p)
DECLARATIONS ///.
void Map_NodeVecPush(Map_NodeVec_t *p, Map_Node_t *Entry)
float Map_TimeCutComputeArrival(Map_Node_t *pNode, Map_Cut_t *pCut, int fPhase, float tWorstCaseLimit)
int Map_MappingNodeIsViolator(Map_Node_t *pNode, Map_Cut_t *pCut, int fPosPol)
void Map_MappingSetupTruthTablesLarge(unsigned uTruths[][32])
void Map_MappingMark_rec(Map_Node_t *pNode)
int Map_MappingGetMaxLevel(Map_Man_t *pMan)
#define MAP_CO_LIST_SIZE
DECLARATIONS ///.
void Map_MappingSetupMask(unsigned uMask[], int nVarsMax)
void Map_MappingExpandTruth(unsigned uTruth[2], int nVars)
int Map_MappingCountLevels(Map_Man_t *pMan)
int Map_MappingCountDoubles(Map_Man_t *pMan, Map_NodeVec_t *vNodes)
void Map_MappingPrintOutputArrivals(Map_Man_t *p)
float Map_MappingGetAreaFlow(Map_Man_t *p)
Map_NodeVec_t * Map_MappingDfs(Map_Man_t *pMan, int fCollectEquiv)
st__table * Map_CreateTableGate2Super(Map_Man_t *pMan)
void Map_MappingSetChoiceLevels(Map_Man_t *pMan)
void Map_MappingReportChoices(Map_Man_t *pMan)
void Map_ManCleanData(Map_Man_t *p)
void Map_MappingDfs_rec(Map_Node_t *pNode, Map_NodeVec_t *vNodes, int fCollectEquiv)
FUNCTION DEFINITIONS ///.
void Map_MappingUnmark_rec(Map_Node_t *pNode)
void Map_MappingSortByLevel(Map_Man_t *pMan, Map_NodeVec_t *vNodes)
void Map_MappingSetupTruthTables(unsigned uTruths[][2])
int Map_CompareNodesByLevel(Map_Node_t **ppS1, Map_Node_t **ppS2)
int Map_MappingUpdateLevel_rec(Map_Man_t *pMan, Map_Node_t *pNode, int fMaximum)
void Map_MappingUnmark(Map_Man_t *pMan)
int Map_CompareNodesByPointer(Map_Node_t **ppS1, Map_Node_t **ppS2)
float Map_MappingComputeDelayWithFanouts(Map_Man_t *p)
int Map_ManCheckConsistency(Map_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Map_ManStruct_t_ Map_Man_t
INCLUDES ///.
int Map_NodeIsConst(Map_Node_t *p)
struct Map_CutStruct_t_ Map_Cut_t
struct Map_SuperStruct_t_ Map_Super_t
struct Map_TimeStruct_t_ Map_Time_t
int Map_NodeIsVar(Map_Node_t *p)
int Map_NodeIsAnd(Map_Node_t *p)
#define Map_IsComplement(p)
GLOBAL VARIABLES ///.
struct Map_NodeVecStruct_t_ Map_NodeVec_t
struct Map_NodeStruct_t_ Map_Node_t
int Mio_GateReadPinNum(Mio_Gate_t *pGate)
int st__strhash(const char *string, int modulus)
st__table * st__init_table(st__compare_func_type compare, st__hash_func_type hash)
int st__insert(st__table *table, const char *key, char *value)