Merge pull request #480 from jon-greene/fix-tim-man-get-co-required

Fix backward required-time propagation through boxes
This commit is contained in:
alanminko 2026-02-19 17:20:22 -08:00 committed by GitHub
commit 8a856ce23f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 1 deletions

View File

@ -333,6 +333,32 @@ float Gia_ManDelayTraceLut( Gia_Man_t * p )
Gia_ObjSetTimeArrival( p, i, tArrival );
}
// update levels of box output CIs to reflect box structure
// (Gia_ManLevelNum assigns level 0 to all CIs, but box output CIs
// need higher levels so that Gia_ManOrderReverse processes them
// before box input COs during the backward required-time pass)
if ( p->pManTime )
{
Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime;
int iBox, nBoxes = Tim_ManBoxNum( pManTime );
for ( iBox = 0; iBox < nBoxes; iBox++ )
{
int nIns = Tim_ManBoxInputNum( pManTime, iBox );
int nOuts = Tim_ManBoxOutputNum( pManTime, iBox );
int iCoFirst = Tim_ManBoxInputFirst( pManTime, iBox );
int iCiFirst = Tim_ManBoxOutputFirst( pManTime, iBox );
int j, maxLevel = 0;
for ( j = 0; j < nIns; j++ )
{
int coLevel = Gia_ObjLevel( p, Gia_ManCo(p, iCoFirst + j) );
if ( coLevel > maxLevel )
maxLevel = coLevel;
}
for ( j = 0; j < nOuts; j++ )
Gia_ObjSetLevel( p, Gia_ManCi(p, iCiFirst + j), maxLevel + 1 );
}
}
// get the latest arrival times
tArrival = -TIM_ETERNITY;
Gia_ManForEachCo( p, pObj, i )

View File

@ -249,7 +249,7 @@ float Tim_ManGetCoRequired( Tim_Man_t * p, int iCo )
Tim_ManBoxForEachOutput( p, pBox, pObj, k )
{
pDelays = pTable + 3 + k * pBox->nInputs;
if ( pDelays[k] != -ABC_INFINITY )
if ( pDelays[i] != -ABC_INFINITY )
DelayBest = Abc_MinFloat( DelayBest, pObj->timeReq - pDelays[i] );
}
pObjRes->timeReq = DelayBest;