From 8c1513dfbcb5976ebc7ed37fa648fc8ac23417e8 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Fri, 6 Apr 2012 00:45:58 -0700 Subject: Improving printouts of critical path. --- src/base/abc/abcNtk.c | 3 +-- src/base/abci/abcPrint.c | 13 +++++++--- src/base/abci/abcTiming.c | 62 +++++++++++++++++++++++++++++++++++------------ src/map/mio/mio.h | 1 + src/map/mio/mioApi.c | 21 ++++++++++++++++ 5 files changed, 78 insertions(+), 22 deletions(-) diff --git a/src/base/abc/abcNtk.c b/src/base/abc/abcNtk.c index 071f69df..30eb0873 100644 --- a/src/base/abc/abcNtk.c +++ b/src/base/abc/abcNtk.c @@ -147,9 +147,8 @@ Abc_Ntk_t * Abc_NtkStartFrom( Abc_Ntk_t * pNtk, Abc_NtkType_t Type, Abc_NtkFunc_ pNtkNew->vObjPerm = Vec_IntDup( pNtk->vObjPerm ); pNtkNew->AndGateDelay = pNtk->AndGateDelay; // initialize logic level of the CIs - if ( pNtk->AndGateDelay != 0.0 && pNtk->ntkType != ABC_NTK_STRASH && Type == ABC_NTK_STRASH ) + if ( pNtk->AndGateDelay != 0.0 && pNtk->pManTime != NULL && pNtk->ntkType != ABC_NTK_STRASH && Type == ABC_NTK_STRASH ) { - assert( pNtk->pManTime != NULL ); // timing info should be available Abc_NtkForEachCi( pNtk, pObj, i ) pObj->pCopy->Level = (int)(Abc_NodeReadArrivalAve(pObj) / pNtk->AndGateDelay); } diff --git a/src/base/abci/abcPrint.c b/src/base/abci/abcPrint.c index e978aa71..664ddec1 100644 --- a/src/base/abci/abcPrint.c +++ b/src/base/abci/abcPrint.c @@ -849,10 +849,15 @@ void Abc_NtkPrintLevel( FILE * pFile, Abc_Ntk_t * pNtk, int fProfile, int fListN memset( pLevelCounts, 0, sizeof(int) * nIntervals ); Abc_NtkForEachCo( pNtk, pNode, i ) { - DelayCur = Abc_NodeReadArrival( Abc_ObjFanin0(pNode) )->Worst; - DelayInt = (int)(DelayCur / DelayDelta); - if ( DelayInt >= nIntervals ) - DelayInt = nIntervals - 1; + if ( Abc_ObjIsNode(Abc_ObjFanin0(pNode)) && Abc_ObjFaninNum(Abc_ObjFanin0(pNode)) == 0 ) + DelayInt = 0; + else + { + DelayCur = Abc_NodeReadArrival( Abc_ObjFanin0(pNode) )->Worst; + DelayInt = (int)(DelayCur / DelayDelta); + if ( DelayInt >= nIntervals ) + DelayInt = nIntervals - 1; + } pLevelCounts[DelayInt]++; } diff --git a/src/base/abci/abcTiming.c b/src/base/abci/abcTiming.c index 3f47b241..fe13b7ea 100644 --- a/src/base/abci/abcTiming.c +++ b/src/base/abci/abcTiming.c @@ -881,38 +881,68 @@ float Abc_NtkDelayTrace( Abc_Ntk_t * pNtk, Abc_Obj_t * pOut, Abc_Obj_t * pIn, in // traverse to determine the critical path Abc_NtkIncrementTravId( pNtk ); if ( !Abc_NtkDelayTraceCritPath_rec( vSlacks, Abc_ObjFanin0(pOut), pIn, vBest ) ) - printf( "There is no combinational path between PO \"%s\" and PI \"%s\".\n", Abc_ObjName(pOut), Abc_ObjName(pIn) ); + { + if ( pIn == NULL ) + printf( "The logic cone of PO \"%s\" has no primary inputs.\n", Abc_ObjName(pOut) ); + else + printf( "There is no combinational path between PI \"%s\" and PO \"%s\".\n", Abc_ObjName(pIn), Abc_ObjName(pOut) ); + } else { + float Slack = 0.0; + int k, iFanin, Length = 0; + Abc_Obj_t * pFanin; // collect the critical path Abc_NtkDelayTraceCritPathCollect_rec( vSlacks, Abc_ObjFanin0(pOut), vBest, vPath ); if ( pIn == NULL ) pIn = (Abc_Obj_t *)Vec_PtrEntry( vPath, 0 ); + // find the longest gate name + Vec_PtrForEachEntry( Abc_Obj_t *, vPath, pNode, i ) + if ( Abc_ObjIsNode(pNode) ) + Length = Abc_MaxInt( Length, strlen(Mio_GateReadName((Mio_Gate_t *)pNode->pData)) ); // print critical path - printf( "Critical path to PO \"%s\" from PI \"%s\":\n", Abc_ObjName(pOut), Abc_ObjName(pIn) ); - Vec_PtrForEachEntryReverse( Abc_Obj_t *, vPath, pNode, i ) + printf( "Critical path from PI \"%s\" to PO \"%s\":\n", Abc_ObjName(pIn), Abc_ObjName(pOut) ); + Vec_PtrForEachEntry( Abc_Obj_t *, vPath, pNode, i ) { - - printf( "Obj =%7d. ", Abc_ObjId(pNode) ); - printf( "Lev =%4d. ", Abc_ObjLevel(pNode) ); - printf( " " ); - printf( "Rise =%6.1f. ", Abc_NodeReadArrival(pNode)->Rise ); - printf( "Fall =%6.1f. ", Abc_NodeReadArrival(pNode)->Fall ); - printf( " " ); + printf( "Level %3d : ", Abc_ObjLevel(pNode) ); if ( Abc_ObjIsCi(pNode) ) - printf( "Primary input \"%s\".", Abc_ObjName(pNode) ); - else if ( Abc_ObjIsCo(pNode) ) - printf( "Primary output \"%s\".", Abc_ObjName(pNode) ); + { + printf( "Primary input \"%s\". ", Abc_ObjName(pNode) ); + printf( "Arrival time =%6.1f. ", Abc_NodeReadArrival(pNode)->Worst ); + printf( "\n" ); + continue; + } + if ( Abc_ObjIsCo(pNode) ) + { + printf( "Primary output \"%s\". ", Abc_ObjName(pNode) ); + printf( "Arrival =%6.1f. ", Abc_NodeReadArrival(pNode)->Worst ); + } else { - int iFanin; assert( Abc_ObjIsNode(pNode) ); iFanin = Abc_NodeFindFanin( pNode, (Abc_Obj_t *)Vec_PtrEntry(vPath,i-1) ); - printf( "Slack =%6.1f. ", Abc_NtkDelayTraceSlack(vSlacks, pNode, iFanin) ); - printf( "Mapping: Pin = %d. Gate = %s. ", iFanin, Mio_GateReadName(pNode->pData) ); + Slack = Abc_NtkDelayTraceSlack(vSlacks, pNode, iFanin); + printf( "%10s/", Abc_ObjName(pNode) ); + printf( "%-4s", Mio_GateReadPinName((Mio_Gate_t *)pNode->pData, iFanin) ); + printf( " (%s)", Mio_GateReadName((Mio_Gate_t *)pNode->pData) ); + for ( k = strlen(Mio_GateReadName((Mio_Gate_t *)pNode->pData)); k < Length; k++ ) + printf( " " ); + printf( " " ); + printf( "Arrival =%6.1f. ", Abc_NodeReadArrival(pNode)->Worst ); + printf( "I/O time: (" ); + Abc_ObjForEachFanin( pNode, pFanin, k ) + printf( "%s%.1f", (k? ", ":""), Abc_NodeReadArrival(pFanin)->Worst ); + if ( Abc_NodeReadRequired(pNode)->Worst == -ABC_INFINITY ) + printf( " -> ?)" ); + else + printf( " -> %.1f)", Abc_NodeReadRequired(pNode)->Worst ); } printf( "\n" ); } + printf( "Level %3d : ", Abc_ObjLevel(Abc_ObjFanin0(pOut)) + 1 ); + printf( "Primary output \"%s\". ", Abc_ObjName(pOut) ); + printf( "Required time = %6.1f. ", Abc_NodeRequired(pOut)->Worst ); + printf( "Path slack = %6.1f.\n", Slack ); } Vec_PtrFree( vPath ); Vec_IntFree( vBest ); diff --git a/src/map/mio/mio.h b/src/map/mio/mio.h index 005d2acc..0aba261a 100644 --- a/src/map/mio/mio.h +++ b/src/map/mio/mio.h @@ -115,6 +115,7 @@ extern double Mio_GateReadDelayMax ( Mio_Gate_t * pGate ); extern char * Mio_GateReadSop ( Mio_Gate_t * pGate ); extern word Mio_GateReadTruth ( Mio_Gate_t * pGate ); extern int Mio_GateReadValue ( Mio_Gate_t * pGate ); +extern char * Mio_GateReadPinName ( Mio_Gate_t * pGate, int iPin ); extern void Mio_GateSetValue ( Mio_Gate_t * pGate, int Value ); extern char * Mio_PinReadName ( Mio_Pin_t * pPin ); extern Mio_PinPhase_t Mio_PinReadPhase ( Mio_Pin_t * pPin ); diff --git a/src/map/mio/mioApi.c b/src/map/mio/mioApi.c index 927a01ea..d2357e7d 100644 --- a/src/map/mio/mioApi.c +++ b/src/map/mio/mioApi.c @@ -173,6 +173,27 @@ double Mio_PinReadDelayFanoutFall( Mio_Pin_t * pPin ) { return p double Mio_PinReadDelayBlockMax ( Mio_Pin_t * pPin ) { return pPin->dDelayBlockMax; } Mio_Pin_t * Mio_PinReadNext ( Mio_Pin_t * pPin ) { return pPin->pNext; } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +char * Mio_GateReadPinName( Mio_Gate_t * pGate, int iPin ) +{ + Mio_Pin_t * pPin; + int i = 0; + Mio_GateForEachPin( pGate, pPin ) + if ( i++ == iPin ) + return Mio_PinReadName(pPin); + return NULL; +} + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// -- cgit v1.2.3