47 int i, j, best_i, temp;
52 pPinDelays[i] = If_ObjCutBest(pLeaf)->Delay;
56 for ( i = 0; i < (int)pCut->
nLeaves-1; i++ )
59 for ( j = i+1; j < (int)pCut->
nLeaves; j++ )
60 if ( pPinDelays[pPinPerm[j]] > pPinDelays[pPinPerm[best_i]] )
65 pPinPerm[i] = pPinPerm[best_i];
66 pPinPerm[best_i] = temp;
95 char * pPerm = If_CutPerm( pCut );
97 float Delay, DelayCur;
99 int i, Shift, Pin2PinDelay;
105 DelayCur = If_ObjCutBest(pLeaf)->Delay +
p->pPars->nAndDelay;
106 Delay =
IF_MAX( Delay, DelayCur );
109 else if (
p->pPars->pLutLib )
111 assert( !
p->pPars->fLiftLeaves );
112 pLutDelays =
p->pPars->pLutLib->pLutDelays[pCut->
nLeaves];
113 if (
p->pPars->pLutLib->fVarPinDelays )
117 for ( i = 0; i < (int)pCut->
nLeaves; i++ )
119 DelayCur = pPinDelays[pPinPerm[i]] + pLutDelays[i];
120 Delay =
IF_MAX( Delay, DelayCur );
127 DelayCur = If_ObjCutBest(pLeaf)->Delay + pLutDelays[0];
128 Delay =
IF_MAX( Delay, DelayCur );
136 assert( !
p->pPars->fLiftLeaves );
140 DelayCur = If_ObjCutBest(pLeaf)->Delay + (float)Pin2PinDelay;
141 Delay =
IF_MAX( Delay, DelayCur );
146 if (
p->pPars->fLiftLeaves )
150 DelayCur = If_ObjCutBest(pLeaf)->Delay - Shift *
p->Period;
151 Delay =
IF_MAX( Delay, DelayCur + 1.0 );
158 DelayCur = If_ObjCutBest(pLeaf)->Delay + 1.0;
159 Delay =
IF_MAX( Delay, DelayCur );
186 assert( !
p->pPars->fLiftLeaves );
193 else if (
p->pPars->pLutLib )
195 pLutDelays =
p->pPars->pLutLib->pLutDelays[pCut->
nLeaves];
196 if (
p->pPars->pLutLib->fVarPinDelays )
200 for ( i = 0; i < (int)pCut->
nLeaves; i++ )
202 Required = ObjRequired - pLutDelays[i];
203 pLeaf = If_ManObj(
p, pCut->
pLeaves[pPinPerm[i]] );
209 Required = ObjRequired;
214 else if (
p->pPars->fUserLutDec ||
p->pPars->fUserLut2D )
216 Required = ObjRequired;
225 if (
p->pPars->fDelayOpt )
230 else if (
p->pPars->fDelayOptLut )
235 else if (
p->pPars->fDsdBalance )
241 pPerm = If_CutPerm(pCut);
245 Required = ObjRequired - (float)Pin2PinDelay;
251 Required = ObjRequired;
274 if (
p->pPars->fLatchPaths && (
p->pPars->nLatchesCi == 0 ||
p->pPars->nLatchesCo == 0) )
276 Abc_Print( 0,
"Delay optimization of latch path is not performed because there is no latches.\n" );
277 p->pPars->fLatchPaths = 0;
282 assert(
p->pPars->nLatchesCi > 0 );
284 if ( DelayBest < If_ObjArrTime(If_ObjFanin0(pObj)) )
285 DelayBest = If_ObjArrTime(If_ObjFanin0(pObj));
287 else if (
p->pPars->fLatchPaths )
290 if ( DelayBest < If_ObjArrTime(If_ObjFanin0(pObj)) )
291 DelayBest = If_ObjArrTime(If_ObjFanin0(pObj));
296 if ( DelayBest < If_ObjArrTime(If_ObjFanin0(pObj)) )
297 DelayBest = If_ObjArrTime(If_ObjFanin0(pObj));
322 if (
p->pManTim == NULL )
328 if (
p->pPars->pTimesReq && !
p->pPars->fAreaOnly )
334 if ( If_ObjArrTime(If_ObjFanin0(pObj)) >
p->pPars->pTimesReq[i] +
p->fEpsilon )
336 If_ObjFanin0(pObj)->Required = If_ObjArrTime(If_ObjFanin0(pObj));
342 If_ObjFanin0(pObj)->Required =
p->pPars->pTimesReq[i];
344 if ( Counter && !
p->fReqTimeWarn )
346 Abc_Print( 0,
"Required times are exceeded at %d output%s. The earliest arrival times are used.\n", Counter, Counter > 1 ?
"s":
"" );
353 if (
p->pPars->nRelaxRatio &&
p->pPars->DelayTargetNew == 0 )
354 p->pPars->DelayTargetNew =
p->RequiredGlo * (100.0 +
p->pPars->nRelaxRatio) / 100.0;
357 if (
p->pPars->DelayTarget != -1 )
359 if (
p->RequiredGlo >
p->pPars->DelayTarget +
p->fEpsilon )
361 if (
p->fNextRound == 0 )
364 Abc_Print( 0,
"Cannot meet the target required times (%4.2f). Mapping continues anyway.\n",
p->pPars->DelayTarget );
367 else if (
p->RequiredGlo <
p->pPars->DelayTarget -
p->fEpsilon )
369 if (
p->fNextRound == 0 )
374 p->RequiredGlo =
p->pPars->DelayTarget;
377 else if (
p->pPars->DelayTargetNew > 0 )
378 p->RequiredGlo =
p->pPars->DelayTargetNew;
380 if (
p->pPars->fAreaOnly )
383 if (
p->pPars->fDoAverage )
385 if (
p->pPars->nRelaxRatio )
388 If_ObjFanin0(pObj)->Required = If_ObjArrTime(If_ObjFanin0(pObj)) * (100.0 +
p->pPars->nRelaxRatio) / 100.0;
393 If_ObjFanin0(pObj)->Required = If_ObjArrTime(If_ObjFanin0(pObj));
396 else if (
p->pPars->fLatchPaths )
399 If_ObjFanin0(pObj)->Required =
p->RequiredGlo;
404 If_ObjFanin0(pObj)->Required =
p->RequiredGlo;
412 if ( pObj->
nRefs == 0 )
423 if (
p->pPars->nRelaxRatio &&
p->pPars->DelayTargetNew == 0 )
424 p->pPars->DelayTargetNew =
p->RequiredGlo * (100.0 +
p->pPars->nRelaxRatio) / 100.0;
427 if (
p->pPars->DelayTarget != -1 )
429 if (
p->RequiredGlo >
p->pPars->DelayTarget +
p->fEpsilon )
431 if (
p->fNextRound == 0 )
434 Abc_Print( 0,
"Cannot meet the target required times (%4.2f). Mapping continues anyway.\n",
p->pPars->DelayTarget );
437 else if (
p->RequiredGlo <
p->pPars->DelayTarget -
p->fEpsilon )
439 if (
p->fNextRound == 0 )
444 p->RequiredGlo =
p->pPars->DelayTarget;
447 else if (
p->pPars->DelayTargetNew > 0 )
448 p->RequiredGlo =
p->pPars->DelayTargetNew;
451 if (
p->pPars->fAreaOnly )
457 assert( If_ManCoNum(
p) == Vec_IntSize(
p->vCoAttrs) );
460 if ( Vec_IntEntry(
p->vCoAttrs, i) == -1 )
462 if ( Vec_IntEntry(
p->vCoAttrs, i) == 0 )
464 else if ( Vec_IntEntry(
p->vCoAttrs, i) == 1 )
466 else if ( Vec_IntEntry(
p->vCoAttrs, i) == 2 )
471 else if (
p->pPars->fDoAverage )
473 if (
p->pPars->nRelaxRatio )
476 Tim_ManSetCoRequired(
p->pManTim, i, If_ObjArrTime(If_ObjFanin0(pObj)) * (100.0 +
p->pPars->nRelaxRatio) / 100.0 );
484 else if (
p->pPars->fLatchPaths )
500 if ( If_ObjIsAnd(pObj) )
502 if ( pObj->
nRefs == 0 )
506 else if ( If_ObjIsCi(pObj) )
511 else if ( If_ObjIsCo(pObj) )
514 If_ObjFanin0(pObj)->Required =
IF_MIN( reqTime, If_ObjFanin0(pObj)->Required );
516 else if ( If_ObjIsConst1(pObj) )
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
float If_CutDelay(If_Man_t *p, If_Obj_t *pObj, If_Cut_t *pCut)
ABC_NAMESPACE_IMPL_START void If_CutSortInputPins(If_Man_t *p, If_Cut_t *pCut, int *pPinPerm, float *pPinDelays)
DECLARATIONS ///.
float If_ManDelayMax(If_Man_t *p, int fSeq)
void If_ManComputeRequired(If_Man_t *p)
void If_CutPropagateRequired(If_Man_t *p, If_Obj_t *pObj, If_Cut_t *pCut, float ObjRequired)
float If_LutDecPinRequired(If_Man_t *p, If_Cut_t *pCut, int i, float required)
int If_CutLutBalancePinDelays(If_Man_t *p, If_Cut_t *pCut, char *pPerm)
#define IF_MIN(a, b)
MACRO DEFINITIONS ///.
struct If_Cut_t_ If_Cut_t
#define If_ManForEachCo(p, pObj, i)
void If_ManMarkMapping(If_Man_t *p)
#define IF_MAX_LUTSIZE
INCLUDES ///.
#define If_ManForEachObjReverse(p, pObj, i)
#define If_CutForEachLeaf(p, pCut, pLeaf, i)
#define If_CutForEachLeafSeq(p, pCut, pLeaf, Shift, i)
#define IF_MAX_FUNC_LUTSIZE
#define If_ManForEachLatchInput(p, pObj, i)
struct If_Man_t_ If_Man_t
BASIC TYPES ///.
#define If_ManForEachPo(p, pObj, i)
int If_CutSopBalancePinDelays(If_Man_t *p, If_Cut_t *pCut, char *pPerm)
struct If_Obj_t_ If_Obj_t
int If_CutDsdBalancePinDelays(If_Man_t *p, If_Cut_t *pCut, char *pPerm)
void Tim_ManIncrementTravId(Tim_Man_t *p)
DECLARATIONS ///.
void Tim_ManSetCiRequired(Tim_Man_t *p, int iCi, float Delay)
void Tim_ManInitPoRequiredAll(Tim_Man_t *p, float Delay)
void Tim_ManSetCoRequired(Tim_Man_t *p, int iCo, float Delay)
float Tim_ManGetCoRequired(Tim_Man_t *p, int iCo)