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

Go to the source code of this file.

Classes

struct  Fpga_CutTableStrutct_t
 

Macros

#define FPGA_CUTS_MAX_COMPUTE   2000
 
#define FPGA_CUTS_MAX_USE   1000
 
#define FPGA_COUNT_ONES(u)
 
#define Fpga_ListForEachCut(pList, pCut)
 
#define Fpga_ListForEachCutSafe(pList, pCut, pCut2)
 

Typedefs

typedef typedefABC_NAMESPACE_IMPL_START struct Fpga_CutTableStrutct_t Fpga_CutTable_t
 DECLARATIONS ///.
 

Functions

Fpga_Cut_tFpga_CutAlloc (Fpga_Man_t *p)
 DECLARATIONS ///.
 
int Fpga_CutCountAll (Fpga_Man_t *pMan)
 
void Fpga_MappingCuts (Fpga_Man_t *p)
 FUNCTION DEFINITIONS ///.
 
void Fpga_MappingCreatePiCuts (Fpga_Man_t *p)
 
Fpga_Cut_tFpga_CutMergeLists2 (Fpga_Man_t *p, Fpga_CutTable_t *pTable, Fpga_Cut_t *pList1, Fpga_Cut_t *pList2, int fComp1, int fComp2, int fPivot1, int fPivot2)
 
void Fpga_CutsCleanSign (Fpga_Man_t *pMan)
 
void Fpga_CutsCleanRoot (Fpga_Man_t *pMan)
 

Macro Definition Documentation

◆ FPGA_COUNT_ONES

#define FPGA_COUNT_ONES ( u)
Value:
(bit_count[(u)&255]+bit_count[((u)>>8)&255]+bit_count[((u)>>16)&255]+bit_count[(u)>>24])

Definition at line 61 of file fpgaCut.c.

◆ FPGA_CUTS_MAX_COMPUTE

#define FPGA_CUTS_MAX_COMPUTE   2000

Definition at line 42 of file fpgaCut.c.

◆ FPGA_CUTS_MAX_USE

#define FPGA_CUTS_MAX_USE   1000

Definition at line 45 of file fpgaCut.c.

◆ Fpga_ListForEachCut

#define Fpga_ListForEachCut ( pList,
pCut )
Value:
for ( pCut = pList; \
pCut; \
pCut = pCut->pNext )

Definition at line 90 of file fpgaCut.c.

90#define Fpga_ListForEachCut( pList, pCut ) \
91 for ( pCut = pList; \
92 pCut; \
93 pCut = pCut->pNext )

◆ Fpga_ListForEachCutSafe

#define Fpga_ListForEachCutSafe ( pList,
pCut,
pCut2 )
Value:
for ( pCut = pList, \
pCut2 = pCut? pCut->pNext: NULL; \
pCut; \
pCut = pCut2, \
pCut2 = pCut? pCut->pNext: NULL )

Definition at line 94 of file fpgaCut.c.

94#define Fpga_ListForEachCutSafe( pList, pCut, pCut2 ) \
95 for ( pCut = pList, \
96 pCut2 = pCut? pCut->pNext: NULL; \
97 pCut; \
98 pCut = pCut2, \
99 pCut2 = pCut? pCut->pNext: NULL )

Typedef Documentation

◆ Fpga_CutTable_t

typedef typedefABC_NAMESPACE_IMPL_START struct Fpga_CutTableStrutct_t Fpga_CutTable_t

DECLARATIONS ///.

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

FileName [fpgaCut.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
fpgaCut.c,v 1.3 2004/07/06 04:55:57 alanmi Exp

]

Definition at line 28 of file fpgaCut.c.

Function Documentation

◆ Fpga_CutAlloc()

Fpga_Cut_t * Fpga_CutAlloc ( Fpga_Man_t * p)
extern

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_CutCountAll()

int Fpga_CutCountAll ( Fpga_Man_t * pMan)
extern

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

Synopsis [Counts all the cuts.]

Description []

SideEffects []

SeeAlso []

Definition at line 767 of file fpgaCut.c.

768{
769 Fpga_Node_t * pNode;
770 Fpga_Cut_t * pCut;
771 int i, nCuts;
772 // go through all the nodes in the unique table of the manager
773 nCuts = 0;
774 for ( i = 0; i < pMan->nBins; i++ )
775 for ( pNode = pMan->pBins[i]; pNode; pNode = pNode->pNext )
776 for ( pCut = pNode->pCuts; pCut; pCut = pCut->pNext )
777 if ( pCut->nLeaves > 1 ) // skip the elementary cuts
778 {
779// Fpga_CutVolume( pCut );
780 nCuts++;
781 }
782 return nCuts;
783}
struct Fpga_NodeStruct_t_ Fpga_Node_t
Definition fpga.h:44
Fpga_Cut_t * pNext
Definition fpgaInt.h:246
Fpga_Node_t ** pBins
Definition fpgaInt.h:102
Fpga_Cut_t * pCuts
Definition fpgaInt.h:224
Fpga_Node_t * pNext
Definition fpgaInt.h:183
Here is the caller graph for this function:

◆ Fpga_CutMergeLists2()

Fpga_Cut_t * Fpga_CutMergeLists2 ( Fpga_Man_t * p,
Fpga_CutTable_t * pTable,
Fpga_Cut_t * pList1,
Fpga_Cut_t * pList2,
int fComp1,
int fComp2,
int fPivot1,
int fPivot2 )

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

Synopsis [Merges two lists of cuts.]

Description []

SideEffects []

SeeAlso []

Definition at line 539 of file fpgaCut.c.

541{
542 Fpga_Node_t * ppNodes[FPGA_MAX_LEAVES];
543 Fpga_Cut_t * pListNew, ** ppListNew, * pLists[FPGA_MAX_LEAVES+1] = { NULL };
544 Fpga_Cut_t * pCut, * pPrev, * pTemp1, * pTemp2;
545 int nNodes, Counter, i;
546
547 // prepare the manager for the cut computation
548 Fpga_CutTableRestart( pTable );
549 // go through the cut pairs
550 Counter = 0;
551 for ( pTemp1 = pList1; pTemp1; pTemp1 = fPivot1? NULL: pTemp1->pNext )
552 for ( pTemp2 = pList2; pTemp2; pTemp2 = fPivot2? NULL: pTemp2->pNext )
553 {
554 // check if k-feasible cut exists
555 nNodes = Fpga_CutMergeTwo( pTemp1, pTemp2, ppNodes, p->nVarsMax );
556 if ( nNodes == 0 )
557 continue;
558 // consider the cut for possible addition to the set of new cuts
559 pCut = Fpga_CutTableConsider( p, pTable, ppNodes, nNodes );
560 if ( pCut == NULL )
561 continue;
562 // add data to the cut
563 pCut->pOne = Fpga_CutNotCond( pTemp1, fComp1 );
564 pCut->pTwo = Fpga_CutNotCond( pTemp2, fComp2 );
565 // add it to the corresponding list
566 pCut->pNext = pLists[(int)pCut->nLeaves];
567 pLists[(int)pCut->nLeaves] = pCut;
568 // count this cut and quit if limit is reached
569 Counter++;
570 if ( Counter == FPGA_CUTS_MAX_COMPUTE )
571 goto QUITS;
572 }
573QUITS :
574 // combine all the lists into one
575 pListNew = NULL;
576 ppListNew = &pListNew;
577 for ( i = 1; i <= p->nVarsMax; i++ )
578 {
579 if ( pLists[i] == NULL )
580 continue;
581 // find the last entry
582 for ( pPrev = pLists[i], pCut = pPrev->pNext; pCut;
583 pPrev = pCut, pCut = pCut->pNext );
584 // connect these lists
585 *ppListNew = pLists[i];
586 ppListNew = &pPrev->pNext;
587 }
588 *ppListNew = NULL;
589 // sort the cuts by arrival times and use only the first FPGA_CUTS_MAX_USE
590 pListNew = Fpga_CutSortCuts( p, pTable, pListNew );
591 return pListNew;
592}
#define FPGA_CUTS_MAX_COMPUTE
Definition fpgaCut.c:42
#define Fpga_CutNotCond(p, c)
Definition fpgaInt.h:76
#define FPGA_MAX_LEAVES
INCLUDES ///.
Definition fpgaInt.h:52
Fpga_Cut_t * pTwo
Definition fpgaInt.h:235
Fpga_Cut_t * pOne
Definition fpgaInt.h:234

◆ Fpga_CutsCleanRoot()

void Fpga_CutsCleanRoot ( Fpga_Man_t * pMan)

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

Synopsis [Clean the signatures.]

Description []

SideEffects []

SeeAlso []

Definition at line 819 of file fpgaCut.c.

820{
821 Fpga_Node_t * pNode;
822 Fpga_Cut_t * pCut;
823 int i;
824 for ( i = 0; i < pMan->nBins; i++ )
825 for ( pNode = pMan->pBins[i]; pNode; pNode = pNode->pNext )
826 for ( pCut = pNode->pCuts; pCut; pCut = pCut->pNext )
827 pCut->pRoot = NULL;
828}
Fpga_Node_t * pRoot
Definition fpgaInt.h:236

◆ Fpga_CutsCleanSign()

void Fpga_CutsCleanSign ( Fpga_Man_t * pMan)

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

Synopsis [Clean the signatures.]

Description []

SideEffects []

SeeAlso []

Definition at line 797 of file fpgaCut.c.

798{
799 Fpga_Node_t * pNode;
800 Fpga_Cut_t * pCut;
801 int i;
802 for ( i = 0; i < pMan->nBins; i++ )
803 for ( pNode = pMan->pBins[i]; pNode; pNode = pNode->pNext )
804 for ( pCut = pNode->pCuts; pCut; pCut = pCut->pNext )
805 pCut->uSign = 0;
806}
unsigned uSign
Definition fpgaInt.h:239

◆ Fpga_MappingCreatePiCuts()

void Fpga_MappingCreatePiCuts ( Fpga_Man_t * p)

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

Synopsis [Performs technology mapping for variable-size-LUTs.]

Description []

SideEffects []

SeeAlso []

Definition at line 181 of file fpgaCut.c.

182{
183 Fpga_Cut_t * pCut;
184 int i;
185
186 // set the elementary cuts for the PI variables
187 for ( i = 0; i < p->nInputs; i++ )
188 {
189 pCut = Fpga_CutAlloc( p );
190 pCut->nLeaves = 1;
191 pCut->ppLeaves[0] = p->pInputs[i];
192 pCut->uSign = (1 << (i%31));
193 p->pInputs[i]->pCuts = pCut;
194 p->pInputs[i]->pCutBest = pCut;
195 // set the input arrival times
196// p->pInputs[i]->pCut[1]->tArrival = p->pInputArrivals[i];
197 }
198}
Fpga_Cut_t * Fpga_CutAlloc(Fpga_Man_t *p)
DECLARATIONS ///.
Fpga_Node_t * ppLeaves[FPGA_MAX_LEAVES+1]
Definition fpgaInt.h:237
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fpga_MappingCuts()

void Fpga_MappingCuts ( Fpga_Man_t * p)

FUNCTION DEFINITIONS ///.

GLOBAL VARIABLES ///.

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

Synopsis [Computes the cuts for each node in the object graph.]

Description [The cuts are computed in one sweep over the mapping graph. First, the elementary cuts, which include the node itself, are assigned to the PI nodes. The internal nodes are considered in the DFS order. Each node is two-input AND-gate. So to compute the cuts at a node, we need to merge the sets of cuts of its two predecessors. The merged set contains only unique cuts with the number of inputs equal to k or less. Finally, the elementary cut, composed of the node itself, is added to the set of cuts for the node.

This procedure is pretty fast for 5-feasible cuts, but it dramatically slows down on some "dense" networks when computing 6-feasible cuts. The problem is that there are too many cuts in this case. We should think how to heuristically trim the number of cuts in such cases, to have reasonable runtime.]

SideEffects []

SeeAlso []

Definition at line 130 of file fpgaCut.c.

131{
132 ProgressBar * pProgress;
133 Fpga_CutTable_t * pTable;
134 Fpga_Node_t * pNode;
135 int nCuts, nNodes, i;
136 clock_t clk = clock();
137
138 // set the elementary cuts for the PI variables
139 assert( p->nVarsMax > 1 && p->nVarsMax < 11 );
141
142 // compute the cuts for the internal nodes
143 nNodes = p->vAnds->nSize;
144 pProgress = Extra_ProgressBarStart( stdout, nNodes );
145 pTable = Fpga_CutTableStart( p );
146 for ( i = 0; i < nNodes; i++ )
147 {
148 Extra_ProgressBarUpdate( pProgress, i, "Cuts ..." );
149 pNode = p->vAnds->pArray[i];
150 if ( !Fpga_NodeIsAnd( pNode ) )
151 continue;
152 Fpga_CutCompute( p, pTable, pNode );
153 }
154 Extra_ProgressBarStop( pProgress );
155 Fpga_CutTableStop( pTable );
156
157 // report the stats
158 if ( p->fVerbose )
159 {
160 nCuts = Fpga_CutCountAll(p);
161 printf( "Nodes = %6d. Total %d-cuts = %d. Cuts per node = %.1f. ",
162 p->nNodes, p->nVarsMax, nCuts, ((float)nCuts)/p->nNodes );
163 ABC_PRT( "Time", clock() - clk );
164 }
165
166 // print the cuts for the first primary output
167// Fpga_CutListPrint( p, Fpga_Regular(p->pOutputs[0]) );
168}
#define ABC_PRT(a, t)
Definition abc_global.h:255
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 ///.
typedefABC_NAMESPACE_IMPL_START struct Fpga_CutTableStrutct_t Fpga_CutTable_t
DECLARATIONS ///.
Definition fpgaCut.c:28
void Fpga_MappingCreatePiCuts(Fpga_Man_t *p)
Definition fpgaCut.c:181
int Fpga_CutCountAll(Fpga_Man_t *pMan)
Definition fpgaCut.c:767
int Fpga_NodeIsAnd(Fpga_Node_t *p)
Definition fpgaCreate.c:127
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function: