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

Go to the source code of this file.

Macros

#define FPGA_CO_LIST_SIZE   5
 DECLARATIONS ///.
 

Functions

Fpga_NodeVec_tFpga_MappingDfs (Fpga_Man_t *pMan, int fCollectEquiv)
 FUNCTION DEFINITIONS ///.
 
Fpga_NodeVec_tFpga_MappingDfsNodes (Fpga_Man_t *pMan, Fpga_Node_t **ppNodes, int nNodes, int fEquiv)
 
float Fpga_MappingGetAreaFlow (Fpga_Man_t *p)
 
float Fpga_MappingArea (Fpga_Man_t *pMan)
 
float Fpga_MappingArea_rec (Fpga_Man_t *pMan, Fpga_Node_t *pNode, Fpga_NodeVec_t *vNodes)
 
float Fpga_MappingAreaTrav (Fpga_Man_t *pMan)
 
float Fpga_MappingSetRefsAndArea_rec (Fpga_Man_t *pMan, Fpga_Node_t *pNode, Fpga_Node_t **ppStore)
 
float Fpga_MappingSetRefsAndArea (Fpga_Man_t *pMan)
 
void Fpga_MappingPrintOutputArrivals (Fpga_Man_t *p)
 
void Fpga_MappingSetupTruthTables (unsigned uTruths[][2])
 
void Fpga_MappingSetupMask (unsigned uMask[], int nVarsMax)
 
int Fpga_ManCheckConsistency (Fpga_Man_t *p)
 
int Fpga_CompareNodesByLevelDecreasing (Fpga_Node_t **ppS1, Fpga_Node_t **ppS2)
 
int Fpga_CompareNodesByLevelIncreasing (Fpga_Node_t **ppS1, Fpga_Node_t **ppS2)
 
void Fpga_MappingSortByLevel (Fpga_Man_t *pMan, Fpga_NodeVec_t *vNodes, int fIncreasing)
 
Fpga_NodeVec_tFpga_DfsLim (Fpga_Man_t *pMan, Fpga_Node_t *pNode, int nLevels)
 
void Fpga_ManCleanData0 (Fpga_Man_t *pMan)
 
Fpga_NodeVec_tFpga_CollectNodeTfo (Fpga_Man_t *pMan, Fpga_Node_t *pNode)
 
Fpga_NodeVec_tFpga_MappingLevelize (Fpga_Man_t *pMan, Fpga_NodeVec_t *vNodes)
 
int Fpga_MappingMaxLevel (Fpga_Man_t *pMan)
 
int Fpga_MappingUpdateLevel_rec (Fpga_Man_t *pMan, Fpga_Node_t *pNode, int fMaximum)
 
void Fpga_MappingSetChoiceLevels (Fpga_Man_t *pMan)
 
void Fpga_ManReportChoices (Fpga_Man_t *pMan)
 

Macro Definition Documentation

◆ FPGA_CO_LIST_SIZE

#define FPGA_CO_LIST_SIZE   5

DECLARATIONS ///.

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

FileName [fpgaUtils.c]

PackageName [MVSIS 1.3: Multi-valued logic synthesis system.]

Synopsis [Technology mapping for variable-size-LUT FPGAs.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

Date [Ver. 2.0. Started - August 18, 2004.]

Revision [

Id
fpgaUtils.c,v 1.3 2004/07/06 04:55:58 alanmi Exp

]

Definition at line 28 of file fpgaUtils.c.

Function Documentation

◆ Fpga_CollectNodeTfo()

Fpga_NodeVec_t * Fpga_CollectNodeTfo ( Fpga_Man_t * pMan,
Fpga_Node_t * pNode )

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

Synopsis [Collects the TFO of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 675 of file fpgaUtils.c.

676{
677 Fpga_NodeVec_t * vVisited, * vTfo;
678 int i;
679 // perform the traversal
680 vVisited = Fpga_NodeVecAlloc( 100 );
681 vTfo = Fpga_NodeVecAlloc( 100 );
682 for ( i = 0; i < pMan->nOutputs; i++ )
683 Fpga_CollectNodeTfo_rec( Fpga_Regular(pMan->pOutputs[i]), pNode, vVisited, vTfo );
684 for ( i = 0; i < vVisited->nSize; i++ )
685 vVisited->pArray[i]->fMark0 = vVisited->pArray[i]->fMark1 = 0;
686 Fpga_NodeVecFree( vVisited );
687 return vTfo;
688}
Fpga_NodeVec_t * Fpga_NodeVecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition fpgaVec.c:45
void Fpga_NodeVecFree(Fpga_NodeVec_t *p)
Definition fpgaVec.c:68
struct Fpga_NodeVecStruct_t_ Fpga_NodeVec_t
Definition fpga.h:45
#define Fpga_Regular(p)
Definition fpga.h:58
Fpga_Node_t ** pOutputs
Definition fpgaInt.h:106
unsigned fMark1
Definition fpgaInt.h:190
unsigned fMark0
Definition fpgaInt.h:189
Fpga_Node_t ** pArray
Definition fpgaInt.h:252
Here is the call graph for this function:

◆ Fpga_CompareNodesByLevelDecreasing()

int Fpga_CompareNodesByLevelDecreasing ( Fpga_Node_t ** ppS1,
Fpga_Node_t ** ppS2 )

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

Synopsis [Compares the supergates by their level.]

Description []

SideEffects []

SeeAlso []

Definition at line 544 of file fpgaUtils.c.

545{
546 if ( Fpga_Regular(*ppS1)->Level > Fpga_Regular(*ppS2)->Level )
547 return -1;
548 if ( Fpga_Regular(*ppS1)->Level < Fpga_Regular(*ppS2)->Level )
549 return 1;
550 return 0;
551}
Here is the caller graph for this function:

◆ Fpga_CompareNodesByLevelIncreasing()

int Fpga_CompareNodesByLevelIncreasing ( Fpga_Node_t ** ppS1,
Fpga_Node_t ** ppS2 )

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

Synopsis [Compares the supergates by their level.]

Description []

SideEffects []

SeeAlso []

Definition at line 564 of file fpgaUtils.c.

565{
566 if ( Fpga_Regular(*ppS1)->Level < Fpga_Regular(*ppS2)->Level )
567 return -1;
568 if ( Fpga_Regular(*ppS1)->Level > Fpga_Regular(*ppS2)->Level )
569 return 1;
570 return 0;
571}
Here is the caller graph for this function:

◆ Fpga_DfsLim()

Fpga_NodeVec_t * Fpga_DfsLim ( Fpga_Man_t * pMan,
Fpga_Node_t * pNode,
int nLevels )

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

Synopsis [Computes the limited DFS ordering for one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 606 of file fpgaUtils.c.

607{
608 Fpga_NodeVec_t * vNodes;
609 int i;
610 // perform the traversal
611 vNodes = Fpga_NodeVecAlloc( 100 );
612 Fpga_DfsLim_rec( pNode, nLevels, vNodes );
613 for ( i = 0; i < vNodes->nSize; i++ )
614 vNodes->pArray[i]->fMark0 = 0;
615 return vNodes;
616}
Here is the call graph for this function:

◆ Fpga_ManCheckConsistency()

int Fpga_ManCheckConsistency ( Fpga_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 500 of file fpgaUtils.c.

501{
502 Fpga_Node_t * pNode;
503 Fpga_NodeVec_t * pVec;
504 int i;
505 pVec = Fpga_MappingDfs( p, 0 );
506 for ( i = 0; i < pVec->nSize; i++ )
507 {
508 pNode = pVec->pArray[i];
509 if ( Fpga_NodeIsVar(pNode) )
510 {
511 if ( pNode->pRepr )
512 printf( "Primary input %d is a secondary node.\n", pNode->Num );
513 }
514 else if ( Fpga_NodeIsConst(pNode) )
515 {
516 if ( pNode->pRepr )
517 printf( "Constant 1 %d is a secondary node.\n", pNode->Num );
518 }
519 else
520 {
521 if ( pNode->pRepr )
522 printf( "Internal node %d is a secondary node.\n", pNode->Num );
523 if ( Fpga_Regular(pNode->p1)->pRepr )
524 printf( "Internal node %d has first fanin that is a secondary node.\n", pNode->Num );
525 if ( Fpga_Regular(pNode->p2)->pRepr )
526 printf( "Internal node %d has second fanin that is a secondary node.\n", pNode->Num );
527 }
528 }
529 Fpga_NodeVecFree( pVec );
530 return 1;
531}
Cube * p
Definition exorList.c:222
Fpga_NodeVec_t * Fpga_MappingDfs(Fpga_Man_t *pMan, int fCollectEquiv)
FUNCTION DEFINITIONS ///.
Definition fpgaUtils.c:54
struct Fpga_NodeStruct_t_ Fpga_Node_t
Definition fpga.h:44
int Fpga_NodeIsConst(Fpga_Node_t *p)
Definition fpgaCreate.c:125
int Fpga_NodeIsVar(Fpga_Node_t *p)
Definition fpgaCreate.c:126
Fpga_Node_t * pRepr
Definition fpgaInt.h:203
Fpga_Node_t * p1
Definition fpgaInt.h:200
Fpga_Node_t * p2
Definition fpgaInt.h:201
Here is the call graph for this function:

◆ Fpga_ManCleanData0()

void Fpga_ManCleanData0 ( Fpga_Man_t * pMan)

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

Synopsis [Computes the limited DFS ordering for one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 657 of file fpgaUtils.c.

658{
659 int i;
660 for ( i = 0; i < pMan->vNodesAll->nSize; i++ )
661 pMan->vNodesAll->pArray[i]->pData0 = 0;
662}
Fpga_NodeVec_t * vNodesAll
Definition fpgaInt.h:111

◆ Fpga_ManReportChoices()

void Fpga_ManReportChoices ( Fpga_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 897 of file fpgaUtils.c.

898{
899 Fpga_Node_t * pNode, * pTemp;
900 int nChoiceNodes, nChoices;
901 int i, LevelMax1, LevelMax2;
902
903 // report the number of levels
904 LevelMax1 = Fpga_MappingMaxLevel( pMan );
905 pMan->nTravIds++;
906 for ( i = 0; i < pMan->nOutputs; i++ )
908 LevelMax2 = Fpga_MappingMaxLevel( pMan );
909
910 // report statistics about choices
911 nChoiceNodes = nChoices = 0;
912 for ( i = 0; i < pMan->vAnds->nSize; i++ )
913 {
914 pNode = pMan->vAnds->pArray[i];
915 if ( pNode->pRepr == NULL && pNode->pNextE != NULL )
916 { // this is a choice node = the primary node that has equivalent nodes
917 nChoiceNodes++;
918 for ( pTemp = pNode; pTemp; pTemp = pTemp->pNextE )
919 nChoices++;
920 }
921 }
922 if ( pMan->fVerbose )
923 {
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 );
926 }
927/*
928 {
929 FILE * pTable;
930 pTable = fopen( "stats_choice.txt", "a+" );
931 fprintf( pTable, "%s ", pMan->pFileName );
932 fprintf( pTable, "%4d ", LevelMax1 );
933 fprintf( pTable, "%4d ", pMan->vAnds->nSize - pMan->nInputs );
934 fprintf( pTable, "%4d ", LevelMax2 );
935 fprintf( pTable, "%7d ", nChoiceNodes );
936 fprintf( pTable, "%7d ", nChoices + nChoiceNodes );
937 fprintf( pTable, "\n" );
938 fclose( pTable );
939 }
940*/
941}
int Fpga_MappingUpdateLevel_rec(Fpga_Man_t *pMan, Fpga_Node_t *pNode, int fMaximum)
Definition fpgaUtils.c:826
int Fpga_MappingMaxLevel(Fpga_Man_t *pMan)
Definition fpgaUtils.c:804
Fpga_NodeVec_t * vAnds
Definition fpgaInt.h:112
Fpga_Node_t * pNextE
Definition fpgaInt.h:202
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fpga_MappingArea()

float Fpga_MappingArea ( Fpga_Man_t * pMan)

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

Synopsis [Computes the area of the current mapping.]

Description []

SideEffects []

SeeAlso []

Definition at line 177 of file fpgaUtils.c.

178{
179 Fpga_Node_t * pNode;
180 float aTotal;
181 int i;
182 // perform the traversal
183 aTotal = 0;
184 for ( i = 0; i < pMan->vMapping->nSize; i++ )
185 {
186 pNode = pMan->vMapping->pArray[i];
187 aTotal += pMan->pLutLib->pLutAreas[(int)pNode->pCutBest->nLeaves];
188 }
189 return aTotal;
190}
float pLutAreas[FPGA_MAX_LUTSIZE+1]
Definition fpgaInt.h:175
Fpga_LutLib_t * pLutLib
Definition fpgaInt.h:137
Fpga_NodeVec_t * vMapping
Definition fpgaInt.h:113
Fpga_Cut_t * pCutBest
Definition fpgaInt.h:222

◆ Fpga_MappingArea_rec()

float Fpga_MappingArea_rec ( Fpga_Man_t * pMan,
Fpga_Node_t * pNode,
Fpga_NodeVec_t * vNodes )

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

Synopsis [Recursively computes the DFS ordering of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 203 of file fpgaUtils.c.

204{
205 float aArea;
206 int i;
207 assert( !Fpga_IsComplement(pNode) );
208 if ( !Fpga_NodeIsAnd(pNode) )
209 return 0;
210 if ( pNode->fMark0 )
211 return 0;
212 assert( pNode->pCutBest != NULL );
213 // visit the transitive fanin of the selected cut
214 aArea = 0;
215 for ( i = 0; i < pNode->pCutBest->nLeaves; i++ )
216 aArea += Fpga_MappingArea_rec( pMan, pNode->pCutBest->ppLeaves[i], vNodes );
217 // make sure the node is not visited through the fanin nodes
218 assert( pNode->fMark0 == 0 );
219 // mark the node as visited
220 pNode->fMark0 = 1;
221 // add the node to the list
222 aArea += pMan->pLutLib->pLutAreas[(int)pNode->pCutBest->nLeaves];
223 // add the node to the list
224 Fpga_NodeVecPush( vNodes, pNode );
225 return aArea;
226}
void Fpga_NodeVecPush(Fpga_NodeVec_t *p, Fpga_Node_t *Entry)
Definition fpgaVec.c:169
float Fpga_MappingArea_rec(Fpga_Man_t *pMan, Fpga_Node_t *pNode, Fpga_NodeVec_t *vNodes)
Definition fpgaUtils.c:203
#define Fpga_IsComplement(p)
GLOBAL VARIABLES ///.
Definition fpga.h:57
int Fpga_NodeIsAnd(Fpga_Node_t *p)
Definition fpgaCreate.c:127
Fpga_Node_t * ppLeaves[FPGA_MAX_LEAVES+1]
Definition fpgaInt.h:237
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fpga_MappingAreaTrav()

float Fpga_MappingAreaTrav ( Fpga_Man_t * pMan)

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

Synopsis [Computes the area of the current mapping.]

Description []

SideEffects []

SeeAlso []

Definition at line 239 of file fpgaUtils.c.

240{
241 Fpga_NodeVec_t * vNodes;
242 float aTotal;
243 int i;
244 // perform the traversal
245 aTotal = 0;
246 vNodes = Fpga_NodeVecAlloc( 100 );
247 for ( i = 0; i < pMan->nOutputs; i++ )
248 aTotal += Fpga_MappingArea_rec( pMan, Fpga_Regular(pMan->pOutputs[i]), vNodes );
249 for ( i = 0; i < vNodes->nSize; i++ )
250 vNodes->pArray[i]->fMark0 = 0;
251 Fpga_NodeVecFree( vNodes );
252 return aTotal;
253}
Here is the call graph for this function:

◆ Fpga_MappingDfs()

Fpga_NodeVec_t * Fpga_MappingDfs ( Fpga_Man_t * pMan,
int fCollectEquiv )

FUNCTION DEFINITIONS ///.

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

Synopsis [Computes the DFS ordering of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 54 of file fpgaUtils.c.

55{
56 Fpga_NodeVec_t * vNodes;//, * vNodesCo;
57 Fpga_Node_t * pNode;
58 int i;
59 // collect the CO nodes by level
60// vNodesCo = Fpga_MappingOrderCosByLevel( pMan );
61 // start the array
62 vNodes = Fpga_NodeVecAlloc( 100 );
63 // collect the PIs
64 for ( i = 0; i < pMan->nInputs; i++ )
65 {
66 pNode = pMan->pInputs[i];
67 Fpga_NodeVecPush( vNodes, pNode );
68 pNode->fMark0 = 1;
69 }
70 // perform the traversal
71 for ( i = 0; i < pMan->nOutputs; i++ )
72 Fpga_MappingDfs_rec( Fpga_Regular(pMan->pOutputs[i]), vNodes, fCollectEquiv );
73// for ( i = vNodesCo->nSize - 1; i >= 0 ; i-- )
74// for ( pNode = vNodesCo->pArray[i]; pNode; pNode = (Fpga_Node_t *)pNode->pData0 )
75// Fpga_MappingDfs_rec( pNode, vNodes, fCollectEquiv );
76 // clean the node marks
77 for ( i = 0; i < vNodes->nSize; i++ )
78 vNodes->pArray[i]->fMark0 = 0;
79// for ( i = 0; i < pMan->nOutputs; i++ )
80// Fpga_MappingUnmark_rec( Fpga_Regular(pMan->pOutputs[i]) );
81// Fpga_NodeVecFree( vNodesCo );
82 return vNodes;
83}
Fpga_Node_t ** pInputs
Definition fpgaInt.h:104
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fpga_MappingDfsNodes()

Fpga_NodeVec_t * Fpga_MappingDfsNodes ( Fpga_Man_t * pMan,
Fpga_Node_t ** ppNodes,
int nNodes,
int fEquiv )

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

Synopsis [Computes the DFS ordering of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 129 of file fpgaUtils.c.

130{
131 Fpga_NodeVec_t * vNodes;
132 int i;
133 // perform the traversal
134 vNodes = Fpga_NodeVecAlloc( 200 );
135 for ( i = 0; i < nNodes; i++ )
136 Fpga_MappingDfs_rec( ppNodes[i], vNodes, fEquiv );
137 for ( i = 0; i < vNodes->nSize; i++ )
138 vNodes->pArray[i]->fMark0 = 0;
139 return vNodes;
140}
Here is the call graph for this function:

◆ Fpga_MappingGetAreaFlow()

float Fpga_MappingGetAreaFlow ( Fpga_Man_t * p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 153 of file fpgaUtils.c.

154{
155 float aFlowFlowTotal = 0;
156 int i;
157 for ( i = 0; i < p->nOutputs; i++ )
158 {
159 if ( Fpga_NodeIsConst(p->pOutputs[i]) )
160 continue;
161 aFlowFlowTotal += Fpga_Regular(p->pOutputs[i])->pCutBest->aFlow;
162 }
163 return aFlowFlowTotal;
164}
Here is the call graph for this function:

◆ Fpga_MappingLevelize()

Fpga_NodeVec_t * Fpga_MappingLevelize ( Fpga_Man_t * pMan,
Fpga_NodeVec_t * vNodes )

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

Synopsis [Levelizes the nodes accessible from the POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 747 of file fpgaUtils.c.

748{
749 Fpga_NodeVec_t * vLevels;
750 Fpga_Node_t ** ppNodes;
751 Fpga_Node_t * pNode;
752 int nNodes, nLevelsMax, i;
753
754 // reassign the levels (this may be necessary for networks which choices)
755 ppNodes = vNodes->pArray;
756 nNodes = vNodes->nSize;
757 for ( i = 0; i < nNodes; i++ )
758 {
759 pNode = ppNodes[i];
760 if ( !Fpga_NodeIsAnd(pNode) )
761 {
762 pNode->Level = 0;
763 continue;
764 }
765 pNode->Level = 1 + FPGA_MAX( Fpga_Regular(pNode->p1)->Level, Fpga_Regular(pNode->p2)->Level );
766 }
767
768 // get the max levels
769 nLevelsMax = 0;
770 for ( i = 0; i < pMan->nOutputs; i++ )
771 nLevelsMax = FPGA_MAX( nLevelsMax, (int)Fpga_Regular(pMan->pOutputs[i])->Level );
772 nLevelsMax++;
773
774 // allocate storage for levels
775 vLevels = Fpga_NodeVecAlloc( nLevelsMax );
776 for ( i = 0; i < nLevelsMax; i++ )
777 Fpga_NodeVecPush( vLevels, NULL );
778
779 // go through the nodes and add them to the levels
780 for ( i = 0; i < nNodes; i++ )
781 {
782 pNode = ppNodes[i];
783 pNode->pLevel = NULL;
784 if ( !Fpga_NodeIsAnd(pNode) )
785 continue;
786 // attach the node to this level
787 pNode->pLevel = Fpga_NodeVecReadEntry( vLevels, pNode->Level );
788 Fpga_NodeVecWriteEntry( vLevels, pNode->Level, pNode );
789 }
790 return vLevels;
791}
void Fpga_NodeVecWriteEntry(Fpga_NodeVec_t *p, int i, Fpga_Node_t *Entry)
Definition fpgaVec.c:229
#define FPGA_MAX(a, b)
Definition fpgaInt.h:62
Fpga_Node_t * Fpga_NodeVecReadEntry(Fpga_NodeVec_t *p, int i)
Definition fpgaVec.c:246
Fpga_Node_t * pLevel
Definition fpgaInt.h:184
Here is the call graph for this function:

◆ Fpga_MappingMaxLevel()

int Fpga_MappingMaxLevel ( Fpga_Man_t * pMan)

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

Synopsis [Sets up the mask.]

Description []

SideEffects []

SeeAlso []

Definition at line 804 of file fpgaUtils.c.

805{
806 int nLevelMax, i;
807 nLevelMax = 0;
808 for ( i = 0; i < pMan->nOutputs; i++ )
809 nLevelMax = nLevelMax > (int)Fpga_Regular(pMan->pOutputs[i])->Level?
810 nLevelMax : (int)Fpga_Regular(pMan->pOutputs[i])->Level;
811 return nLevelMax;
812}
Here is the caller graph for this function:

◆ Fpga_MappingPrintOutputArrivals()

void Fpga_MappingPrintOutputArrivals ( Fpga_Man_t * p)

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

Synopsis [Prints a bunch of latest arriving outputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 402 of file fpgaUtils.c.

403{
404 Fpga_Node_t * pNode;
405 int pSorted[FPGA_CO_LIST_SIZE];
406 int fCompl, Limit, MaxNameSize, i;
407
408 // determine the number of nodes to print
409 Limit = (p->nOutputs > FPGA_CO_LIST_SIZE)? FPGA_CO_LIST_SIZE : p->nOutputs;
410
411 // determine the order
412 Fpga_MappingFindLatest( p, pSorted, Limit );
413
414 // determine max size of the node's name
415 MaxNameSize = 0;
416 for ( i = 0; i < Limit; i++ )
417 if ( MaxNameSize < (int)strlen(p->ppOutputNames[pSorted[i]]) )
418 MaxNameSize = strlen(p->ppOutputNames[pSorted[i]]);
419
420 // print the latest outputs
421 for ( i = 0; i < Limit; i++ )
422 {
423 // get the i-th latest output
424 pNode = Fpga_Regular(p->pOutputs[pSorted[i]]);
425 fCompl = Fpga_IsComplement(p->pOutputs[pSorted[i]]);
426 // print out the best arrival time
427 printf( "Output %-*s : ", MaxNameSize + 3, p->ppOutputNames[pSorted[i]] );
428 printf( "Delay = %8.2f ", (double)pNode->pCutBest->tArrival );
429 if ( fCompl )
430 printf( "NEG" );
431 else
432 printf( "POS" );
433 printf( "\n" );
434 }
435}
#define FPGA_CO_LIST_SIZE
DECLARATIONS ///.
Definition fpgaUtils.c:28
int strlen()
Here is the call graph for this function:

◆ Fpga_MappingSetChoiceLevels()

void Fpga_MappingSetChoiceLevels ( Fpga_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 876 of file fpgaUtils.c.

877{
878 int i;
879 pMan->nTravIds++;
880 for ( i = 0; i < pMan->nOutputs; i++ )
882}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fpga_MappingSetRefsAndArea()

float Fpga_MappingSetRefsAndArea ( Fpga_Man_t * pMan)

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

Synopsis [Sets the correct reference counts for the mapping.]

Description [Collects the nodes in reverse topological order and places in them in array pMan->vMapping.]

SideEffects []

SeeAlso []

Definition at line 299 of file fpgaUtils.c.

300{
301 Fpga_Node_t * pNode, ** ppStore;
302 float aArea;
303 int i, LevelMax;
304
305 // clean all references
306 for ( i = 0; i < pMan->vNodesAll->nSize; i++ )
307 pMan->vNodesAll->pArray[i]->nRefs = 0;
308
309 // allocate place to store the nodes
310 LevelMax = Fpga_MappingMaxLevel( pMan );
311 ppStore = ABC_ALLOC( Fpga_Node_t *, LevelMax + 1 );
312 memset( ppStore, 0, sizeof(Fpga_Node_t *) * (LevelMax + 1) );
313
314 // collect nodes reachable from POs in the DFS order through the best cuts
315 aArea = 0;
316 for ( i = 0; i < pMan->nOutputs; i++ )
317 {
318 pNode = Fpga_Regular(pMan->pOutputs[i]);
319 if ( pNode == pMan->pConst1 )
320 continue;
321 aArea += Fpga_MappingSetRefsAndArea_rec( pMan, pNode, ppStore );
322 pNode->nRefs++;
323 }
324
325 // reconnect the nodes in reverse topological order
326 pMan->vMapping->nSize = 0;
327 for ( i = LevelMax; i >= 0; i-- )
328 for ( pNode = ppStore[i]; pNode; pNode = (Fpga_Node_t *)pNode->pData0 )
329 Fpga_NodeVecPush( pMan->vMapping, pNode );
330 ABC_FREE( ppStore );
331 return aArea;
332}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_FREE(obj)
Definition abc_global.h:267
float Fpga_MappingSetRefsAndArea_rec(Fpga_Man_t *pMan, Fpga_Node_t *pNode, Fpga_Node_t **ppStore)
Definition fpgaUtils.c:267
Fpga_Node_t * pConst1
Definition fpgaInt.h:110
char * memset()
Here is the call graph for this function:

◆ Fpga_MappingSetRefsAndArea_rec()

float Fpga_MappingSetRefsAndArea_rec ( Fpga_Man_t * pMan,
Fpga_Node_t * pNode,
Fpga_Node_t ** ppStore )

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

Synopsis [Recursively computes the DFS ordering of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 267 of file fpgaUtils.c.

268{
269 float aArea;
270 int i;
271 assert( !Fpga_IsComplement(pNode) );
272 if ( pNode->nRefs++ )
273 return 0;
274 if ( !Fpga_NodeIsAnd(pNode) )
275 return 0;
276 assert( pNode->pCutBest != NULL );
277 // store the node in the structure by level
278 pNode->pData0 = (char *)ppStore[pNode->Level];
279 ppStore[pNode->Level] = pNode;
280 // visit the transitive fanin of the selected cut
281 aArea = pMan->pLutLib->pLutAreas[(int)pNode->pCutBest->nLeaves];
282 for ( i = 0; i < pNode->pCutBest->nLeaves; i++ )
283 aArea += Fpga_MappingSetRefsAndArea_rec( pMan, pNode->pCutBest->ppLeaves[i], ppStore );
284 return aArea;
285}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fpga_MappingSetupMask()

void Fpga_MappingSetupMask ( unsigned uMask[],
int nVarsMax )

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

Synopsis [Sets up the mask.]

Description []

SideEffects []

SeeAlso []

Definition at line 475 of file fpgaUtils.c.

476{
477 if ( nVarsMax == 6 )
478 uMask[0] = uMask[1] = FPGA_FULL;
479 else
480 {
481 uMask[0] = FPGA_MASK(1 << nVarsMax);
482 uMask[1] = 0;
483 }
484}
#define FPGA_FULL
Definition fpgaInt.h:56
#define FPGA_MASK(n)
Definition fpgaInt.h:55

◆ Fpga_MappingSetupTruthTables()

void Fpga_MappingSetupTruthTables ( unsigned uTruths[][2])

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

Synopsis [Sets up the truth tables.]

Description []

SideEffects []

SeeAlso []

Definition at line 449 of file fpgaUtils.c.

450{
451 int m, v;
452 // set up the truth tables
453 for ( m = 0; m < 32; m++ )
454 for ( v = 0; v < 5; v++ )
455 if ( m & (1 << v) )
456 uTruths[v][0] |= (1 << m);
457 // make adjustments for the case of 6 variables
458 for ( v = 0; v < 5; v++ )
459 uTruths[v][1] = uTruths[v][0];
460 uTruths[5][0] = 0;
461 uTruths[5][1] = FPGA_FULL;
462}

◆ Fpga_MappingSortByLevel()

void Fpga_MappingSortByLevel ( Fpga_Man_t * pMan,
Fpga_NodeVec_t * vNodes,
int fIncreasing )

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

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

Description []

SideEffects []

SeeAlso []

Definition at line 584 of file fpgaUtils.c.

585{
586 if ( fIncreasing )
587 qsort( (void *)vNodes->pArray, (size_t)vNodes->nSize, sizeof(Fpga_Node_t *),
588 (int (*)(const void *, const void *)) Fpga_CompareNodesByLevelIncreasing );
589 else
590 qsort( (void *)vNodes->pArray, (size_t)vNodes->nSize, sizeof(Fpga_Node_t *),
591 (int (*)(const void *, const void *)) Fpga_CompareNodesByLevelDecreasing );
592// assert( Fpga_CompareNodesByLevel( vNodes->pArray, vNodes->pArray + vNodes->nSize - 1 ) <= 0 );
593}
int Fpga_CompareNodesByLevelIncreasing(Fpga_Node_t **ppS1, Fpga_Node_t **ppS2)
Definition fpgaUtils.c:564
int Fpga_CompareNodesByLevelDecreasing(Fpga_Node_t **ppS1, Fpga_Node_t **ppS2)
Definition fpgaUtils.c:544
Here is the call graph for this function:

◆ Fpga_MappingUpdateLevel_rec()

int Fpga_MappingUpdateLevel_rec ( Fpga_Man_t * pMan,
Fpga_Node_t * pNode,
int fMaximum )

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

Synopsis [Analyses choice nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 826 of file fpgaUtils.c.

827{
828 Fpga_Node_t * pTemp;
829 int Level1, Level2, LevelE;
830 assert( !Fpga_IsComplement(pNode) );
831 if ( !Fpga_NodeIsAnd(pNode) )
832 return pNode->Level;
833 // skip the visited node
834 if ( pNode->TravId == pMan->nTravIds )
835 return pNode->Level;
836 pNode->TravId = pMan->nTravIds;
837 // compute levels of the children nodes
838 Level1 = Fpga_MappingUpdateLevel_rec( pMan, Fpga_Regular(pNode->p1), fMaximum );
839 Level2 = Fpga_MappingUpdateLevel_rec( pMan, Fpga_Regular(pNode->p2), fMaximum );
840 pNode->Level = 1 + FPGA_MAX( Level1, Level2 );
841 if ( pNode->pNextE )
842 {
843 LevelE = Fpga_MappingUpdateLevel_rec( pMan, pNode->pNextE, fMaximum );
844 if ( fMaximum )
845 {
846 if ( pNode->Level < (unsigned)LevelE )
847 pNode->Level = LevelE;
848 }
849 else
850 {
851 if ( pNode->Level > (unsigned)LevelE )
852 pNode->Level = LevelE;
853 }
854 // set the level of all equivalent nodes to be the same minimum
855 if ( pNode->pRepr == NULL ) // the primary node
856 for ( pTemp = pNode->pNextE; pTemp; pTemp = pTemp->pNextE )
857 pTemp->Level = pNode->Level;
858 }
859 return pNode->Level;
860}
Here is the call graph for this function:
Here is the caller graph for this function: