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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START Fpga_Cut_tFpga_CutAlloc (Fpga_Man_t *p)
 DECLARATIONS ///.
 
Fpga_Cut_tFpga_CutDup (Fpga_Man_t *p, Fpga_Cut_t *pCutOld)
 
void Fpga_CutFree (Fpga_Man_t *p, Fpga_Cut_t *pCut)
 
void Fpga_CutPrint (Fpga_Man_t *p, Fpga_Node_t *pRoot, Fpga_Cut_t *pCut)
 
Fpga_Cut_tFpga_CutCreateSimple (Fpga_Man_t *p, Fpga_Node_t *pNode)
 
float Fpga_CutGetRootArea (Fpga_Man_t *p, Fpga_Cut_t *pCut)
 
Fpga_Cut_tFpga_CutListAppend (Fpga_Cut_t *pSetAll, Fpga_Cut_t *pSets)
 
void Fpga_CutListRecycle (Fpga_Man_t *p, Fpga_Cut_t *pSetList, Fpga_Cut_t *pSave)
 
int Fpga_CutListCount (Fpga_Cut_t *pSets)
 
void Fpga_CutGetParameters (Fpga_Man_t *pMan, Fpga_Cut_t *pCut)
 
float Fpga_CutGetAreaFlow (Fpga_Man_t *pMan, Fpga_Cut_t *pCut)
 
float Fpga_CutGetAreaRefed (Fpga_Man_t *pMan, Fpga_Cut_t *pCut)
 
float Fpga_CutGetAreaDerefed (Fpga_Man_t *pMan, Fpga_Cut_t *pCut)
 
float Fpga_CutRef (Fpga_Man_t *pMan, Fpga_Node_t *pNode, Fpga_Cut_t *pCut, int fFanouts)
 
float Fpga_CutDeref (Fpga_Man_t *pMan, Fpga_Node_t *pNode, Fpga_Cut_t *pCut, int fFanouts)
 
void Fpga_MappingSetUsedCuts (Fpga_Man_t *pMan)
 

Function Documentation

◆ Fpga_CutAlloc()

DECLARATIONS ///.

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

FileName [fpgaCutUtils.c]

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

Synopsis [Generic technology mapping engine.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

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

Revision [

Id
fpgaCutUtils.h,v 1.0 2003/09/08 00:00:00 alanmi Exp

] FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Allocates the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 43 of file fpgaCutUtils.c.

44{
45 Fpga_Cut_t * pCut;
46 pCut = (Fpga_Cut_t *)Extra_MmFixedEntryFetch( p->mmCuts );
47 memset( pCut, 0, sizeof(Fpga_Cut_t) );
48 return pCut;
49}
Cube * p
Definition exorList.c:222
char * Extra_MmFixedEntryFetch(Extra_MmFixed_t *p)
struct Fpga_CutStruct_t_ Fpga_Cut_t
Definition fpga.h:46
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fpga_CutCreateSimple()

Fpga_Cut_t * Fpga_CutCreateSimple ( Fpga_Man_t * p,
Fpga_Node_t * pNode )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 123 of file fpgaCutUtils.c.

124{
125 Fpga_Cut_t * pCut;
126 pCut = Fpga_CutAlloc( p );
127 pCut->pRoot = pNode;
128 pCut->nLeaves = 1;
129 pCut->ppLeaves[0] = pNode;
130 pCut->uSign = FPGA_SEQ_SIGN(pCut->ppLeaves[0]);
131 return pCut;
132}
ABC_NAMESPACE_IMPL_START Fpga_Cut_t * Fpga_CutAlloc(Fpga_Man_t *p)
DECLARATIONS ///.
#define FPGA_SEQ_SIGN(p)
Definition fpgaInt.h:70
Fpga_Node_t * pRoot
Definition fpgaInt.h:236
Fpga_Node_t * ppLeaves[FPGA_MAX_LEAVES+1]
Definition fpgaInt.h:237
unsigned uSign
Definition fpgaInt.h:239
Here is the call graph for this function:

◆ Fpga_CutDeref()

float Fpga_CutDeref ( Fpga_Man_t * pMan,
Fpga_Node_t * pNode,
Fpga_Cut_t * pCut,
int fFanouts )

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

synopsis [Dereferences the cut.]

description [This procedure is similar to the procedure NodeRecusiveDeref.]

sideeffects []

seealso []

Definition at line 421 of file fpgaCutUtils.c.

422{
423 Fpga_Node_t * pNodeChild;
424 float aArea;
425 int i;
426
427 // deref the fanouts
428// if ( fFanouts )
429// Fpga_CutRemoveFanouts( pMan, pNode, pCut );
430
431 // start the area of this cut
432 aArea = pMan->pLutLib->pLutAreas[(int)pCut->nLeaves];
433 // go through the children
434 for ( i = 0; i < pCut->nLeaves; i++ )
435 {
436 pNodeChild = pCut->ppLeaves[i];
437 assert( pNodeChild->nRefs > 0 );
438 if ( --pNodeChild->nRefs > 0 )
439 continue;
440 if ( !Fpga_NodeIsAnd(pNodeChild) )
441 continue;
442 aArea += Fpga_CutDeref( pMan, pNodeChild, pNodeChild->pCutBest, fFanouts );
443 }
444 return aArea;
445}
float Fpga_CutDeref(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
int Fpga_NodeIsAnd(Fpga_Node_t *p)
Definition fpgaCreate.c:127
float pLutAreas[FPGA_MAX_LUTSIZE+1]
Definition fpgaInt.h:175
Fpga_LutLib_t * pLutLib
Definition fpgaInt.h:137
#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_CutDup()

Fpga_Cut_t * Fpga_CutDup ( Fpga_Man_t * p,
Fpga_Cut_t * pCutOld )

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

Synopsis [Duplicates the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 62 of file fpgaCutUtils.c.

63{
64 Fpga_Cut_t * pCutNew;
65 int i;
66 pCutNew = Fpga_CutAlloc( p );
67 pCutNew->pRoot = pCutOld->pRoot;
68 pCutNew->nLeaves = pCutOld->nLeaves;
69 for ( i = 0; i < pCutOld->nLeaves; i++ )
70 pCutNew->ppLeaves[i] = pCutOld->ppLeaves[i];
71 return pCutNew;
72}
Here is the call graph for this function:

◆ Fpga_CutFree()

void Fpga_CutFree ( Fpga_Man_t * p,
Fpga_Cut_t * pCut )

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

Synopsis [Deallocates the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 85 of file fpgaCutUtils.c.

86{
87 if ( pCut )
88 Extra_MmFixedEntryRecycle( p->mmCuts, (char *)pCut );
89}
void Extra_MmFixedEntryRecycle(Extra_MmFixed_t *p, char *pEntry)
Here is the call graph for this function:

◆ Fpga_CutGetAreaDerefed()

float Fpga_CutGetAreaDerefed ( Fpga_Man_t * pMan,
Fpga_Cut_t * pCut )

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

synopsis [Computes the exact area associated with the cut.]

description []

sideeffects []

seealso []

Definition at line 362 of file fpgaCutUtils.c.

363{
364 float aResult, aResult2;
365 if ( pCut->nLeaves == 1 )
366 return 0;
367 aResult2 = Fpga_CutRef( pMan, NULL, pCut, 0 );
368 aResult = Fpga_CutDeref( pMan, NULL, pCut, 0 );
369 assert( Fpga_FloatEqual( pMan, aResult, aResult2 ) );
370 return aResult;
371}
float Fpga_CutRef(Fpga_Man_t *pMan, Fpga_Node_t *pNode, Fpga_Cut_t *pCut, int fFanouts)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fpga_CutGetAreaFlow()

float Fpga_CutGetAreaFlow ( Fpga_Man_t * pMan,
Fpga_Cut_t * pCut )

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

synopsis [Computes the area flow of the cut.]

description []

sideeffects []

seealso []

Definition at line 314 of file fpgaCutUtils.c.

315{
316 Fpga_Cut_t * pCutFanin;
317 int i;
318 pCut->aFlow = pMan->pLutLib->pLutAreas[(int)pCut->nLeaves];
319 for ( i = 0; i < pCut->nLeaves; i++ )
320 {
321 // get the cut implementing this phase of the fanin
322 pCutFanin = pCut->ppLeaves[i]->pCutBest;
323 assert( pCutFanin );
324 pCut->aFlow += pCutFanin->aFlow / pCut->ppLeaves[i]->nRefs;
325 }
326 return pCut->aFlow;
327}
Fpga_Cut_t * pCutBest
Definition fpgaInt.h:222

◆ Fpga_CutGetAreaRefed()

float Fpga_CutGetAreaRefed ( Fpga_Man_t * pMan,
Fpga_Cut_t * pCut )

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

synopsis [Computes the exact area associated with the cut.]

description []

sideeffects []

seealso []

Definition at line 340 of file fpgaCutUtils.c.

341{
342 float aResult, aResult2;
343 if ( pCut->nLeaves == 1 )
344 return 0;
345 aResult = Fpga_CutDeref( pMan, NULL, pCut, 0 );
346 aResult2 = Fpga_CutRef( pMan, NULL, pCut, 0 );
347 assert( Fpga_FloatEqual( pMan, aResult, aResult2 ) );
348 return aResult;
349}
Here is the call graph for this function:

◆ Fpga_CutGetParameters()

void Fpga_CutGetParameters ( Fpga_Man_t * pMan,
Fpga_Cut_t * pCut )

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

Synopsis [Computes the arrival time and the area flow of the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 279 of file fpgaCutUtils.c.

280{
281 Fpga_Cut_t * pFaninCut;
282 int i;
283 pCut->tArrival = -FPGA_FLOAT_LARGE;
284 pCut->aFlow = pMan->pLutLib->pLutAreas[(int)pCut->nLeaves];
285 for ( i = 0; i < pCut->nLeaves; i++ )
286 {
287 pFaninCut = pCut->ppLeaves[i]->pCutBest;
288 if ( pCut->tArrival < pFaninCut->tArrival )
289 pCut->tArrival = pFaninCut->tArrival;
290 // if the fanout count is not set, assume it to be 1
291 if ( pCut->ppLeaves[i]->nRefs == 0 )
292 pCut->aFlow += pFaninCut->aFlow;
293 else
294// pCut->aFlow += pFaninCut->aFlow / pCut->ppLeaves[i]->nRefs;
295 pCut->aFlow += pFaninCut->aFlow / pCut->ppLeaves[i]->aEstFanouts;
296 }
297 // use the first pin to compute the delay of the LUT
298 // (this mapper does not support the variable pin delay model)
299 pCut->tArrival += pMan->pLutLib->pLutDelays[(int)pCut->nLeaves][0];
300}
#define FPGA_FLOAT_LARGE
Definition fpgaInt.h:65
float pLutDelays[FPGA_MAX_LUTSIZE+1][FPGA_MAX_LUTSIZE+1]
Definition fpgaInt.h:176

◆ Fpga_CutGetRootArea()

float Fpga_CutGetRootArea ( Fpga_Man_t * p,
Fpga_Cut_t * pCut )

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

synopsis [Computes the exact area associated with the cut.]

description []

sideeffects []

seealso []

Definition at line 146 of file fpgaCutUtils.c.

147{
148 return p->pLutLib->pLutAreas[(int)pCut->nLeaves];
149}

◆ Fpga_CutListAppend()

Fpga_Cut_t * Fpga_CutListAppend ( Fpga_Cut_t * pSetAll,
Fpga_Cut_t * pSets )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 162 of file fpgaCutUtils.c.

163{
164 Fpga_Cut_t * pPrev = NULL; // Suppress "might be used uninitialized"
165 Fpga_Cut_t * pTemp;
166 if ( pSetAll == NULL )
167 return pSets;
168 if ( pSets == NULL )
169 return pSetAll;
170 // find the last one
171 for ( pTemp = pSets; pTemp; pTemp = pTemp->pNext )
172 pPrev = pTemp;
173 // append all the end of the current set
174 assert( pPrev->pNext == NULL );
175 pPrev->pNext = pSetAll;
176 return pSets;
177}
Fpga_Cut_t * pNext
Definition fpgaInt.h:246

◆ Fpga_CutListCount()

int Fpga_CutListCount ( Fpga_Cut_t * pSets)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 211 of file fpgaCutUtils.c.

212{
213 Fpga_Cut_t * pTemp;
214 int i;
215 for ( i = 0, pTemp = pSets; pTemp; pTemp = pTemp->pNext, i++ );
216 return i;
217}

◆ Fpga_CutListRecycle()

void Fpga_CutListRecycle ( Fpga_Man_t * p,
Fpga_Cut_t * pSetList,
Fpga_Cut_t * pSave )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 190 of file fpgaCutUtils.c.

191{
192 Fpga_Cut_t * pNext, * pTemp;
193 for ( pTemp = pSetList, pNext = pTemp? pTemp->pNext : NULL;
194 pTemp;
195 pTemp = pNext, pNext = pNext? pNext->pNext : NULL )
196 if ( pTemp != pSave )
197 Extra_MmFixedEntryRecycle( p->mmCuts, (char *)pTemp );
198}
Here is the call graph for this function:

◆ Fpga_CutPrint()

void Fpga_CutPrint ( Fpga_Man_t * p,
Fpga_Node_t * pRoot,
Fpga_Cut_t * pCut )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 102 of file fpgaCutUtils.c.

103{
104 int i;
105 printf( "CUT: Delay = %4.2f. Area = %4.2f. Nodes = %d -> {",
106 pCut->tArrival, pCut->aFlow, pRoot->Num );
107 for ( i = 0; i < pCut->nLeaves; i++ )
108 printf( " %d", pCut->ppLeaves[i]->Num );
109 printf( " } \n" );
110}

◆ Fpga_CutRef()

float Fpga_CutRef ( Fpga_Man_t * pMan,
Fpga_Node_t * pNode,
Fpga_Cut_t * pCut,
int fFanouts )

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

synopsis [References the cut.]

description [This procedure is similar to the procedure NodeReclaim.]

sideeffects []

seealso []

Definition at line 384 of file fpgaCutUtils.c.

385{
386 Fpga_Node_t * pNodeChild;
387 float aArea;
388 int i;
389
390 // deref the fanouts
391// if ( fFanouts )
392// Fpga_CutInsertFanouts( pMan, pNode, pCut );
393
394 // start the area of this cut
395 aArea = pMan->pLutLib->pLutAreas[(int)pCut->nLeaves];
396 // go through the children
397 for ( i = 0; i < pCut->nLeaves; i++ )
398 {
399 pNodeChild = pCut->ppLeaves[i];
400 assert( pNodeChild->nRefs >= 0 );
401 if ( pNodeChild->nRefs++ > 0 )
402 continue;
403 if ( !Fpga_NodeIsAnd(pNodeChild) )
404 continue;
405 aArea += Fpga_CutRef( pMan, pNodeChild, pNodeChild->pCutBest, fFanouts );
406 }
407 return aArea;
408}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fpga_MappingSetUsedCuts()

void Fpga_MappingSetUsedCuts ( Fpga_Man_t * pMan)

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

Synopsis [Sets the used cuts to be the currently selected ones.]

Description []

SideEffects []

SeeAlso []

Definition at line 459 of file fpgaCutUtils.c.

460{
461 int i;
462 for ( i = 0; i < pMan->vNodesAll->nSize; i++ )
463 if ( pMan->vNodesAll->pArray[i]->pCutOld )
464 {
465 pMan->vNodesAll->pArray[i]->pCutBest = pMan->vNodesAll->pArray[i]->pCutOld;
466 pMan->vNodesAll->pArray[i]->pCutOld = NULL;
467 }
468}
Fpga_NodeVec_t * vNodesAll
Definition fpgaInt.h:111
Fpga_Cut_t * pCutOld
Definition fpgaInt.h:223
Fpga_Node_t ** pArray
Definition fpgaInt.h:252