Merge pull request #232 from phsauter/fix-retime-segfault

fix Segfault in retime command
This commit is contained in:
alanminko 2023-09-05 14:09:13 +07:00 committed by GitHub
commit 1f0c51533f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 2 deletions

View File

@ -140,6 +140,9 @@ void Abc_SclTimeNtkPrint( SC_Man * p, int fShowAll, int fPrintPath )
Abc_Obj_t * pObj, * pPivot = Abc_SclFindCriticalCo( p, &fRise );
float maxDelay = Abc_SclObjTimeOne( p, pPivot, fRise );
p->ReportDelay = maxDelay;
// used for Floyds cycle detection algorithm
unsigned int tortoiseIndex = 0;
int tortoiseStep = 0;
#ifdef WIN32
printf( "WireLoad = \"%s\" ", p->pWLoadUsed ? p->pWLoadUsed->pName : "none" );
@ -197,7 +200,7 @@ void Abc_SclTimeNtkPrint( SC_Man * p, int fShowAll, int fPrintPath )
while ( pObj && Abc_ObjIsNode(pObj) )
{
i++;
nLength = Abc_MaxInt( nLength, Abc_SclObjCell(pObj) ? strlen(Abc_SclObjCell(pObj)->pName) : 2 /* strlen("pi") */ );
nLength = Abc_MaxInt( nLength, strlen(Abc_SclObjCell(pObj)->pName) );
pObj = Abc_SclFindMostCriticalFanin( p, &fRise, pObj );
}
@ -221,10 +224,18 @@ void Abc_SclTimeNtkPrint( SC_Man * p, int fShowAll, int fPrintPath )
Vec_PtrPush( vPath, pPivot );
pObj = Abc_ObjFanin0(pPivot);
while ( pObj )//&& Abc_ObjIsNode(pObj) )
{
{
Vec_PtrPush( vPath, pObj );
pPrev = pObj;
pObj = Abc_SclFindMostCriticalFanin( p, &fRise, pObj );
// move the tortoise at half the speed (trailing)
tortoiseStep = (tortoiseStep + 1) % 2;
tortoiseIndex += tortoiseStep;
// if they see the same element, we are in a loop
if(vPath->pArray[tortoiseIndex] == pObj) {
break;
}
}
Vec_PtrForEachEntryReverse( Abc_Obj_t *, vPath, pObj, i )
{
@ -913,3 +924,4 @@ void Abc_SclPrintBuffers( SC_Lib * pLib, Abc_Ntk_t * pNtk, int fVerbose )
ABC_NAMESPACE_IMPL_END