Commit 8c1513df by Alan Mishchenko

Improving printouts of critical path.

parent 993c2027
...@@ -147,9 +147,8 @@ Abc_Ntk_t * Abc_NtkStartFrom( Abc_Ntk_t * pNtk, Abc_NtkType_t Type, Abc_NtkFunc_ ...@@ -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->vObjPerm = Vec_IntDup( pNtk->vObjPerm );
pNtkNew->AndGateDelay = pNtk->AndGateDelay; pNtkNew->AndGateDelay = pNtk->AndGateDelay;
// initialize logic level of the CIs // 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 ) Abc_NtkForEachCi( pNtk, pObj, i )
pObj->pCopy->Level = (int)(Abc_NodeReadArrivalAve(pObj) / pNtk->AndGateDelay); pObj->pCopy->Level = (int)(Abc_NodeReadArrivalAve(pObj) / pNtk->AndGateDelay);
} }
......
...@@ -849,10 +849,15 @@ void Abc_NtkPrintLevel( FILE * pFile, Abc_Ntk_t * pNtk, int fProfile, int fListN ...@@ -849,10 +849,15 @@ void Abc_NtkPrintLevel( FILE * pFile, Abc_Ntk_t * pNtk, int fProfile, int fListN
memset( pLevelCounts, 0, sizeof(int) * nIntervals ); memset( pLevelCounts, 0, sizeof(int) * nIntervals );
Abc_NtkForEachCo( pNtk, pNode, i ) Abc_NtkForEachCo( pNtk, pNode, i )
{ {
DelayCur = Abc_NodeReadArrival( Abc_ObjFanin0(pNode) )->Worst; if ( Abc_ObjIsNode(Abc_ObjFanin0(pNode)) && Abc_ObjFaninNum(Abc_ObjFanin0(pNode)) == 0 )
DelayInt = (int)(DelayCur / DelayDelta); DelayInt = 0;
if ( DelayInt >= nIntervals ) else
DelayInt = nIntervals - 1; {
DelayCur = Abc_NodeReadArrival( Abc_ObjFanin0(pNode) )->Worst;
DelayInt = (int)(DelayCur / DelayDelta);
if ( DelayInt >= nIntervals )
DelayInt = nIntervals - 1;
}
pLevelCounts[DelayInt]++; pLevelCounts[DelayInt]++;
} }
......
...@@ -881,38 +881,68 @@ float Abc_NtkDelayTrace( Abc_Ntk_t * pNtk, Abc_Obj_t * pOut, Abc_Obj_t * pIn, in ...@@ -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 // traverse to determine the critical path
Abc_NtkIncrementTravId( pNtk ); Abc_NtkIncrementTravId( pNtk );
if ( !Abc_NtkDelayTraceCritPath_rec( vSlacks, Abc_ObjFanin0(pOut), pIn, vBest ) ) 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 else
{ {
float Slack = 0.0;
int k, iFanin, Length = 0;
Abc_Obj_t * pFanin;
// collect the critical path // collect the critical path
Abc_NtkDelayTraceCritPathCollect_rec( vSlacks, Abc_ObjFanin0(pOut), vBest, vPath ); Abc_NtkDelayTraceCritPathCollect_rec( vSlacks, Abc_ObjFanin0(pOut), vBest, vPath );
if ( pIn == NULL ) if ( pIn == NULL )
pIn = (Abc_Obj_t *)Vec_PtrEntry( vPath, 0 ); 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 // print critical path
printf( "Critical path to PO \"%s\" from PI \"%s\":\n", Abc_ObjName(pOut), Abc_ObjName(pIn) ); printf( "Critical path from PI \"%s\" to PO \"%s\":\n", Abc_ObjName(pIn), Abc_ObjName(pOut) );
Vec_PtrForEachEntryReverse( Abc_Obj_t *, vPath, pNode, i ) Vec_PtrForEachEntry( Abc_Obj_t *, vPath, pNode, i )
{ {
printf( "Level %3d : ", Abc_ObjLevel(pNode) );
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( " " );
if ( Abc_ObjIsCi(pNode) ) if ( Abc_ObjIsCi(pNode) )
printf( "Primary input \"%s\".", Abc_ObjName(pNode) ); {
else if ( Abc_ObjIsCo(pNode) ) printf( "Primary input \"%s\". ", Abc_ObjName(pNode) );
printf( "Primary output \"%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 else
{ {
int iFanin;
assert( Abc_ObjIsNode(pNode) ); assert( Abc_ObjIsNode(pNode) );
iFanin = Abc_NodeFindFanin( pNode, (Abc_Obj_t *)Vec_PtrEntry(vPath,i-1) ); iFanin = Abc_NodeFindFanin( pNode, (Abc_Obj_t *)Vec_PtrEntry(vPath,i-1) );
printf( "Slack =%6.1f. ", Abc_NtkDelayTraceSlack(vSlacks, pNode, iFanin) ); Slack = Abc_NtkDelayTraceSlack(vSlacks, pNode, iFanin);
printf( "Mapping: Pin = %d. Gate = %s. ", iFanin, Mio_GateReadName(pNode->pData) ); 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( "\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_PtrFree( vPath );
Vec_IntFree( vBest ); Vec_IntFree( vBest );
......
...@@ -115,6 +115,7 @@ extern double Mio_GateReadDelayMax ( Mio_Gate_t * pGate ); ...@@ -115,6 +115,7 @@ extern double Mio_GateReadDelayMax ( Mio_Gate_t * pGate );
extern char * Mio_GateReadSop ( Mio_Gate_t * pGate ); extern char * Mio_GateReadSop ( Mio_Gate_t * pGate );
extern word Mio_GateReadTruth ( Mio_Gate_t * pGate ); extern word Mio_GateReadTruth ( Mio_Gate_t * pGate );
extern int Mio_GateReadValue ( 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 void Mio_GateSetValue ( Mio_Gate_t * pGate, int Value );
extern char * Mio_PinReadName ( Mio_Pin_t * pPin ); extern char * Mio_PinReadName ( Mio_Pin_t * pPin );
extern Mio_PinPhase_t Mio_PinReadPhase ( Mio_Pin_t * pPin ); extern Mio_PinPhase_t Mio_PinReadPhase ( Mio_Pin_t * pPin );
......
...@@ -173,6 +173,27 @@ double Mio_PinReadDelayFanoutFall( Mio_Pin_t * pPin ) { return p ...@@ -173,6 +173,27 @@ double Mio_PinReadDelayFanoutFall( Mio_Pin_t * pPin ) { return p
double Mio_PinReadDelayBlockMax ( Mio_Pin_t * pPin ) { return pPin->dDelayBlockMax; } double Mio_PinReadDelayBlockMax ( Mio_Pin_t * pPin ) { return pPin->dDelayBlockMax; }
Mio_Pin_t * Mio_PinReadNext ( Mio_Pin_t * pPin ) { return pPin->pNext; } 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 /// /// END OF FILE ///
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment