Skip to content

Commit 8a856ce

Browse files
authored
Merge pull request #480 from jon-greene/fix-tim-man-get-co-required
Fix backward required-time propagation through boxes
2 parents c7ea67b + 71c24a4 commit 8a856ce

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

src/aig/gia/giaSpeedup.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,32 @@ float Gia_ManDelayTraceLut( Gia_Man_t * p )
333333
Gia_ObjSetTimeArrival( p, i, tArrival );
334334
}
335335

336+
// update levels of box output CIs to reflect box structure
337+
// (Gia_ManLevelNum assigns level 0 to all CIs, but box output CIs
338+
// need higher levels so that Gia_ManOrderReverse processes them
339+
// before box input COs during the backward required-time pass)
340+
if ( p->pManTime )
341+
{
342+
Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime;
343+
int iBox, nBoxes = Tim_ManBoxNum( pManTime );
344+
for ( iBox = 0; iBox < nBoxes; iBox++ )
345+
{
346+
int nIns = Tim_ManBoxInputNum( pManTime, iBox );
347+
int nOuts = Tim_ManBoxOutputNum( pManTime, iBox );
348+
int iCoFirst = Tim_ManBoxInputFirst( pManTime, iBox );
349+
int iCiFirst = Tim_ManBoxOutputFirst( pManTime, iBox );
350+
int j, maxLevel = 0;
351+
for ( j = 0; j < nIns; j++ )
352+
{
353+
int coLevel = Gia_ObjLevel( p, Gia_ManCo(p, iCoFirst + j) );
354+
if ( coLevel > maxLevel )
355+
maxLevel = coLevel;
356+
}
357+
for ( j = 0; j < nOuts; j++ )
358+
Gia_ObjSetLevel( p, Gia_ManCi(p, iCiFirst + j), maxLevel + 1 );
359+
}
360+
}
361+
336362
// get the latest arrival times
337363
tArrival = -TIM_ETERNITY;
338364
Gia_ManForEachCo( p, pObj, i )

src/misc/tim/timTime.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ float Tim_ManGetCoRequired( Tim_Man_t * p, int iCo )
249249
Tim_ManBoxForEachOutput( p, pBox, pObj, k )
250250
{
251251
pDelays = pTable + 3 + k * pBox->nInputs;
252-
if ( pDelays[k] != -ABC_INFINITY )
252+
if ( pDelays[i] != -ABC_INFINITY )
253253
DelayBest = Abc_MinFloat( DelayBest, pObj->timeReq - pDelays[i] );
254254
}
255255
pObjRes->timeReq = DelayBest;

0 commit comments

Comments
 (0)