ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
fpgaTime.c
Go to the documentation of this file.
1
18
19#include "fpgaInt.h"
20
22
23
27
31
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}
55
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}
77
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}
124
137{
138 p->fRequiredGlo = Fpga_TimeComputeArrivalMax( p );
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 }
154 Fpga_TimeComputeRequired( p, p->fRequiredGlo );
155}
156
168void Fpga_TimeComputeRequired( Fpga_Man_t * p, float fRequired )
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++ )
173 p->vAnds->pArray[i]->tRequired = FPGA_FLOAT_LARGE;
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
182 Fpga_TimePropagateRequired( p, p->vMapping );
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}
193
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}
231
232
233
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}
259
260
264
265
267
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
Cube * p
Definition exorList.c:222
#define FPGA_MAX(a, b)
Definition fpgaInt.h:62
#define FPGA_FLOAT_LARGE
Definition fpgaInt.h:65
#define FPGA_MIN(a, b)
Definition fpgaInt.h:61
void Fpga_TimeComputeRequired(Fpga_Man_t *p, float fRequired)
Definition fpgaTime.c:168
float Fpga_TimeComputeArrivalMax(Fpga_Man_t *p)
Definition fpgaTime.c:89
float Fpga_TimeCutComputeArrival_rec(Fpga_Man_t *pMan, Fpga_Cut_t *pCut)
Definition fpgaTime.c:69
void Fpga_TimePropagateArrival(Fpga_Man_t *p)
Definition fpgaTime.c:245
void Fpga_TimeComputeRequiredGlobal(Fpga_Man_t *p, int fFirstTime)
Definition fpgaTime.c:136
ABC_NAMESPACE_IMPL_START float Fpga_TimeCutComputeArrival(Fpga_Man_t *pMan, Fpga_Cut_t *pCut)
DECLARATIONS ///.
Definition fpgaTime.c:44
void Fpga_TimePropagateRequired(Fpga_Man_t *p, Fpga_NodeVec_t *vNodes)
Definition fpgaTime.c:205
struct Fpga_NodeStruct_t_ Fpga_Node_t
Definition fpga.h:44
int Fpga_NodeIsConst(Fpga_Node_t *p)
Definition fpgaCreate.c:125
struct Fpga_NodeVecStruct_t_ Fpga_NodeVec_t
Definition fpga.h:45
struct Fpga_ManStruct_t_ Fpga_Man_t
STRUCTURE DEFINITIONS ///.
Definition fpga.h:43
struct Fpga_CutStruct_t_ Fpga_Cut_t
Definition fpga.h:46
int Fpga_NodeIsAnd(Fpga_Node_t *p)
Definition fpgaCreate.c:127
#define Fpga_Regular(p)
Definition fpga.h:58
Fpga_Node_t * ppLeaves[FPGA_MAX_LEAVES+1]
Definition fpgaInt.h:237
Fpga_Cut_t * pNext
Definition fpgaInt.h:246
float pLutDelays[FPGA_MAX_LUTSIZE+1][FPGA_MAX_LUTSIZE+1]
Definition fpgaInt.h:176
Fpga_LutLib_t * pLutLib
Definition fpgaInt.h:137
Fpga_Cut_t * pCuts
Definition fpgaInt.h:224
Fpga_Cut_t * pCutBest
Definition fpgaInt.h:222
Fpga_Node_t ** pArray
Definition fpgaInt.h:252