abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
fpgaTime.c File Reference
#include "fpgaInt.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START float Fpga_TimeCutComputeArrival (Fpga_Man_t *pMan, Fpga_Cut_t *pCut)
 DECLARATIONS ///. More...
 
float Fpga_TimeCutComputeArrival_rec (Fpga_Man_t *pMan, Fpga_Cut_t *pCut)
 
float Fpga_TimeComputeArrivalMax (Fpga_Man_t *p)
 
void Fpga_TimeComputeRequiredGlobal (Fpga_Man_t *p, int fFirstTime)
 
void Fpga_TimeComputeRequired (Fpga_Man_t *p, float fRequired)
 
void Fpga_TimePropagateRequired (Fpga_Man_t *p, Fpga_NodeVec_t *vNodes)
 
void Fpga_TimePropagateArrival (Fpga_Man_t *p)
 

Function Documentation

float Fpga_TimeComputeArrivalMax ( Fpga_Man_t p)

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

Synopsis [Computes the maximum arrival times.]

Description []

SideEffects []

SeeAlso []

Definition at line 89 of file fpgaTime.c.

90 {
91  float fRequired;
92  int i;
93  if ( p->fLatchPaths && p->nLatches == 0 )
94  {
95  printf( "Delay optimization of latch path is not performed because there is no latches.\n" );
96  p->fLatchPaths = 0;
97  }
98  // get the critical PO arrival time
99  fRequired = -FPGA_FLOAT_LARGE;
100  if ( p->fLatchPaths )
101  {
102  for ( i = p->nOutputs - p->nLatches; i < p->nOutputs; i++ )
103  {
104  if ( Fpga_NodeIsConst(p->pOutputs[i]) )
105  continue;
106  fRequired = FPGA_MAX( fRequired, Fpga_Regular(p->pOutputs[i])->pCutBest->tArrival );
107 // printf( " %5.1f", Fpga_Regular(p->pOutputs[i])->pCutBest->tArrival );
108  }
109 // printf( "Required latches = %5.1f\n", fRequired );
110  }
111  else
112  {
113  for ( i = 0; i < p->nOutputs; i++ )
114  {
115  if ( Fpga_NodeIsConst(p->pOutputs[i]) )
116  continue;
117  fRequired = FPGA_MAX( fRequired, Fpga_Regular(p->pOutputs[i])->pCutBest->tArrival );
118 // printf( " %5.1f", Fpga_Regular(p->pOutputs[i])->pCutBest->tArrival );
119  }
120 // printf( "Required outputs = %5.1f\n", fRequired );
121  }
122  return fRequired;
123 }
Fpga_Node_t ** pOutputs
Definition: fpgaInt.h:106
#define FPGA_FLOAT_LARGE
Definition: fpgaInt.h:65
#define FPGA_MAX(a, b)
Definition: fpgaInt.h:62
int Fpga_NodeIsConst(Fpga_Node_t *p)
Definition: fpgaCreate.c:125
#define Fpga_Regular(p)
Definition: fpga.h:58
void Fpga_TimeComputeRequired ( Fpga_Man_t p,
float  fRequired 
)

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

Synopsis [Computes the required times of all nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 168 of file fpgaTime.c.

169 {
170  int i;
171  // clean the required times and the fanout counts for all nodes
172  for ( i = 0; i < p->vAnds->nSize; i++ )
174  // set the required times for the POs
175  if ( p->fLatchPaths )
176  for ( i = p->nOutputs - p->nLatches; i < p->nOutputs; i++ )
177  Fpga_Regular(p->pOutputs[i])->tRequired = fRequired;
178  else
179  for ( i = 0; i < p->nOutputs; i++ )
180  Fpga_Regular(p->pOutputs[i])->tRequired = fRequired;
181  // collect nodes reachable from POs in the DFS order through the best cuts
183 /*
184  {
185  int Counter = 0;
186  for ( i = 0; i < p->vAnds->nSize; i++ )
187  if ( p->vAnds->pArray[i]->tRequired > FPGA_FLOAT_LARGE - 100 )
188  Counter++;
189  printf( "The number of nodes with large required times = %d.\n", Counter );
190  }
191 */
192 }
Fpga_Node_t ** pOutputs
Definition: fpgaInt.h:106
#define FPGA_FLOAT_LARGE
Definition: fpgaInt.h:65
Fpga_NodeVec_t * vMapping
Definition: fpgaInt.h:113
if(last==0)
Definition: sparse_int.h:34
#define Fpga_Regular(p)
Definition: fpga.h:58
void Fpga_TimePropagateRequired(Fpga_Man_t *p, Fpga_NodeVec_t *vNodes)
Definition: fpgaTime.c:205
Fpga_Node_t ** pArray
Definition: fpgaInt.h:252
Fpga_NodeVec_t * vAnds
Definition: fpgaInt.h:112
void Fpga_TimeComputeRequiredGlobal ( Fpga_Man_t p,
int  fFirstTime 
)

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

Synopsis [Computes the required times of all nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 136 of file fpgaTime.c.

137 {
139  // update the required times according to the target
140  if ( p->DelayTarget != -1 )
141  {
142  if ( p->fRequiredGlo > p->DelayTarget + p->fEpsilon )
143  {
144  if ( fFirstTime )
145  printf( "Cannot meet the target required times (%4.2f). Mapping continues anyway.\n", p->DelayTarget );
146  }
147  else if ( p->fRequiredGlo < p->DelayTarget - p->fEpsilon )
148  {
149  if ( fFirstTime )
150  printf( "Relaxing the required times from (%4.2f) to the target (%4.2f).\n", p->fRequiredGlo, p->DelayTarget );
151  p->fRequiredGlo = p->DelayTarget;
152  }
153  }
155 }
float Fpga_TimeComputeArrivalMax(Fpga_Man_t *p)
Definition: fpgaTime.c:89
void Fpga_TimeComputeRequired(Fpga_Man_t *p, float fRequired)
Definition: fpgaTime.c:168
float DelayTarget
Definition: fpgaInt.h:127
float fRequiredGlo
Definition: fpgaInt.h:145
ABC_NAMESPACE_IMPL_START float Fpga_TimeCutComputeArrival ( Fpga_Man_t pMan,
Fpga_Cut_t pCut 
)

DECLARATIONS ///.

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

FileName [fpgaTime.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:
fpgaTime.c,v 1.1 2005/01/23 06:59:42 alanmi Exp

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

Synopsis [Computes the arrival times of the cut.]

Description [Computes the maximum arrival time of the cut leaves and adds the delay of the LUT.]

SideEffects []

SeeAlso []

Definition at line 44 of file fpgaTime.c.

45 {
46  int i;
47  float tArrival;
48  tArrival = -FPGA_FLOAT_LARGE;
49  for ( i = 0; i < pCut->nLeaves; i++ )
50  if ( tArrival < pCut->ppLeaves[i]->pCutBest->tArrival )
51  tArrival = pCut->ppLeaves[i]->pCutBest->tArrival;
52  tArrival += pMan->pLutLib->pLutDelays[(int)pCut->nLeaves][0];
53  return tArrival;
54 }
float pLutDelays[FPGA_MAX_LUTSIZE+1][FPGA_MAX_LUTSIZE+1]
Definition: fpgaInt.h:176
#define FPGA_FLOAT_LARGE
Definition: fpgaInt.h:65
Fpga_Node_t * ppLeaves[FPGA_MAX_LEAVES+1]
Definition: fpgaInt.h:237
Fpga_LutLib_t * pLutLib
Definition: fpgaInt.h:137
Fpga_Cut_t * pCutBest
Definition: fpgaInt.h:222
float Fpga_TimeCutComputeArrival_rec ( Fpga_Man_t pMan,
Fpga_Cut_t pCut 
)

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

Synopsis [Computes the arrival times of the cut recursively.]

Description [When computing the arrival time for the previously unused cuts, their arrival time may be incorrect because their fanins have incorrect arrival time. This procedure is called to fix this problem.]

SideEffects []

SeeAlso []

Definition at line 69 of file fpgaTime.c.

70 {
71  int i;
72  for ( i = 0; i < pCut->nLeaves; i++ )
73  if ( pCut->ppLeaves[i]->nRefs == 0 )
75  return Fpga_TimeCutComputeArrival( pMan, pCut );
76 }
float Fpga_TimeCutComputeArrival_rec(Fpga_Man_t *pMan, Fpga_Cut_t *pCut)
Definition: fpgaTime.c:69
Fpga_Node_t * ppLeaves[FPGA_MAX_LEAVES+1]
Definition: fpgaInt.h:237
Fpga_Cut_t * pCutBest
Definition: fpgaInt.h:222
ABC_NAMESPACE_IMPL_START float Fpga_TimeCutComputeArrival(Fpga_Man_t *pMan, Fpga_Cut_t *pCut)
DECLARATIONS ///.
Definition: fpgaTime.c:44
void Fpga_TimePropagateArrival ( Fpga_Man_t p)

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

Synopsis [Computes the required times of all nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 245 of file fpgaTime.c.

246 {
247  Fpga_Node_t * pNode;
248  Fpga_Cut_t * pCut;
249  int i;
250 
251  // clean the required times and the fanout counts for all nodes
252  for ( i = 0; i < p->vAnds->nSize; i++ )
253  {
254  pNode = p->vAnds->pArray[i];
255  for ( pCut = pNode->pCuts->pNext; pCut; pCut = pCut->pNext )
256  pCut->tArrival = Fpga_TimeCutComputeArrival( p, pCut );
257  }
258 }
Fpga_Cut_t * pCuts
Definition: fpgaInt.h:224
Fpga_Node_t ** pArray
Definition: fpgaInt.h:252
Fpga_Cut_t * pNext
Definition: fpgaInt.h:246
ABC_NAMESPACE_IMPL_START float Fpga_TimeCutComputeArrival(Fpga_Man_t *pMan, Fpga_Cut_t *pCut)
DECLARATIONS ///.
Definition: fpgaTime.c:44
Fpga_NodeVec_t * vAnds
Definition: fpgaInt.h:112
void Fpga_TimePropagateRequired ( Fpga_Man_t p,
Fpga_NodeVec_t vNodes 
)

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

Synopsis [Computes the required times of the given nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 205 of file fpgaTime.c.

206 {
207  Fpga_Node_t * pNode, * pChild;
208  float fRequired;
209  int i, k;
210 
211  // sorts the nodes in the decreasing order of levels
212 // Fpga_MappingSortByLevel( p, vNodes, 0 );
213  // the nodes area already sorted in Fpga_MappingSetRefsAndArea()
214 
215  // go through the nodes in the reverse topological order
216  for ( k = 0; k < vNodes->nSize; k++ )
217  {
218  pNode = vNodes->pArray[k];
219  if ( !Fpga_NodeIsAnd(pNode) )
220  continue;
221  // get the required time for children
222  fRequired = pNode->tRequired - p->pLutLib->pLutDelays[(int)pNode->pCutBest->nLeaves][0];
223  // update the required time of the children
224  for ( i = 0; i < pNode->pCutBest->nLeaves; i++ )
225  {
226  pChild = pNode->pCutBest->ppLeaves[i];
227  pChild->tRequired = FPGA_MIN( pChild->tRequired, fRequired );
228  }
229  }
230 }
float pLutDelays[FPGA_MAX_LUTSIZE+1][FPGA_MAX_LUTSIZE+1]
Definition: fpgaInt.h:176
for(p=first;p->value< newval;p=p->next)
Fpga_Node_t * ppLeaves[FPGA_MAX_LEAVES+1]
Definition: fpgaInt.h:237
#define FPGA_MIN(a, b)
Definition: fpgaInt.h:61
int Fpga_NodeIsAnd(Fpga_Node_t *p)
Definition: fpgaCreate.c:127
Fpga_LutLib_t * pLutLib
Definition: fpgaInt.h:137
Fpga_Node_t ** pArray
Definition: fpgaInt.h:252
Fpga_Cut_t * pCutBest
Definition: fpgaInt.h:222