28#define FPGA_CO_LIST_SIZE 5
33static void Fpga_MappingFindLatest(
Fpga_Man_t *
p,
int * pNodes,
int nNodesMax );
64 for ( i = 0; i < pMan->
nInputs; i++ )
71 for ( i = 0; i < pMan->
nOutputs; i++ )
77 for ( i = 0; i < vNodes->
nSize; i++ )
104 Fpga_MappingDfs_rec(
Fpga_Regular(pNode->
p1), vNodes, fCollectEquiv );
105 Fpga_MappingDfs_rec(
Fpga_Regular(pNode->
p2), vNodes, fCollectEquiv );
108 if ( fCollectEquiv && pNode->
pNextE )
109 Fpga_MappingDfs_rec( pNode->
pNextE, vNodes, fCollectEquiv );
135 for ( i = 0; i < nNodes; i++ )
136 Fpga_MappingDfs_rec( ppNodes[i], vNodes, fEquiv );
137 for ( i = 0; i < vNodes->
nSize; i++ )
155 float aFlowFlowTotal = 0;
157 for ( i = 0; i <
p->nOutputs; i++ )
161 aFlowFlowTotal +=
Fpga_Regular(
p->pOutputs[i])->pCutBest->aFlow;
163 return aFlowFlowTotal;
247 for ( i = 0; i < pMan->
nOutputs; i++ )
249 for ( i = 0; i < vNodes->
nSize; i++ )
272 if ( pNode->
nRefs++ )
279 ppStore[pNode->
Level] = pNode;
316 for ( i = 0; i < pMan->
nOutputs; i++ )
327 for ( i = LevelMax; i >= 0; i-- )
352 if ( Arrival1 < Arrival2 )
354 if ( Arrival1 > Arrival2 )
370void Fpga_MappingFindLatest(
Fpga_Man_t *
p,
int * pNodes,
int nNodesMax )
373 assert(
p->nOutputs >= nNodesMax );
376 for ( i = 1; i <
p->nOutputs; i++ )
378 for ( k = nNodes - 1; k >= 0; k-- )
379 if ( Fpga_MappingCompareOutputDelay( &
p->pOutputs[pNodes[k]], &
p->pOutputs[i] ) >= 0 )
381 if ( k == nNodesMax - 1 )
383 if ( nNodes < nNodesMax )
385 for ( v = nNodes - 1; v > k+1; v-- )
386 pNodes[v] = pNodes[v-1];
406 int fCompl, Limit, MaxNameSize, i;
412 Fpga_MappingFindLatest(
p, pSorted, Limit );
416 for ( i = 0; i < Limit; i++ )
417 if ( MaxNameSize < (
int)
strlen(
p->ppOutputNames[pSorted[i]]) )
418 MaxNameSize =
strlen(
p->ppOutputNames[pSorted[i]]);
421 for ( i = 0; i < Limit; i++ )
427 printf(
"Output %-*s : ", MaxNameSize + 3,
p->ppOutputNames[pSorted[i]] );
453 for ( m = 0; m < 32; m++ )
454 for ( v = 0; v < 5; v++ )
456 uTruths[v][0] |= (1 << m);
458 for ( v = 0; v < 5; v++ )
459 uTruths[v][1] = uTruths[v][0];
506 for ( i = 0; i < pVec->
nSize; i++ )
512 printf(
"Primary input %d is a secondary node.\n", pNode->
Num );
517 printf(
"Constant 1 %d is a secondary node.\n", pNode->
Num );
522 printf(
"Internal node %d is a secondary node.\n", pNode->
Num );
524 printf(
"Internal node %d has first fanin that is a secondary node.\n", pNode->
Num );
526 printf(
"Internal node %d has second fanin that is a secondary node.\n", pNode->
Num );
612 Fpga_DfsLim_rec( pNode, nLevels, vNodes );
613 for ( i = 0; i < vNodes->
nSize; i++ )
682 for ( i = 0; i < pMan->
nOutputs; i++ )
684 for ( i = 0; i < vVisited->
nSize; i++ )
712 if ( pNode == pPivot )
724 Ret1 = Fpga_CollectNodeTfo_rec(
Fpga_Regular(pNode->
p1), pPivot, vVisited, vTfo );
725 Ret2 = Fpga_CollectNodeTfo_rec(
Fpga_Regular(pNode->
p2), pPivot, vVisited, vTfo );
752 int nNodes, nLevelsMax, i;
756 nNodes = vNodes->
nSize;
757 for ( i = 0; i < nNodes; i++ )
770 for ( i = 0; i < pMan->
nOutputs; i++ )
776 for ( i = 0; i < nLevelsMax; i++ )
780 for ( i = 0; i < nNodes; i++ )
808 for ( i = 0; i < pMan->
nOutputs; i++ )
829 int Level1, Level2, LevelE;
846 if ( pNode->
Level < (
unsigned)LevelE )
847 pNode->
Level = LevelE;
851 if ( pNode->
Level > (
unsigned)LevelE )
852 pNode->
Level = LevelE;
855 if ( pNode->
pRepr == NULL )
856 for ( pTemp = pNode->
pNextE; pTemp; pTemp = pTemp->
pNextE )
880 for ( i = 0; i < pMan->
nOutputs; i++ )
900 int nChoiceNodes, nChoices;
901 int i, LevelMax1, LevelMax2;
906 for ( i = 0; i < pMan->
nOutputs; i++ )
911 nChoiceNodes = nChoices = 0;
915 if ( pNode->
pRepr == NULL && pNode->
pNextE != NULL )
918 for ( pTemp = pNode; pTemp; pTemp = pTemp->
pNextE )
924 printf(
"Maximum level: Original = %d. Reduced due to choices = %d.\n", LevelMax1, LevelMax2 );
925 printf(
"Choice stats: Choice nodes = %d. Total choices = %d.\n", nChoiceNodes, nChoices );
963 for ( i = 0; i <= nLevels; i++ )
966 for ( i = 0; i < pMan->
nOutputs; i++ )
969 for ( i = 0; i < pMan->
nOutputs; i++ )
978 for ( i = 0; i < pMan->
nOutputs; i++ )
#define ABC_ALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
Fpga_NodeVec_t * Fpga_NodeVecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
void Fpga_NodeVecWriteEntry(Fpga_NodeVec_t *p, int i, Fpga_Node_t *Entry)
void Fpga_NodeVecFree(Fpga_NodeVec_t *p)
void Fpga_NodeVecPush(Fpga_NodeVec_t *p, Fpga_Node_t *Entry)
Fpga_Node_t * Fpga_NodeVecReadEntry(Fpga_NodeVec_t *p, int i)
int Fpga_MappingUpdateLevel_rec(Fpga_Man_t *pMan, Fpga_Node_t *pNode, int fMaximum)
float Fpga_MappingArea_rec(Fpga_Man_t *pMan, Fpga_Node_t *pNode, Fpga_NodeVec_t *vNodes)
Fpga_NodeVec_t * Fpga_MappingDfsNodes(Fpga_Man_t *pMan, Fpga_Node_t **ppNodes, int nNodes, int fEquiv)
float Fpga_MappingSetRefsAndArea_rec(Fpga_Man_t *pMan, Fpga_Node_t *pNode, Fpga_Node_t **ppStore)
Fpga_NodeVec_t * Fpga_CollectNodeTfo(Fpga_Man_t *pMan, Fpga_Node_t *pNode)
void Fpga_ManReportChoices(Fpga_Man_t *pMan)
float Fpga_MappingAreaTrav(Fpga_Man_t *pMan)
float Fpga_MappingArea(Fpga_Man_t *pMan)
Fpga_NodeVec_t * Fpga_DfsLim(Fpga_Man_t *pMan, Fpga_Node_t *pNode, int nLevels)
float Fpga_MappingSetRefsAndArea(Fpga_Man_t *pMan)
void Fpga_MappingSetupTruthTables(unsigned uTruths[][2])
Fpga_NodeVec_t * Fpga_MappingLevelize(Fpga_Man_t *pMan, Fpga_NodeVec_t *vNodes)
void Fpga_MappingPrintOutputArrivals(Fpga_Man_t *p)
float Fpga_MappingGetAreaFlow(Fpga_Man_t *p)
void Fpga_MappingSetChoiceLevels(Fpga_Man_t *pMan)
void Fpga_MappingSortByLevel(Fpga_Man_t *pMan, Fpga_NodeVec_t *vNodes, int fIncreasing)
void Fpga_MappingSetupMask(unsigned uMask[], int nVarsMax)
int Fpga_CompareNodesByLevelIncreasing(Fpga_Node_t **ppS1, Fpga_Node_t **ppS2)
Fpga_NodeVec_t * Fpga_MappingDfs(Fpga_Man_t *pMan, int fCollectEquiv)
FUNCTION DEFINITIONS ///.
#define FPGA_CO_LIST_SIZE
DECLARATIONS ///.
void Fpga_ManCleanData0(Fpga_Man_t *pMan)
int Fpga_ManCheckConsistency(Fpga_Man_t *p)
int Fpga_MappingMaxLevel(Fpga_Man_t *pMan)
int Fpga_CompareNodesByLevelDecreasing(Fpga_Node_t **ppS1, Fpga_Node_t **ppS2)
struct Fpga_NodeStruct_t_ Fpga_Node_t
int Fpga_NodeIsConst(Fpga_Node_t *p)
struct Fpga_NodeVecStruct_t_ Fpga_NodeVec_t
struct Fpga_ManStruct_t_ Fpga_Man_t
STRUCTURE DEFINITIONS ///.
#define Fpga_IsComplement(p)
GLOBAL VARIABLES ///.
int Fpga_NodeIsAnd(Fpga_Node_t *p)
int Fpga_NodeIsVar(Fpga_Node_t *p)
Fpga_Node_t * ppLeaves[FPGA_MAX_LEAVES+1]
float pLutAreas[FPGA_MAX_LUTSIZE+1]
Fpga_NodeVec_t * vNodesAll
Fpga_NodeVec_t * vMapping