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

Go to the source code of this file.

Functions

int Fpga_MappingMatches (Fpga_Man_t *p, int fDelayOriented)
 FUNCTION DEFINITIONS ///.
 
int Fpga_MappingMatchesArea (Fpga_Man_t *p)
 
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)
 

Function Documentation

◆ Fpga_FindBestNode()

float Fpga_FindBestNode ( Fpga_Man_t * p,
Fpga_NodeVec_t * vNodes,
Fpga_Node_t ** ppNode,
Fpga_Cut_t ** ppCutBest )

function*************************************************************

synopsis [Performs area minimization using a heuristic algorithm.]

description []

sideeffects []

seealso []

Definition at line 756 of file fpgaMatch.c.

757{
758 Fpga_Node_t * pNode;
759 Fpga_Cut_t * pCut;
760 float Gain, CutArea1, CutArea2, CutArea3;
761 int i;
762
763 Gain = 0;
764 for ( i = 0; i < vNodes->nSize; i++ )
765 {
766 pNode = vNodes->pArray[i];
767 // deref the current cut
768 CutArea1 = Fpga_CutDeref( p, pNode, pNode->pCutBest, 0 );
769
770 // ref all the cuts
771 for ( pCut = pNode->pCuts->pNext; pCut; pCut = pCut->pNext )
772 {
773 if ( pCut == pNode->pCutBest )
774 continue;
775 if ( pCut->tArrival > pNode->tRequired )
776 continue;
777
778 CutArea2 = Fpga_CutGetAreaDerefed( p, pCut );
779 if ( Gain < CutArea1 - CutArea2 )
780 {
781 *ppNode = pNode;
782 *ppCutBest = pCut;
783 Gain = CutArea1 - CutArea2;
784 }
785 }
786 // ref the old cut
787 CutArea3 = Fpga_CutRef( p, pNode, pNode->pCutBest, 0 );
788 assert( CutArea1 == CutArea3 );
789 }
790 if ( Gain == 0 )
791 printf( "Returning no gain.\n" );
792
793 return Gain;
794}
Cube * p
Definition exorList.c:222
float Fpga_CutGetAreaDerefed(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)
struct Fpga_NodeStruct_t_ Fpga_Node_t
Definition fpga.h:44
struct Fpga_CutStruct_t_ Fpga_Cut_t
Definition fpga.h:46
Fpga_Cut_t * pNext
Definition fpgaInt.h:246
Fpga_Cut_t * pCuts
Definition fpgaInt.h:224
Fpga_Cut_t * pCutBest
Definition fpgaInt.h:222
Fpga_Node_t ** pArray
Definition fpgaInt.h:252
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:

◆ Fpga_MappingMatches()

int Fpga_MappingMatches ( Fpga_Man_t * p,
int fDelayOriented )

FUNCTION DEFINITIONS ///.

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

Synopsis [Finds the best delay assignment of LUTs.]

Description [This procedure iterates through all the nodes of the object graph reachable from the POs and assigns the best match to each of them. If the flag fDelayOriented is set to 1, it tries to minimize the arrival time and uses the area flow as a tie-breaker. If the flag is set to 0, it considers all the cuts, whose arrival times matches the required time at the node, and minimizes the area flow using the arrival time as a tie-breaker.

Before this procedure is called, the required times should be set and the fanout counts should be computed. In the first iteration, the required times are set to very large number (by NodeCreate) and the fanout counts are set to the number of fanouts in the AIG. In the following iterations, the required times are set by the backward traversal, while the fanouts are estimated approximately.

If the arrival times of the PI nodes are given, they should be assigned to the PIs after the cuts are computed and before this procedure is called for the first time.]

SideEffects []

SeeAlso []

Definition at line 67 of file fpgaMatch.c.

68{
69 ProgressBar * pProgress;
70 Fpga_Node_t * pNode;
71 int i, nNodes;
72
73 // assign the arrival times of the PIs
74 for ( i = 0; i < p->nInputs; i++ )
75 p->pInputs[i]->pCutBest->tArrival = p->pInputArrivals[i];
76
77 // match LUTs with nodes in the topological order
78 nNodes = p->vAnds->nSize;
79 pProgress = Extra_ProgressBarStart( stdout, nNodes );
80 for ( i = 0; i < nNodes; i++ )
81 {
82 pNode = p->vAnds->pArray[i];
83 if ( !Fpga_NodeIsAnd( pNode ) )
84 continue;
85 // skip a secondary node
86 if ( pNode->pRepr )
87 continue;
88 // match the node
89 Fpga_MatchNode( p, pNode, fDelayOriented );
90 Extra_ProgressBarUpdate( pProgress, i, "Matches ..." );
91 }
92 Extra_ProgressBarStop( pProgress );
93/*
94 if ( !fDelayOriented )
95 {
96 float Area = 0.0;
97 for ( i = 0; i < p->nOutputs; i++ )
98 {
99 printf( "%5.2f ", Fpga_Regular(p->pOutputs[i])->pCutBest->aFlow );
100 Area += Fpga_Regular(p->pOutputs[i])->pCutBest->aFlow;
101 }
102 printf( "\nTotal = %5.2f\n", Area );
103 }
104*/
105 return 1;
106}
ABC_NAMESPACE_IMPL_START typedef char ProgressBar
Definition bbrNtbdd.c:27
void Extra_ProgressBarStop(ProgressBar *p)
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
int Fpga_NodeIsAnd(Fpga_Node_t *p)
Definition fpgaCreate.c:127
Fpga_Node_t * pRepr
Definition fpgaInt.h:203
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fpga_MappingMatchesArea()

int Fpga_MappingMatchesArea ( Fpga_Man_t * p)

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

Synopsis [Finds the best area assignment of LUTs.]

Description []

SideEffects []

SeeAlso []

Definition at line 196 of file fpgaMatch.c.

197{
198 ProgressBar * pProgress;
199 Fpga_Node_t * pNode;
200 int i, nNodes;
201
202 // assign the arrival times of the PIs
203 for ( i = 0; i < p->nInputs; i++ )
204 p->pInputs[i]->pCutBest->tArrival = p->pInputArrivals[i];
205
206 // match LUTs with nodes in the topological order
207 nNodes = p->vAnds->nSize;
208 pProgress = Extra_ProgressBarStart( stdout, nNodes );
209 for ( i = 0; i < nNodes; i++ )
210 {
211 pNode = p->vAnds->pArray[i];
212 if ( !Fpga_NodeIsAnd( pNode ) )
213 continue;
214 // skip a secondary node
215 if ( pNode->pRepr )
216 continue;
217 // match the node
218 Fpga_MatchNodeArea( p, pNode );
219 Extra_ProgressBarUpdate( pProgress, i, "Matches ..." );
220 }
221 Extra_ProgressBarStop( pProgress );
222 return 1;
223}
Here is the call graph for this function:

◆ Fpga_MappingMatchesSwitch()

int Fpga_MappingMatchesSwitch ( Fpga_Man_t * p)

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

Synopsis [Finds the best area assignment of LUTs.]

Description []

SideEffects []

SeeAlso []

Definition at line 349 of file fpgaMatch.c.

350{
351 ProgressBar * pProgress;
352 Fpga_Node_t * pNode;
353 int i, nNodes;
354
355 // assign the arrival times of the PIs
356 for ( i = 0; i < p->nInputs; i++ )
357 p->pInputs[i]->pCutBest->tArrival = p->pInputArrivals[i];
358
359 // match LUTs with nodes in the topological order
360 nNodes = p->vAnds->nSize;
361 pProgress = Extra_ProgressBarStart( stdout, nNodes );
362 for ( i = 0; i < nNodes; i++ )
363 {
364 pNode = p->vAnds->pArray[i];
365 if ( !Fpga_NodeIsAnd( pNode ) )
366 continue;
367 // skip a secondary node
368 if ( pNode->pRepr )
369 continue;
370 // match the node
371 Fpga_MatchNodeSwitch( p, pNode );
372 Extra_ProgressBarUpdate( pProgress, i, "Matches ..." );
373 }
374 Extra_ProgressBarStop( pProgress );
375 return 1;
376}
Here is the call graph for this function: