74 for ( i = 0; i <
p->nInputs; i++ )
75 p->pInputs[i]->pCutBest->tArrival =
p->pInputArrivals[i];
78 nNodes =
p->vAnds->nSize;
80 for ( i = 0; i < nNodes; i++ )
82 pNode =
p->vAnds->pArray[i];
89 Fpga_MatchNode(
p, pNode, fDelayOriented );
90 Extra_ProgressBarUpdate( pProgress, i,
"Matches ..." );
126 printf(
"\nError: A node in the mapping graph does not have feasible cuts.\n" );
157 if ( (fDelayOriented &&
171 if ( pCutBestOld == NULL )
203 for ( i = 0; i <
p->nInputs; i++ )
204 p->pInputs[i]->pCutBest->tArrival =
p->pInputArrivals[i];
207 nNodes =
p->vAnds->nSize;
209 for ( i = 0; i < nNodes; i++ )
211 pNode =
p->vAnds->pArray[i];
218 Fpga_MatchNodeArea(
p, pNode );
219 Extra_ProgressBarUpdate( pProgress, i,
"Matches ..." );
242 for ( i = 0; i < vNodes->
nSize; i++ )
244 pNode = vNodes->
pArray[i];
251 if ( !Fpga_MatchNodeArea(
p, pNode ) )
276 printf(
"\nError: A node in the mapping graph does not have feasible cuts.\n" );
356 for ( i = 0; i <
p->nInputs; i++ )
357 p->pInputs[i]->pCutBest->tArrival =
p->pInputArrivals[i];
360 nNodes =
p->vAnds->nSize;
362 for ( i = 0; i < nNodes; i++ )
364 pNode =
p->vAnds->pArray[i];
371 Fpga_MatchNodeSwitch(
p, pNode );
372 Extra_ProgressBarUpdate( pProgress, i,
"Matches ..." );
397 printf(
"\nError: A node in the mapping graph does not have feasible cuts.\n" );
471 int Counter[10] = {0};
475 for ( i = 0; i <
p->nOutputs; i++ )
478 pNode->vFanouts = NULL;
481 for ( i = 0; i <
p->vAnds->nSize; i++ )
483 pNode =
p->vAnds->pArray[i];
486 if ( pNode->vFanouts == NULL )
488 if ( pNode->vFanouts->nSize >= 10 )
490 Counter[pNode->vFanouts->nSize]++;
493 printf(
"Fanout stats: " );
494 for ( i = 0; i < 10; i++ )
495 printf(
" %d=%d", i, Counter[i] );
499 for ( i = 0; i <
p->vAnds->nSize; i++ )
504 pNode =
p->vAnds->pArray[i];
507 if ( pNode->vFanouts == NULL )
509 if ( pNode->vFanouts->nSize != 1 && pNode->vFanouts->nSize != 2 && pNode->vFanouts->nSize != 3 )
513 if ( pNode->
nRefs == 0 )
522 if ( Fpga_MappingMatchesAreaArray(
p, vNodesTfo ) == 0 )
523 printf(
"attempt failed\n" );
525 printf(
"attempt succeeded\n" );
550 int Counter[10] = {0};
554 float Gain, Loss, GainTotal, Area1, Area2;
557 for ( i = 0; i <
p->nOutputs; i++ )
560 pNode->vFanouts = NULL;
563 for ( i = 0; i <
p->vAnds->nSize; i++ )
565 pNode =
p->vAnds->pArray[i];
568 if ( pNode->vFanouts == NULL )
570 if ( pNode->vFanouts->nSize >= 10 )
572 Counter[pNode->vFanouts->nSize]++;
575 printf(
"Fanout stats: " );
576 for ( i = 0; i < 10; i++ )
577 printf(
" %d=%d", i, Counter[i] );
582 for ( i = 0; i <
p->vAnds->nSize; i++ )
584 pNode =
p->vAnds->pArray[i];
587 if ( pNode->vFanouts == NULL )
589 if ( pNode->vFanouts->nSize != 2 )
595 for ( k = 0; k < pNode->vFanouts->nSize; k++ )
597 pFanout = pNode->vFanouts->pArray[k];
599 ppCutsNew[k] = Fpga_MappingAreaWithoutNode(
p, pFanout, pNode );
600 if ( ppCutsNew[k] == NULL )
603 if ( k != pNode->vFanouts->nSize )
605 printf(
"Node %4d: Skipped.\n", pNode->
Num );
612 for ( k = 0; k < pNode->vFanouts->nSize; k++ )
614 pFanout = pNode->vFanouts->pArray[k];
616 Area1 = Fpga_MatchAreaDeref(
p, ppCutsOld[k] );
620 Area2 = Fpga_MatchAreaRef(
p, ppCutsNew[k] );
622 Gain += Area1 - Area2;
625 printf(
"%d ", pNode->
nRefs );
629 for ( k = 0; k < pNode->vFanouts->nSize; k++ )
631 pFanout = pNode->vFanouts->pArray[k];
633 Area1 = Fpga_MatchAreaDeref(
p, ppCutsNew[k] );
637 Area2 = Fpga_MatchAreaRef(
p, ppCutsOld[k] );
639 Loss += Area2 - Area1;
644 printf(
"Node %4d: Fanouts = %d. Cut area = %4.2f. Gain = %4.2f.\n",
651 printf(
"AREA GAIN = %4.2f (%.2f %%)\n", GainTotal, 100.0 * GainTotal /
Fpga_MappingArea(
p) );
675 printf(
"\nError: A node in the mapping graph does not have feasible cuts.\n" );
684 aAreaCutBest = Fpga_MatchAreaDeref(
p, pNode->
pCutBest );
692 Fpga_MatchCutGetArrTime(
p, pCut );
699 for ( i = 0; i < pCut->
nLeaves; i++ )
706 pCut->
aFlow = Fpga_MatchAreaCount(
p, pCut );
760 float Gain, CutArea1, CutArea2, CutArea3;
764 for ( i = 0; i < vNodes->
nSize; i++ )
766 pNode = vNodes->
pArray[i];
779 if ( Gain < CutArea1 - CutArea2 )
783 Gain = CutArea1 - CutArea2;
788 assert( CutArea1 == CutArea3 );
791 printf(
"Returning no gain.\n" );
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
ABC_NAMESPACE_IMPL_START typedef char ProgressBar
float Fpga_CutGetAreaDerefed(Fpga_Man_t *pMan, Fpga_Cut_t *pCut)
void Fpga_CutGetParameters(Fpga_Man_t *pMan, Fpga_Cut_t *pCut)
float Fpga_CutDeref(Fpga_Man_t *pMan, Fpga_Node_t *pNode, Fpga_Cut_t *pCut, int fFanouts)
float Fpga_CutRef(Fpga_Man_t *pMan, Fpga_Node_t *pNode, Fpga_Cut_t *pCut, int fFanouts)
float Fpga_CutRefSwitch(Fpga_Man_t *pMan, Fpga_Node_t *pNode, Fpga_Cut_t *pCut, int fFanouts)
float Fpga_CutDerefSwitch(Fpga_Man_t *pMan, Fpga_Node_t *pNode, Fpga_Cut_t *pCut, int fFanouts)
float Fpga_MappingArea(Fpga_Man_t *pMan)
float Fpga_TimeCutComputeArrival(Fpga_Man_t *pMan, Fpga_Cut_t *pCut)
DECLARATIONS ///.
void Fpga_TimeComputeRequiredGlobal(Fpga_Man_t *p, int fFirstTime)
void Fpga_NodeVecFree(Fpga_NodeVec_t *p)
float Fpga_CutGetSwitchDerefed(Fpga_Man_t *pMan, Fpga_Node_t *pNode, Fpga_Cut_t *pCut)
DECLARATIONS ///.
int Fpga_MappingMatchesSwitch(Fpga_Man_t *p)
float Fpga_FindBestNode(Fpga_Man_t *p, Fpga_NodeVec_t *vNodes, Fpga_Node_t **ppNode, Fpga_Cut_t **ppCutBest)
int Fpga_MappingMatches(Fpga_Man_t *p, int fDelayOriented)
FUNCTION DEFINITIONS ///.
int Fpga_MappingMatchesArea(Fpga_Man_t *p)
Fpga_NodeVec_t * Fpga_CollectNodeTfo(Fpga_Man_t *pMan, Fpga_Node_t *pNode)
struct Fpga_NodeStruct_t_ Fpga_Node_t
struct Fpga_NodeVecStruct_t_ Fpga_NodeVec_t
struct Fpga_ManStruct_t_ Fpga_Man_t
STRUCTURE DEFINITIONS ///.
struct Fpga_CutStruct_t_ Fpga_Cut_t
int Fpga_NodeIsAnd(Fpga_Node_t *p)
Fpga_Node_t * ppLeaves[FPGA_MAX_LEAVES+1]