ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
abcTiming.c File Reference
#include <math.h>
#include "base/abc/abc.h"
#include "base/main/main.h"
#include "map/mio/mio.h"
Include dependency graph for abcTiming.c:

Go to the source code of this file.

Classes

struct  Abc_ManTime_t_
 DECLARATIONS ///. More...
 

Macros

#define TOLERANCE   0.001
 

Functions

Abc_Time_tAbc_NtkReadDefaultArrival (Abc_Ntk_t *pNtk)
 FUNCTION DEFINITIONS ///.
 
Abc_Time_tAbc_NtkReadDefaultRequired (Abc_Ntk_t *pNtk)
 
Abc_Time_tAbc_NodeReadArrival (Abc_Obj_t *pNode)
 
Abc_Time_tAbc_NodeReadRequired (Abc_Obj_t *pNode)
 
float Abc_NtkReadDefaultArrivalWorst (Abc_Ntk_t *pNtk)
 
float Abc_NtkReadDefaultRequiredWorst (Abc_Ntk_t *pNtk)
 
float Abc_NodeReadArrivalAve (Abc_Obj_t *pNode)
 
float Abc_NodeReadRequiredAve (Abc_Obj_t *pNode)
 
float Abc_NodeReadArrivalWorst (Abc_Obj_t *pNode)
 
float Abc_NodeReadRequiredWorst (Abc_Obj_t *pNode)
 
Abc_Time_tAbc_NtkReadDefaultInputDrive (Abc_Ntk_t *pNtk)
 
Abc_Time_tAbc_NtkReadDefaultOutputLoad (Abc_Ntk_t *pNtk)
 
Abc_Time_tAbc_NodeReadInputDrive (Abc_Ntk_t *pNtk, int iPi)
 
Abc_Time_tAbc_NodeReadOutputLoad (Abc_Ntk_t *pNtk, int iPo)
 
float Abc_NodeReadInputDriveWorst (Abc_Ntk_t *pNtk, int iPi)
 
float Abc_NodeReadOutputLoadWorst (Abc_Ntk_t *pNtk, int iPo)
 
void Abc_NtkTimeSetDefaultArrival (Abc_Ntk_t *pNtk, float Rise, float Fall)
 
void Abc_NtkTimeSetDefaultRequired (Abc_Ntk_t *pNtk, float Rise, float Fall)
 
void Abc_NtkTimeSetArrival (Abc_Ntk_t *pNtk, int ObjId, float Rise, float Fall)
 
void Abc_NtkTimeSetRequired (Abc_Ntk_t *pNtk, int ObjId, float Rise, float Fall)
 
void Abc_NtkTimeSetDefaultInputDrive (Abc_Ntk_t *pNtk, float Rise, float Fall)
 
void Abc_NtkTimeSetDefaultOutputLoad (Abc_Ntk_t *pNtk, float Rise, float Fall)
 
void Abc_NtkTimeSetInputDrive (Abc_Ntk_t *pNtk, int PiNum, float Rise, float Fall)
 
void Abc_NtkTimeSetOutputLoad (Abc_Ntk_t *pNtk, int PoNum, float Rise, float Fall)
 
void Abc_NtkTimeInitialize (Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkOld)
 
void Abc_NtkTimeScale (Abc_Ntk_t *pNtk, float Scale)
 
void Abc_NtkTimePrepare (Abc_Ntk_t *pNtk)
 
void Abc_ManTimeStop (Abc_ManTime_t *p)
 
void Abc_ManTimeDup (Abc_Ntk_t *pNtkOld, Abc_Ntk_t *pNtkNew)
 
void Abc_NtkTimePrint (Abc_Ntk_t *pNtk)
 
void Abc_NtkSetNodeLevelsArrival (Abc_Ntk_t *pNtkOld)
 
Abc_Time_tAbc_NtkGetCiArrivalTimes (Abc_Ntk_t *pNtk)
 
Abc_Time_tAbc_NtkGetCoRequiredTimes (Abc_Ntk_t *pNtk)
 
float * Abc_NtkGetCiArrivalFloats (Abc_Ntk_t *pNtk)
 
float * Abc_NtkGetCoRequiredFloats (Abc_Ntk_t *pNtk)
 
Vec_Int_tAbc_NtkDelayTraceSlackStart (Abc_Ntk_t *pNtk)
 
int Abc_NtkDelayTraceCritPath_rec (Vec_Int_t *vSlacks, Abc_Obj_t *pNode, Abc_Obj_t *pLeaf, Vec_Int_t *vBest)
 
void Abc_NtkDelayTraceCritPathCollect_rec (Vec_Int_t *vSlacks, Abc_Obj_t *pNode, Vec_Int_t *vBest, Vec_Ptr_t *vPath)
 
void Abc_NodeDelayTraceArrival (Abc_Obj_t *pNode, Vec_Int_t *vSlacks)
 
float Abc_NtkDelayTrace (Abc_Ntk_t *pNtk, Abc_Obj_t *pOut, Abc_Obj_t *pIn, int fPrint)
 
int Abc_ObjLevelNew (Abc_Obj_t *pObj)
 
int Abc_ObjReverseLevelNew (Abc_Obj_t *pObj)
 
int Abc_ObjRequiredLevel (Abc_Obj_t *pObj)
 
int Abc_ObjReverseLevel (Abc_Obj_t *pObj)
 
void Abc_ObjSetReverseLevel (Abc_Obj_t *pObj, int LevelR)
 
void Abc_NtkStartReverseLevels (Abc_Ntk_t *pNtk, int nMaxLevelIncrease)
 
void Abc_NtkStopReverseLevels (Abc_Ntk_t *pNtk)
 
void Abc_NtkUpdateLevel (Abc_Obj_t *pObjNew, Vec_Vec_t *vLevels)
 
void Abc_NtkUpdateReverseLevel (Abc_Obj_t *pObjNew, Vec_Vec_t *vLevels)
 
void Abc_NtkUpdate (Abc_Obj_t *pObj, Abc_Obj_t *pObjNew, Vec_Vec_t *vLevels)
 

Macro Definition Documentation

◆ TOLERANCE

#define TOLERANCE   0.001

Definition at line 48 of file abcTiming.c.

Function Documentation

◆ Abc_ManTimeDup()

void Abc_ManTimeDup ( Abc_Ntk_t * pNtkOld,
Abc_Ntk_t * pNtkNew )

Function*************************************************************

Synopsis [Duplicates the timing manager with the PI/PO timing info.]

Description [The PIs/POs of the new network should be allocated.]

SideEffects []

SeeAlso []

Definition at line 573 of file abcTiming.c.

574{
575 extern void Abc_NtkTimePrint( Abc_Ntk_t * pNtk );
576
577 Abc_Obj_t * pObj;
578 Abc_Time_t ** ppTimesOld, ** ppTimesNew;
579 int i;
580 if ( pNtkOld->pManTime == NULL )
581 return;
582 assert( Abc_NtkCiNum(pNtkOld) == Abc_NtkCiNum(pNtkNew) );
583 assert( Abc_NtkCoNum(pNtkOld) == Abc_NtkCoNum(pNtkNew) );
584 assert( Abc_NtkLatchNum(pNtkOld) == Abc_NtkLatchNum(pNtkNew) );
585 // create the new timing manager
586 pNtkNew->pManTime = Abc_ManTimeStart(pNtkNew);
587 Abc_ManTimeExpand( pNtkNew->pManTime, Abc_NtkObjNumMax(pNtkNew), 0 );
588 // set the default timing
589 pNtkNew->pManTime->tArrDef = pNtkOld->pManTime->tArrDef;
590 pNtkNew->pManTime->tReqDef = pNtkOld->pManTime->tReqDef;
591 // set the CI timing
592 ppTimesOld = (Abc_Time_t **)pNtkOld->pManTime->vArrs->pArray;
593 ppTimesNew = (Abc_Time_t **)pNtkNew->pManTime->vArrs->pArray;
594 Abc_NtkForEachCi( pNtkOld, pObj, i )
595 *ppTimesNew[ Abc_NtkCi(pNtkNew,i)->Id ] = *ppTimesOld[ pObj->Id ];
596 // set the CO timing
597 ppTimesOld = (Abc_Time_t **)pNtkOld->pManTime->vReqs->pArray;
598 ppTimesNew = (Abc_Time_t **)pNtkNew->pManTime->vReqs->pArray;
599 Abc_NtkForEachCo( pNtkOld, pObj, i )
600 *ppTimesNew[ Abc_NtkCo(pNtkNew,i)->Id ] = *ppTimesOld[ pObj->Id ];
601 // duplicate input drive
602 pNtkNew->pManTime->tInDriveDef = pNtkOld->pManTime->tInDriveDef;
603 pNtkNew->pManTime->tOutLoadDef = pNtkOld->pManTime->tOutLoadDef;
604 if ( pNtkOld->pManTime->tInDrive )
605 {
606 pNtkNew->pManTime->tInDrive = ABC_ALLOC( Abc_Time_t, Abc_NtkCiNum(pNtkOld) );
607 memcpy( pNtkNew->pManTime->tInDrive, pNtkOld->pManTime->tInDrive, sizeof(Abc_Time_t) * Abc_NtkCiNum(pNtkOld) );
608 }
609 if ( pNtkOld->pManTime->tOutLoad )
610 {
611 pNtkNew->pManTime->tOutLoad = ABC_ALLOC( Abc_Time_t, Abc_NtkCoNum(pNtkOld) );
612 memcpy( pNtkNew->pManTime->tOutLoad, pNtkOld->pManTime->tOutLoad, sizeof(Abc_Time_t) * Abc_NtkCoNum(pNtkOld) );
613 }
614
615
616}
void Abc_NtkTimePrint(Abc_Ntk_t *pNtk)
Definition abcTiming.c:629
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition abc.h:522
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
struct Abc_Time_t_ Abc_Time_t
Definition abc.h:120
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
Vec_Ptr_t * vArrs
Definition abcTiming.c:40
Abc_Time_t * tOutLoad
Definition abcTiming.c:45
Abc_Time_t * tInDrive
Definition abcTiming.c:44
Abc_Time_t tReqDef
Definition abcTiming.c:39
Abc_Time_t tArrDef
Definition abcTiming.c:38
Abc_Time_t tInDriveDef
Definition abcTiming.c:42
Abc_Time_t tOutLoadDef
Definition abcTiming.c:43
Vec_Ptr_t * vReqs
Definition abcTiming.c:41
Abc_ManTime_t * pManTime
Definition abc.h:192
int Id
Definition abc.h:132
#define assert(ex)
Definition util_old.h:213
char * memcpy()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_ManTimeStop()

void Abc_ManTimeStop ( Abc_ManTime_t * p)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 547 of file abcTiming.c.

548{
549 if ( p->tInDrive )
550 ABC_FREE( p->tInDrive );
551 if ( p->tOutLoad )
552 ABC_FREE( p->tOutLoad );
553 if ( Vec_PtrSize(p->vArrs) > 0 )
554 ABC_FREE( p->vArrs->pArray[0] );
555 Vec_PtrFree( p->vArrs );
556 if ( Vec_PtrSize(p->vReqs) > 0 )
557 ABC_FREE( p->vReqs->pArray[0] );
558 Vec_PtrFree( p->vReqs );
559 ABC_FREE( p );
560}
#define ABC_FREE(obj)
Definition abc_global.h:267
Cube * p
Definition exorList.c:222
Here is the caller graph for this function:

◆ Abc_NodeDelayTraceArrival()

void Abc_NodeDelayTraceArrival ( Abc_Obj_t * pNode,
Vec_Int_t * vSlacks )

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 939 of file abcTiming.c.

940{
941 Abc_Obj_t * pFanin;
942 Abc_Time_t * pTimeIn, * pTimeOut;
943 float tDelayBlockRise, tDelayBlockFall;
944 Mio_PinPhase_t PinPhase;
945 Mio_Pin_t * pPin;
946 int i;
947
948 // start the arrival time of the node
949 pTimeOut = Abc_NodeArrival(pNode);
950 pTimeOut->Rise = pTimeOut->Fall = -ABC_INFINITY;
951 // consider the buffer
952 if ( Abc_ObjIsBarBuf(pNode) )
953 {
954 pTimeIn = Abc_NodeArrival(Abc_ObjFanin0(pNode));
955 *pTimeOut = *pTimeIn;
956 return;
957 }
958 // go through the pins of the gate
959 pPin = Mio_GateReadPins((Mio_Gate_t *)pNode->pData);
960 Abc_ObjForEachFanin( pNode, pFanin, i )
961 {
962 pTimeIn = Abc_NodeArrival(pFanin);
963 // get the interesting parameters of this pin
964 PinPhase = Mio_PinReadPhase(pPin);
965 tDelayBlockRise = (float)Mio_PinReadDelayBlockRise( pPin );
966 tDelayBlockFall = (float)Mio_PinReadDelayBlockFall( pPin );
967 // compute the arrival times of the positive phase
968 if ( PinPhase != MIO_PHASE_INV ) // NONINV phase is present
969 {
970 if ( pTimeOut->Rise < pTimeIn->Rise + tDelayBlockRise )
971 pTimeOut->Rise = pTimeIn->Rise + tDelayBlockRise;
972 if ( pTimeOut->Fall < pTimeIn->Fall + tDelayBlockFall )
973 pTimeOut->Fall = pTimeIn->Fall + tDelayBlockFall;
974 }
975 if ( PinPhase != MIO_PHASE_NONINV ) // INV phase is present
976 {
977 if ( pTimeOut->Rise < pTimeIn->Fall + tDelayBlockRise )
978 pTimeOut->Rise = pTimeIn->Fall + tDelayBlockRise;
979 if ( pTimeOut->Fall < pTimeIn->Rise + tDelayBlockFall )
980 pTimeOut->Fall = pTimeIn->Rise + tDelayBlockFall;
981 }
982 pPin = Mio_PinReadNext(pPin);
983 }
984
985 // compute edge slacks
986 if ( vSlacks )
987 {
988 float Slack;
989 // go through the pins of the gate
990 pPin = Mio_GateReadPins((Mio_Gate_t *)pNode->pData);
991 Abc_ObjForEachFanin( pNode, pFanin, i )
992 {
993 pTimeIn = Abc_NodeArrival(pFanin);
994 // get the interesting parameters of this pin
995 PinPhase = Mio_PinReadPhase(pPin);
996 tDelayBlockRise = (float)Mio_PinReadDelayBlockRise( pPin );
997 tDelayBlockFall = (float)Mio_PinReadDelayBlockFall( pPin );
998 // compute the arrival times of the positive phase
999 Slack = ABC_INFINITY;
1000 if ( PinPhase != MIO_PHASE_INV ) // NONINV phase is present
1001 {
1002 Slack = Abc_MinFloat( Slack, Abc_AbsFloat(pTimeIn->Rise + tDelayBlockRise - pTimeOut->Rise) );
1003 Slack = Abc_MinFloat( Slack, Abc_AbsFloat(pTimeIn->Fall + tDelayBlockFall - pTimeOut->Fall) );
1004 }
1005 if ( PinPhase != MIO_PHASE_NONINV ) // INV phase is present
1006 {
1007 Slack = Abc_MinFloat( Slack, Abc_AbsFloat(pTimeIn->Fall + tDelayBlockRise - pTimeOut->Rise) );
1008 Slack = Abc_MinFloat( Slack, Abc_AbsFloat(pTimeIn->Rise + tDelayBlockFall - pTimeOut->Fall) );
1009 }
1010 pPin = Mio_PinReadNext(pPin);
1011 Abc_NtkDelayTraceSetSlack( vSlacks, pNode, i, Slack );
1012 }
1013 }
1014}
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition abc_global.h:250
Mio_Pin_t * Mio_GateReadPins(Mio_Gate_t *pGate)
Definition mioApi.c:173
double Mio_PinReadDelayBlockFall(Mio_Pin_t *pPin)
Definition mioApi.c:214
Mio_PinPhase_t
INCLUDES ///.
Definition mio.h:40
@ MIO_PHASE_INV
Definition mio.h:40
@ MIO_PHASE_NONINV
Definition mio.h:40
Mio_PinPhase_t Mio_PinReadPhase(Mio_Pin_t *pPin)
Definition mioApi.c:209
Mio_Pin_t * Mio_PinReadNext(Mio_Pin_t *pPin)
Definition mioApi.c:217
struct Mio_PinStruct_t_ Mio_Pin_t
Definition mio.h:44
double Mio_PinReadDelayBlockRise(Mio_Pin_t *pPin)
Definition mioApi.c:212
struct Mio_GateStruct_t_ Mio_Gate_t
Definition mio.h:43
void * pData
Definition abc.h:145
float Rise
Definition abc.h:124
float Fall
Definition abc.h:125
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NodeReadArrival()

Abc_Time_t * Abc_NodeReadArrival ( Abc_Obj_t * pNode)

Definition at line 85 of file abcTiming.c.

86{
87 assert( pNode->pNtk->pManTime );
88 return Abc_NodeArrival(pNode);
89}
Abc_Ntk_t * pNtk
Definition abc.h:130
Here is the caller graph for this function:

◆ Abc_NodeReadArrivalAve()

float Abc_NodeReadArrivalAve ( Abc_Obj_t * pNode)

Definition at line 103 of file abcTiming.c.

104{
105 return 0.5 * Abc_NodeArrival(pNode)->Rise + 0.5 * Abc_NodeArrival(pNode)->Fall;
106}

◆ Abc_NodeReadArrivalWorst()

float Abc_NodeReadArrivalWorst ( Abc_Obj_t * pNode)

Definition at line 111 of file abcTiming.c.

112{
113 return Abc_MaxFloat( Abc_NodeArrival(pNode)->Rise, Abc_NodeArrival(pNode)->Fall );
114}
Here is the caller graph for this function:

◆ Abc_NodeReadInputDrive()

Abc_Time_t * Abc_NodeReadInputDrive ( Abc_Ntk_t * pNtk,
int iPi )

Definition at line 141 of file abcTiming.c.

142{
143 assert( pNtk->pManTime );
144 return pNtk->pManTime->tInDrive ? pNtk->pManTime->tInDrive + iPi : NULL;
145}
Here is the caller graph for this function:

◆ Abc_NodeReadInputDriveWorst()

float Abc_NodeReadInputDriveWorst ( Abc_Ntk_t * pNtk,
int iPi )

Definition at line 151 of file abcTiming.c.

152{
153 return Abc_MaxFloat( Abc_NodeReadInputDrive(pNtk, iPi)->Rise, Abc_NodeReadInputDrive(pNtk, iPi)->Fall );
154}
Abc_Time_t * Abc_NodeReadInputDrive(Abc_Ntk_t *pNtk, int iPi)
Definition abcTiming.c:141
Here is the call graph for this function:

◆ Abc_NodeReadOutputLoad()

Abc_Time_t * Abc_NodeReadOutputLoad ( Abc_Ntk_t * pNtk,
int iPo )

Definition at line 146 of file abcTiming.c.

147{
148 assert( pNtk->pManTime );
149 return pNtk->pManTime->tOutLoad ? pNtk->pManTime->tOutLoad + iPo : NULL;
150}
Here is the caller graph for this function:

◆ Abc_NodeReadOutputLoadWorst()

float Abc_NodeReadOutputLoadWorst ( Abc_Ntk_t * pNtk,
int iPo )

Definition at line 155 of file abcTiming.c.

156{
157 return Abc_MaxFloat( Abc_NodeReadOutputLoad(pNtk, iPo)->Rise, Abc_NodeReadOutputLoad(pNtk, iPo)->Fall );
158}
Abc_Time_t * Abc_NodeReadOutputLoad(Abc_Ntk_t *pNtk, int iPo)
Definition abcTiming.c:146
Here is the call graph for this function:

◆ Abc_NodeReadRequired()

Abc_Time_t * Abc_NodeReadRequired ( Abc_Obj_t * pNode)

Definition at line 90 of file abcTiming.c.

91{
92 assert( pNode->pNtk->pManTime );
93 return Abc_NodeRequired(pNode);
94}
Here is the caller graph for this function:

◆ Abc_NodeReadRequiredAve()

float Abc_NodeReadRequiredAve ( Abc_Obj_t * pNode)

Definition at line 107 of file abcTiming.c.

108{
109 return 0.5 * Abc_NodeReadRequired(pNode)->Rise + 0.5 * Abc_NodeReadRequired(pNode)->Fall;
110}
Abc_Time_t * Abc_NodeReadRequired(Abc_Obj_t *pNode)
Definition abcTiming.c:90
Here is the call graph for this function:

◆ Abc_NodeReadRequiredWorst()

float Abc_NodeReadRequiredWorst ( Abc_Obj_t * pNode)

Definition at line 115 of file abcTiming.c.

116{
117 return Abc_MinFloat( Abc_NodeReadRequired(pNode)->Rise, Abc_NodeReadRequired(pNode)->Fall );
118}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDelayTrace()

float Abc_NtkDelayTrace ( Abc_Ntk_t * pNtk,
Abc_Obj_t * pOut,
Abc_Obj_t * pIn,
int fPrint )

Function*************************************************************

Synopsis [Performs delay-trace of the network. If input (pIn) or output (pOut) are given, finds the most-timing-critical path between them and prints it to the standard output. If input and/or output are not given, finds the most-critical path in the network and prints it.]

Description []

SideEffects []

SeeAlso []

Definition at line 1031 of file abcTiming.c.

1032{
1033 Vec_Int_t * vSlacks = NULL;
1034 Abc_Obj_t * pNode, * pDriver;
1035 Vec_Ptr_t * vNodes;
1036 Abc_Time_t * pTime;
1037 float tArrivalMax;
1038 int i;
1039
1040 assert( Abc_NtkIsMappedLogic(pNtk) );
1041 assert( pOut == NULL || Abc_ObjIsCo(pOut) );
1042 assert( pIn == NULL || Abc_ObjIsCi(pIn) );
1043
1044 // create slacks (need slacks if printing is requested even if pIn/pOut are not given)
1045 if ( pOut || pIn || fPrint )
1046 vSlacks = Abc_NtkDelayTraceSlackStart( pNtk );
1047
1048 // compute the timing
1049 Abc_NtkTimePrepare( pNtk );
1050 vNodes = Abc_NtkDfs( pNtk, 1 );
1051 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
1052 Abc_NodeDelayTraceArrival( pNode, vSlacks );
1053 Vec_PtrFree( vNodes );
1054
1055 // get the latest arrival times
1056 tArrivalMax = -ABC_INFINITY;
1057 Abc_NtkForEachCo( pNtk, pNode, i )
1058 {
1059 pDriver = Abc_ObjFanin0(pNode);
1060 pTime = Abc_NodeArrival(pDriver);
1061 if ( tArrivalMax < Abc_MaxFloat(pTime->Fall, pTime->Rise) )
1062 tArrivalMax = Abc_MaxFloat(pTime->Fall, pTime->Rise);
1063 }
1064
1065 // determine the output to print
1066 if ( fPrint && pOut == NULL )
1067 {
1068 Abc_NtkForEachCo( pNtk, pNode, i )
1069 {
1070 pDriver = Abc_ObjFanin0(pNode);
1071 pTime = Abc_NodeArrival(pDriver);
1072 if ( tArrivalMax == Abc_MaxFloat(pTime->Fall, pTime->Rise) )
1073 pOut = pNode;
1074 }
1075 assert( pOut != NULL );
1076 }
1077
1078 if ( fPrint )
1079 {
1080 Vec_Ptr_t * vPath = Vec_PtrAlloc( 100 );
1081 Vec_Int_t * vBest = Vec_IntStartFull( Abc_NtkObjNumMax(pNtk) );
1082 // traverse to determine the critical path
1083 Abc_NtkIncrementTravId( pNtk );
1084 if ( !Abc_NtkDelayTraceCritPath_rec( vSlacks, Abc_ObjFanin0(pOut), pIn, vBest ) )
1085 {
1086 if ( pIn == NULL )
1087 printf( "The logic cone of PO \"%s\" has no primary inputs.\n", Abc_ObjName(pOut) );
1088 else
1089 printf( "There is no combinational path between PI \"%s\" and PO \"%s\".\n", Abc_ObjName(pIn), Abc_ObjName(pOut) );
1090 }
1091 else
1092 {
1093 float Slack = 0.0, SlackAdd;
1094 int k, iFanin, Length = 0;
1095 Abc_Obj_t * pFanin;
1096 // check the additional slack
1097 SlackAdd = Abc_NodeReadRequiredWorst(pOut) - Abc_NodeReadArrivalWorst(Abc_ObjFanin0(pOut));
1098 // collect the critical path
1099 Abc_NtkDelayTraceCritPathCollect_rec( vSlacks, Abc_ObjFanin0(pOut), vBest, vPath );
1100 if ( pIn == NULL )
1101 pIn = (Abc_Obj_t *)Vec_PtrEntry( vPath, 0 );
1102 // find the longest gate name
1103 Vec_PtrForEachEntry( Abc_Obj_t *, vPath, pNode, i )
1104 if ( Abc_ObjIsNode(pNode) )
1105 Length = Abc_MaxInt( Length, strlen(Mio_GateReadName((Mio_Gate_t *)pNode->pData)) );
1106 // print critical path
1107 Abc_NtkLevel( pNtk );
1108 printf( "Critical path from PI \"%s\" to PO \"%s\":\n", Abc_ObjName(pIn), Abc_ObjName(pOut) );
1109 Vec_PtrForEachEntry( Abc_Obj_t *, vPath, pNode, i )
1110 {
1111 printf( "Level %3d : ", Abc_ObjLevel(pNode) );
1112 if ( Abc_ObjIsCi(pNode) )
1113 {
1114 printf( "Primary input \"%s\". ", Abc_ObjName(pNode) );
1115 printf( "Arrival time =%6.1f. ", Abc_NodeReadArrivalWorst(pNode) );
1116 printf( "\n" );
1117 continue;
1118 }
1119 if ( Abc_ObjIsCo(pNode) )
1120 {
1121 printf( "Primary output \"%s\". ", Abc_ObjName(pNode) );
1122 printf( "Arrival =%6.1f. ", Abc_NodeReadArrivalWorst(pNode) );
1123 }
1124 else
1125 {
1126 assert( Abc_ObjIsNode(pNode) );
1127 iFanin = Abc_NodeFindFanin( pNode, (Abc_Obj_t *)Vec_PtrEntry(vPath,i-1) );
1128 Slack = Abc_NtkDelayTraceSlack(vSlacks, pNode, iFanin);
1129 printf( "%10s/", Abc_ObjName(pNode) );
1130 printf( "%-4s", Mio_GateReadPinName((Mio_Gate_t *)pNode->pData, iFanin) );
1131 printf( " (%s)", Mio_GateReadName((Mio_Gate_t *)pNode->pData) );
1132 for ( k = strlen(Mio_GateReadName((Mio_Gate_t *)pNode->pData)); k < Length; k++ )
1133 printf( " " );
1134 printf( " " );
1135 printf( "Arrival =%6.1f. ", Abc_NodeReadArrivalWorst(pNode) );
1136 printf( "I/O times: (" );
1137 Abc_ObjForEachFanin( pNode, pFanin, k )
1138 printf( "%s%.1f", (k? ", ":""), Abc_NodeReadArrivalWorst(pFanin) );
1139// printf( " -> %.1f)", Abc_NodeReadArrival(pNode)->Worst + Slack + SlackAdd );
1140 printf( " -> %.1f)", Abc_NodeReadArrivalWorst(pNode) );
1141 }
1142 printf( "\n" );
1143 }
1144 printf( "Level %3d : ", Abc_ObjLevel(Abc_ObjFanin0(pOut)) + 1 );
1145 printf( "Primary output \"%s\". ", Abc_ObjName(pOut) );
1146 printf( "Required time = %6.1f. ", Abc_NodeReadRequiredWorst(pOut) );
1147 printf( "Path slack = %6.1f.\n", SlackAdd );
1148 }
1149 Vec_PtrFree( vPath );
1150 Vec_IntFree( vBest );
1151 }
1152
1153 Vec_IntFreeP( &vSlacks );
1154 return tArrivalMax;
1155}
float Abc_NodeReadArrivalWorst(Abc_Obj_t *pNode)
Definition abcTiming.c:111
void Abc_NtkDelayTraceCritPathCollect_rec(Vec_Int_t *vSlacks, Abc_Obj_t *pNode, Vec_Int_t *vBest, Vec_Ptr_t *vPath)
Definition abcTiming.c:916
Vec_Int_t * Abc_NtkDelayTraceSlackStart(Abc_Ntk_t *pNtk)
Definition abcTiming.c:828
int Abc_NtkDelayTraceCritPath_rec(Vec_Int_t *vSlacks, Abc_Obj_t *pNode, Abc_Obj_t *pLeaf, Vec_Int_t *vBest)
Definition abcTiming.c:876
void Abc_NtkTimePrepare(Abc_Ntk_t *pNtk)
Definition abcTiming.c:424
void Abc_NodeDelayTraceArrival(Abc_Obj_t *pNode, Vec_Int_t *vSlacks)
Definition abcTiming.c:939
float Abc_NodeReadRequiredWorst(Abc_Obj_t *pNode)
Definition abcTiming.c:115
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition abcDfs.c:82
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition abcNames.c:49
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition abcDfs.c:1449
ABC_DLL int Abc_NodeFindFanin(Abc_Obj_t *pNode, Abc_Obj_t *pFanin)
Definition abcUtil.c:791
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
char * Mio_GateReadPinName(Mio_Gate_t *pGate, int iPin)
Definition mioApi.c:230
char * Mio_GateReadName(Mio_Gate_t *pGate)
Definition mioApi.c:169
int strlen()
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDelayTraceCritPath_rec()

int Abc_NtkDelayTraceCritPath_rec ( Vec_Int_t * vSlacks,
Abc_Obj_t * pNode,
Abc_Obj_t * pLeaf,
Vec_Int_t * vBest )

Function*************************************************************

Synopsis [Find most-critical path (the path with smallest slacks).]

Description []

SideEffects []

SeeAlso []

Definition at line 876 of file abcTiming.c.

877{
878 Abc_Obj_t * pFanin, * pFaninBest = NULL;
879 float SlackMin = ABC_INFINITY; int i;
880 // check primary inputs
881 if ( Abc_ObjIsCi(pNode) )
882 return (pLeaf == NULL || pLeaf == pNode);
883 assert( Abc_ObjIsNode(pNode) );
884 // check visited
885 if ( Abc_NodeIsTravIdCurrent( pNode ) )
886 return Vec_IntEntry(vBest, Abc_ObjId(pNode)) >= 0;
887 Abc_NodeSetTravIdCurrent( pNode );
888 // check the node
889 assert( Abc_ObjIsNode(pNode) );
890 Abc_ObjForEachFanin( pNode, pFanin, i )
891 {
892 if ( !Abc_NtkDelayTraceCritPath_rec( vSlacks, pFanin, pLeaf, vBest ) )
893 continue;
894 if ( pFaninBest == NULL || SlackMin > Abc_NtkDelayTraceSlack(vSlacks, pNode, i) )
895 {
896 pFaninBest = pFanin;
897 SlackMin = Abc_NtkDelayTraceSlack(vSlacks, pNode, i);
898 }
899 }
900 if ( pFaninBest != NULL )
901 Vec_IntWriteEntry( vBest, Abc_ObjId(pNode), Abc_NodeFindFanin(pNode, pFaninBest) );
902 return (pFaninBest != NULL);
903}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDelayTraceCritPathCollect_rec()

void Abc_NtkDelayTraceCritPathCollect_rec ( Vec_Int_t * vSlacks,
Abc_Obj_t * pNode,
Vec_Int_t * vBest,
Vec_Ptr_t * vPath )

Function*************************************************************

Synopsis [Find most-critical path (the path with smallest slacks).]

Description []

SideEffects []

SeeAlso []

Definition at line 916 of file abcTiming.c.

917{
918 assert( Abc_ObjIsCi(pNode) || Abc_ObjIsNode(pNode) );
919 if ( Abc_ObjIsNode(pNode) )
920 {
921 int iFanin = Vec_IntEntry( vBest, Abc_ObjId(pNode) );
922 assert( iFanin >= 0 );
923 Abc_NtkDelayTraceCritPathCollect_rec( vSlacks, Abc_ObjFanin(pNode, iFanin), vBest, vPath );
924 }
925 Vec_PtrPush( vPath, pNode );
926}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkDelayTraceSlackStart()

Vec_Int_t * Abc_NtkDelayTraceSlackStart ( Abc_Ntk_t * pNtk)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 828 of file abcTiming.c.

829{
830 Vec_Int_t * vSlacks;
831 Abc_Obj_t * pObj;
832 int i, k;
833 vSlacks = Vec_IntAlloc( Abc_NtkObjNumMax(pNtk) + Abc_NtkGetTotalFanins(pNtk) );
834 Vec_IntFill( vSlacks, Abc_NtkObjNumMax(pNtk), -1 );
835 Abc_NtkForEachNode( pNtk, pObj, i )
836 {
837 Vec_IntWriteEntry( vSlacks, i, Vec_IntSize(vSlacks) );
838 for ( k = 0; k < Abc_ObjFaninNum(pObj); k++ )
839 Vec_IntPush( vSlacks, -1 );
840 }
841// assert( Abc_MaxInt(16, Vec_IntSize(vSlacks)) == Vec_IntCap(vSlacks) );
842 return vSlacks;
843}
ABC_DLL int Abc_NtkGetTotalFanins(Abc_Ntk_t *pNtk)
Definition abcUtil.c:520
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition abc.h:464
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkGetCiArrivalFloats()

float * Abc_NtkGetCiArrivalFloats ( Abc_Ntk_t * pNtk)

Function*************************************************************

Synopsis [Sets the CI node levels according to the arrival info.]

Description []

SideEffects []

SeeAlso []

Definition at line 789 of file abcTiming.c.

790{
791 float * p;
792 Abc_Obj_t * pNode;
793 int i;
794 p = ABC_CALLOC( float, Abc_NtkCiNum(pNtk) );
795 if ( pNtk->pManTime == NULL )
796 return p;
797 // set the PI arrival times
798 Abc_NtkForEachCi( pNtk, pNode, i )
799 p[i] = Abc_NodeReadArrivalWorst(pNode);
800 return p;
801}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkGetCiArrivalTimes()

Abc_Time_t * Abc_NtkGetCiArrivalTimes ( Abc_Ntk_t * pNtk)

Function*************************************************************

Synopsis [Sets the CI node levels according to the arrival info.]

Description []

SideEffects []

SeeAlso []

Definition at line 750 of file abcTiming.c.

751{
752 Abc_Time_t * p;
753 Abc_Obj_t * pNode;
754 int i;
755 p = ABC_CALLOC( Abc_Time_t, Abc_NtkCiNum(pNtk) );
756 if ( pNtk->pManTime == NULL )
757 return p;
758 // set the PI arrival times
759 Abc_NtkForEachCi( pNtk, pNode, i )
760 p[i] = *Abc_NodeArrival(pNode);
761 return p;
762}
Here is the caller graph for this function:

◆ Abc_NtkGetCoRequiredFloats()

float * Abc_NtkGetCoRequiredFloats ( Abc_Ntk_t * pNtk)

Definition at line 802 of file abcTiming.c.

803{
804 float * p;
805 Abc_Obj_t * pNode;
806 int i;
807 if ( pNtk->pManTime == NULL )
808 return NULL;
809 // set the PO required times
810 p = ABC_CALLOC( float, Abc_NtkCoNum(pNtk) );
811 Abc_NtkForEachCo( pNtk, pNode, i )
812 p[i] = Abc_NodeReadRequiredWorst(pNode);
813 return p;
814}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkGetCoRequiredTimes()

Abc_Time_t * Abc_NtkGetCoRequiredTimes ( Abc_Ntk_t * pNtk)

Definition at line 763 of file abcTiming.c.

764{
765 Abc_Time_t * p;
766 Abc_Obj_t * pNode;
767 int i;
768 p = ABC_CALLOC( Abc_Time_t, Abc_NtkCoNum(pNtk) );
769 if ( pNtk->pManTime == NULL )
770 return p;
771 // set the PO required times
772 Abc_NtkForEachCo( pNtk, pNode, i )
773 p[i] = *Abc_NodeRequired(pNode);
774 return p;
775}
Here is the caller graph for this function:

◆ Abc_NtkReadDefaultArrival()

Abc_Time_t * Abc_NtkReadDefaultArrival ( Abc_Ntk_t * pNtk)

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Reads the arrival.required time of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 75 of file abcTiming.c.

76{
77 assert( pNtk->pManTime );
78 return &pNtk->pManTime->tArrDef;
79}
Here is the caller graph for this function:

◆ Abc_NtkReadDefaultArrivalWorst()

float Abc_NtkReadDefaultArrivalWorst ( Abc_Ntk_t * pNtk)

Definition at line 95 of file abcTiming.c.

96{
97 return 0.5 * pNtk->pManTime->tArrDef.Rise + 0.5 * pNtk->pManTime->tArrDef.Fall;
98}

◆ Abc_NtkReadDefaultInputDrive()

Abc_Time_t * Abc_NtkReadDefaultInputDrive ( Abc_Ntk_t * pNtk)

Function*************************************************************

Synopsis [Reads the input drive / output load of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 131 of file abcTiming.c.

132{
133 assert( pNtk->pManTime );
134 return &pNtk->pManTime->tInDriveDef;
135}
Here is the caller graph for this function:

◆ Abc_NtkReadDefaultOutputLoad()

Abc_Time_t * Abc_NtkReadDefaultOutputLoad ( Abc_Ntk_t * pNtk)

Definition at line 136 of file abcTiming.c.

137{
138 assert( pNtk->pManTime );
139 return &pNtk->pManTime->tOutLoadDef;
140}
Here is the caller graph for this function:

◆ Abc_NtkReadDefaultRequired()

Abc_Time_t * Abc_NtkReadDefaultRequired ( Abc_Ntk_t * pNtk)

Definition at line 80 of file abcTiming.c.

81{
82 assert( pNtk->pManTime );
83 return &pNtk->pManTime->tReqDef;
84}
Here is the caller graph for this function:

◆ Abc_NtkReadDefaultRequiredWorst()

float Abc_NtkReadDefaultRequiredWorst ( Abc_Ntk_t * pNtk)

Definition at line 99 of file abcTiming.c.

100{
101 return 0.5 * pNtk->pManTime->tReqDef.Rise + 0.5 * pNtk->pManTime->tReqDef.Fall;
102}

◆ Abc_NtkSetNodeLevelsArrival()

void Abc_NtkSetNodeLevelsArrival ( Abc_Ntk_t * pNtkOld)

Function*************************************************************

Synopsis [Sets the CI node levels according to the arrival info.]

Description []

SideEffects []

SeeAlso []

Definition at line 722 of file abcTiming.c.

723{
724 Abc_Obj_t * pNodeOld, * pNodeNew;
725 float tAndDelay;
726 int i;
727 if ( pNtkOld->pManTime == NULL )
728 return;
730 return;
732 Abc_NtkForEachCi( pNtkOld, pNodeOld, i )
733 {
734 pNodeNew = pNodeOld->pCopy;
735 pNodeNew->Level = (int)(Abc_NodeReadArrivalWorst(pNodeOld) / tAndDelay);
736 }
737}
ABC_DLL void * Abc_FrameReadLibGen()
Definition mainFrame.c:59
float Mio_LibraryReadDelayNand2Max(Mio_Library_t *pLib)
Definition mioApi.c:62
struct Mio_LibraryStruct_t_ Mio_Library_t
Definition mio.h:42
Mio_Gate_t * Mio_LibraryReadNand2(Mio_Library_t *pLib)
Definition mioApi.c:53
Abc_Obj_t * pCopy
Definition abc.h:148
unsigned Level
Definition abc.h:142
Here is the call graph for this function:

◆ Abc_NtkStartReverseLevels()

void Abc_NtkStartReverseLevels ( Abc_Ntk_t * pNtk,
int nMaxLevelIncrease )

Function*************************************************************

Synopsis [Prepares for the computation of required levels.]

Description [This procedure should be called before the required times are used. It starts internal data structures, which records the level from the COs of the network nodes in reverse topologogical order.]

SideEffects []

SeeAlso []

Definition at line 1274 of file abcTiming.c.

1275{
1276 Vec_Ptr_t * vNodes;
1277 Abc_Obj_t * pObj;
1278 int i;
1279 // remember the maximum number of direct levels
1280 pNtk->LevelMax = Abc_NtkLevel(pNtk) + nMaxLevelIncrease;
1281 // start the reverse levels
1282 pNtk->vLevelsR = Vec_IntAlloc( 0 );
1283 Vec_IntFill( pNtk->vLevelsR, 1 + Abc_NtkObjNumMax(pNtk), 0 );
1284 // compute levels in reverse topological order
1285 vNodes = Abc_NtkDfsReverse( pNtk );
1286 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
1288 Vec_PtrFree( vNodes );
1289}
void Abc_ObjSetReverseLevel(Abc_Obj_t *pObj, int LevelR)
Definition abcTiming.c:1253
int Abc_ObjReverseLevelNew(Abc_Obj_t *pObj)
Definition abcTiming.c:1190
ABC_DLL Vec_Ptr_t * Abc_NtkDfsReverse(Abc_Ntk_t *pNtk)
Definition abcDfs.c:221
Vec_Int_t * vLevelsR
Definition abc.h:196
int LevelMax
Definition abc.h:195
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkStopReverseLevels()

void Abc_NtkStopReverseLevels ( Abc_Ntk_t * pNtk)

Function*************************************************************

Synopsis [Cleans the data structures used to compute required levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 1302 of file abcTiming.c.

1303{
1304 assert( pNtk->vLevelsR );
1305 Vec_IntFree( pNtk->vLevelsR );
1306 pNtk->vLevelsR = NULL;
1307 pNtk->LevelMax = 0;
1308
1309}
Here is the caller graph for this function:

◆ Abc_NtkTimeInitialize()

void Abc_NtkTimeInitialize ( Abc_Ntk_t * pNtk,
Abc_Ntk_t * pNtkOld )

Function*************************************************************

Synopsis [Finalizes the timing manager after setting arr/req times.]

Description []

SideEffects []

SeeAlso []

Definition at line 343 of file abcTiming.c.

344{
345 Abc_Obj_t * pObj;
346 Abc_Time_t ** ppTimes;
347 int i;
348 assert( pNtkOld == NULL || pNtkOld->pManTime != NULL );
349 assert( pNtkOld == NULL || Abc_NtkCiNum(pNtk) == Abc_NtkCiNum(pNtkOld) );
350 assert( pNtkOld == NULL || Abc_NtkCoNum(pNtk) == Abc_NtkCoNum(pNtkOld) );
351 if ( pNtk->pManTime == NULL )
352 return;
353 // create timing manager with default values
354 Abc_ManTimeExpand( pNtk->pManTime, Abc_NtkObjNumMax(pNtk), 0 );
355 // set global defaults from pNtkOld
356 if ( pNtkOld )
357 {
358 pNtk->pManTime->tArrDef = pNtkOld->pManTime->tArrDef;
359 pNtk->pManTime->tReqDef = pNtkOld->pManTime->tReqDef;
360 pNtk->AndGateDelay = pNtkOld->AndGateDelay;
361 }
362 // set the default timing for CI and COs
363 ppTimes = (Abc_Time_t **)pNtk->pManTime->vArrs->pArray;
364 Abc_NtkForEachCi( pNtk, pObj, i )
365 *ppTimes[pObj->Id] = pNtkOld ? *Abc_NodeReadArrival(Abc_NtkCi(pNtkOld, i)) : pNtk->pManTime->tArrDef;
366 ppTimes = (Abc_Time_t **)pNtk->pManTime->vReqs->pArray;
367 Abc_NtkForEachCo( pNtk, pObj, i )
368 *ppTimes[pObj->Id] = pNtkOld ? *Abc_NodeReadRequired(Abc_NtkCo(pNtkOld, i)) : pNtk->pManTime->tReqDef;
369}
Abc_Time_t * Abc_NodeReadArrival(Abc_Obj_t *pNode)
Definition abcTiming.c:85
float AndGateDelay
Definition abc.h:194
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkTimePrepare()

void Abc_NtkTimePrepare ( Abc_Ntk_t * pNtk)

Function*************************************************************

Synopsis [Prepares the timing manager for delay trace.]

Description []

SideEffects []

SeeAlso []

Definition at line 424 of file abcTiming.c.

425{
426 Abc_Obj_t * pObj;
427 Abc_Time_t ** ppTimes, * pTime;
428 int i;
429 // if there is no timing manager, allocate and initialize
430 if ( pNtk->pManTime == NULL )
431 {
432 pNtk->pManTime = Abc_ManTimeStart(pNtk);
433 Abc_NtkTimeInitialize( pNtk, NULL );
434 return;
435 }
436 // if timing manager is given, expand it if necessary
437 Abc_ManTimeExpand( pNtk->pManTime, Abc_NtkObjNumMax(pNtk), 0 );
438 // clean arrivals except for PIs
439 ppTimes = (Abc_Time_t **)pNtk->pManTime->vArrs->pArray;
440 Abc_NtkForEachNode( pNtk, pObj, i )
441 {
442 pTime = ppTimes[pObj->Id];
443 pTime->Fall = pTime->Rise = Abc_ObjFaninNum(pObj) ? -ABC_INFINITY : 0; // set contant node arrivals to zero
444 }
445 Abc_NtkForEachCo( pNtk, pObj, i )
446 {
447 pTime = ppTimes[pObj->Id];
448 pTime->Fall = pTime->Rise = -ABC_INFINITY;
449 }
450 // clean required except for POs
451 ppTimes = (Abc_Time_t **)pNtk->pManTime->vReqs->pArray;
452 Abc_NtkForEachNode( pNtk, pObj, i )
453 {
454 pTime = ppTimes[pObj->Id];
455 pTime->Fall = pTime->Rise = ABC_INFINITY;
456 }
457 Abc_NtkForEachCi( pNtk, pObj, i )
458 {
459 pTime = ppTimes[pObj->Id];
460 pTime->Fall = pTime->Rise = ABC_INFINITY;
461 }
462}
void Abc_NtkTimeInitialize(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkOld)
Definition abcTiming.c:343
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkTimePrint()

void Abc_NtkTimePrint ( Abc_Ntk_t * pNtk)

Function*************************************************************

Synopsis [Prints out the timing manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 629 of file abcTiming.c.

630{
631 if ( pNtk->pManTime == NULL )
632 printf( "There is no timing manager\n" );
633 else
634 {
635 Abc_Obj_t * pObj; int i;
636 printf( "Default arrival = %8f\n", pNtk->pManTime->tArrDef.Fall );
637 printf( "Default required = %8f\n", pNtk->pManTime->tReqDef.Fall );
638 printf( "Inputs (%d):\n", Abc_NtkCiNum(pNtk) );
639 Abc_NtkForEachCi( pNtk, pObj, i )
640 printf( "%20s arrival = %8f required = %8f\n",
641 Abc_ObjName(pObj),
644 printf( "Outputs (%d):\n", Abc_NtkCoNum(pNtk) );
645 Abc_NtkForEachCo( pNtk, pObj, i )
646 printf( "%20s arrival = %8f required = %8f\n",
647 Abc_ObjName(pObj),
650 }
651}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkTimeScale()

void Abc_NtkTimeScale ( Abc_Ntk_t * pNtk,
float Scale )

Function*************************************************************

Synopsis [This procedure scales user timing by multiplicative factor.]

Description []

SideEffects []

SeeAlso []

Definition at line 382 of file abcTiming.c.

383{
384 Abc_Obj_t * pObj;
385 Abc_Time_t ** ppTimes, * pTime;
386 int i;
387 if ( pNtk->pManTime == NULL )
388 return;
389 // arrival
390 pNtk->pManTime->tArrDef.Fall *= Scale;
391 pNtk->pManTime->tArrDef.Rise *= Scale;
392 // departure
393 pNtk->pManTime->tReqDef.Fall *= Scale;
394 pNtk->pManTime->tReqDef.Rise *= Scale;
395 // set the default timing
396 ppTimes = (Abc_Time_t **)pNtk->pManTime->vArrs->pArray;
397 Abc_NtkForEachCi( pNtk, pObj, i )
398 {
399 pTime = ppTimes[pObj->Id];
400 pTime->Fall *= Scale;
401 pTime->Rise *= Scale;
402 }
403 // set the default timing
404 ppTimes = (Abc_Time_t **)pNtk->pManTime->vReqs->pArray;
405 Abc_NtkForEachCo( pNtk, pObj, i )
406 {
407 pTime = ppTimes[pObj->Id];
408 pTime->Fall *= Scale;
409 pTime->Rise *= Scale;
410 }
411}

◆ Abc_NtkTimeSetArrival()

void Abc_NtkTimeSetArrival ( Abc_Ntk_t * pNtk,
int ObjId,
float Rise,
float Fall )

Function*************************************************************

Synopsis [Sets the arrival time for an object.]

Description []

SideEffects []

SeeAlso []

Definition at line 208 of file abcTiming.c.

209{
210 Vec_Ptr_t * vTimes;
211 Abc_Time_t * pTime;
212
213 if ( pNtk->pManTime == NULL )
214 pNtk->pManTime = Abc_ManTimeStart(pNtk);
215 Abc_ManTimeExpand( pNtk->pManTime, ObjId + 1, 1 );
216 // set the arrival time
217 vTimes = pNtk->pManTime->vArrs;
218 pTime = (Abc_Time_t *)vTimes->pArray[ObjId];
219 pTime->Rise = Rise;
220 pTime->Fall = Fall;
221
222
223}
Here is the caller graph for this function:

◆ Abc_NtkTimeSetDefaultArrival()

void Abc_NtkTimeSetDefaultArrival ( Abc_Ntk_t * pNtk,
float Rise,
float Fall )

Function*************************************************************

Synopsis [Sets the default arrival time for the network.]

Description [Please note that .default_input_arrival and .default_output_required should precede .input_arrival and .output required. Otherwise, an overwrite may happen.]

SideEffects []

SeeAlso []

Definition at line 173 of file abcTiming.c.

174{
175 Abc_Obj_t * pObj; int i;
176 if ( pNtk->pManTime == NULL )
177 pNtk->pManTime = Abc_ManTimeStart(pNtk);
178 pNtk->pManTime->tArrDef.Rise = Rise;
179 pNtk->pManTime->tArrDef.Fall = Fall;
180 // set the arrival times for each input
181 Abc_NtkForEachCi( pNtk, pObj, i )
182 Abc_NtkTimeSetArrival( pNtk, Abc_ObjId(pObj), Rise, Fall );
183}
void Abc_NtkTimeSetArrival(Abc_Ntk_t *pNtk, int ObjId, float Rise, float Fall)
Definition abcTiming.c:208
Here is the call graph for this function:

◆ Abc_NtkTimeSetDefaultInputDrive()

void Abc_NtkTimeSetDefaultInputDrive ( Abc_Ntk_t * pNtk,
float Rise,
float Fall )

Function*************************************************************

Synopsis [Sets the default arrival time for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 249 of file abcTiming.c.

250{
251// if ( Rise == 0.0 && Fall == 0.0 )
252// return;
253 if ( pNtk->pManTime == NULL )
254 pNtk->pManTime = Abc_ManTimeStart(pNtk);
255 pNtk->pManTime->tInDriveDef.Rise = Rise;
256 pNtk->pManTime->tInDriveDef.Fall = Fall;
257 if ( pNtk->pManTime->tInDrive != NULL )
258 {
259 int i;
260 for ( i = 0; i < Abc_NtkCiNum(pNtk); i++ )
261 if ( pNtk->pManTime->tInDrive[i].Rise == 0 && pNtk->pManTime->tInDrive[i].Fall == 0 )
262 pNtk->pManTime->tInDrive[i] = pNtk->pManTime->tInDriveDef;
263 }
264}

◆ Abc_NtkTimeSetDefaultOutputLoad()

void Abc_NtkTimeSetDefaultOutputLoad ( Abc_Ntk_t * pNtk,
float Rise,
float Fall )

Definition at line 265 of file abcTiming.c.

266{
267// if ( Rise == 0.0 && Fall == 0.0 )
268// return;
269 if ( pNtk->pManTime == NULL )
270 pNtk->pManTime = Abc_ManTimeStart(pNtk);
271 pNtk->pManTime->tOutLoadDef.Rise = Rise;
272 pNtk->pManTime->tOutLoadDef.Fall = Fall;
273 if ( pNtk->pManTime->tOutLoad != NULL )
274 {
275 int i;
276 for ( i = 0; i < Abc_NtkCoNum(pNtk); i++ )
277 if ( pNtk->pManTime->tOutLoad[i].Rise == 0 && pNtk->pManTime->tOutLoad[i].Fall == 0 )
278 pNtk->pManTime->tOutLoad[i] = pNtk->pManTime->tOutLoadDef;
279 }
280}

◆ Abc_NtkTimeSetDefaultRequired()

void Abc_NtkTimeSetDefaultRequired ( Abc_Ntk_t * pNtk,
float Rise,
float Fall )

Definition at line 184 of file abcTiming.c.

185{
186 Abc_Obj_t * pObj; int i;
187 if ( pNtk->pManTime == NULL )
188 pNtk->pManTime = Abc_ManTimeStart(pNtk);
189 pNtk->pManTime->tReqDef.Rise = Rise;
190 pNtk->pManTime->tReqDef.Fall = Fall;
191 // set the required times for each output
192 Abc_NtkForEachCo( pNtk, pObj, i ){
193 Abc_NtkTimeSetRequired( pNtk, Abc_ObjId(pObj), Rise, Fall );
194 }
195}
void Abc_NtkTimeSetRequired(Abc_Ntk_t *pNtk, int ObjId, float Rise, float Fall)
Definition abcTiming.c:224
Here is the call graph for this function:

◆ Abc_NtkTimeSetInputDrive()

void Abc_NtkTimeSetInputDrive ( Abc_Ntk_t * pNtk,
int PiNum,
float Rise,
float Fall )

Function*************************************************************

Synopsis [Sets the arrival time for an object.]

Description []

SideEffects []

SeeAlso []

Definition at line 293 of file abcTiming.c.

294{
295 Abc_Time_t * pTime;
296 assert( PiNum >= 0 && PiNum < Abc_NtkCiNum(pNtk) );
297 if ( pNtk->pManTime == NULL )
298 pNtk->pManTime = Abc_ManTimeStart(pNtk);
299 if ( pNtk->pManTime->tInDriveDef.Rise == Rise && pNtk->pManTime->tInDriveDef.Fall == Fall )
300 return;
301 if ( pNtk->pManTime->tInDrive == NULL )
302 {
303 int i;
304 pNtk->pManTime->tInDrive = ABC_CALLOC( Abc_Time_t, Abc_NtkCiNum(pNtk) );
305 for ( i = 0; i < Abc_NtkCiNum(pNtk); i++ )
306 pNtk->pManTime->tInDrive[i] = pNtk->pManTime->tInDriveDef;
307 }
308 pTime = pNtk->pManTime->tInDrive + PiNum;
309 pTime->Rise = Rise;
310 pTime->Fall = Fall;
311}

◆ Abc_NtkTimeSetOutputLoad()

void Abc_NtkTimeSetOutputLoad ( Abc_Ntk_t * pNtk,
int PoNum,
float Rise,
float Fall )

Definition at line 312 of file abcTiming.c.

313{
314 Abc_Time_t * pTime;
315 assert( PoNum >= 0 && PoNum < Abc_NtkCoNum(pNtk) );
316 if ( pNtk->pManTime == NULL )
317 pNtk->pManTime = Abc_ManTimeStart(pNtk);
318 if ( pNtk->pManTime->tOutLoadDef.Rise == Rise && pNtk->pManTime->tOutLoadDef.Fall == Fall )
319 return;
320 if ( pNtk->pManTime->tOutLoad == NULL )
321 {
322 int i;
323 pNtk->pManTime->tOutLoad = ABC_CALLOC( Abc_Time_t, Abc_NtkCoNum(pNtk) );
324 for ( i = 0; i < Abc_NtkCoNum(pNtk); i++ )
325 pNtk->pManTime->tOutLoad[i] = pNtk->pManTime->tOutLoadDef;
326 }
327 pTime = pNtk->pManTime->tOutLoad + PoNum;
328 pTime->Rise = Rise;
329 pTime->Fall = Fall;
330}

◆ Abc_NtkTimeSetRequired()

void Abc_NtkTimeSetRequired ( Abc_Ntk_t * pNtk,
int ObjId,
float Rise,
float Fall )

Definition at line 224 of file abcTiming.c.

225{
226 Vec_Ptr_t * vTimes;
227 Abc_Time_t * pTime;
228 if ( pNtk->pManTime == NULL )
229 pNtk->pManTime = Abc_ManTimeStart(pNtk);
230 Abc_ManTimeExpand( pNtk->pManTime, ObjId + 1, 1 );
231 // set the required time
232 vTimes = pNtk->pManTime->vReqs;
233 pTime = (Abc_Time_t *)vTimes->pArray[ObjId];
234 pTime->Rise = Rise;
235 pTime->Fall = Fall;
236}
Here is the caller graph for this function:

◆ Abc_NtkUpdate()

void Abc_NtkUpdate ( Abc_Obj_t * pObj,
Abc_Obj_t * pObjNew,
Vec_Vec_t * vLevels )

Function*************************************************************

Synopsis [Replaces the node and incrementally updates levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 1423 of file abcTiming.c.

1424{
1425 // replace the old node by the new node
1426 pObjNew->Level = pObj->Level;
1427 Abc_ObjReplace( pObj, pObjNew );
1428 // update the level of the node
1429 Abc_NtkUpdateLevel( pObjNew, vLevels );
1430 Abc_ObjSetReverseLevel( pObjNew, 0 );
1431 Abc_NtkUpdateReverseLevel( pObjNew, vLevels );
1432}
void Abc_NtkUpdateLevel(Abc_Obj_t *pObjNew, Vec_Vec_t *vLevels)
Definition abcTiming.c:1322
void Abc_NtkUpdateReverseLevel(Abc_Obj_t *pObjNew, Vec_Vec_t *vLevels)
Definition abcTiming.c:1374
ABC_DLL void Abc_ObjReplace(Abc_Obj_t *pObjOld, Abc_Obj_t *pObjNew)
Definition abcFanio.c:325
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkUpdateLevel()

void Abc_NtkUpdateLevel ( Abc_Obj_t * pObjNew,
Vec_Vec_t * vLevels )

Function*************************************************************

Synopsis [Incrementally updates level of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1322 of file abcTiming.c.

1323{
1324 Abc_Obj_t * pFanout, * pTemp;
1325 int LevelOld, Lev, k, m;
1326// int Counter = 0, CounterMax = 0;
1327 // check if level has changed
1328 LevelOld = Abc_ObjLevel(pObjNew);
1329 if ( LevelOld == Abc_ObjLevelNew(pObjNew) )
1330 return;
1331 // start the data structure for level update
1332 // we cannot fail to visit a node when using this structure because the
1333 // nodes are stored by their _old_ levels, which are assumed to be correct
1334 Vec_VecClear( vLevels );
1335 Vec_VecPush( vLevels, LevelOld, pObjNew );
1336 pObjNew->fMarkA = 1;
1337 // recursively update level
1338 Vec_VecForEachEntryStart( Abc_Obj_t *, vLevels, pTemp, Lev, k, LevelOld )
1339 {
1340// Counter--;
1341 pTemp->fMarkA = 0;
1342 assert( Abc_ObjLevel(pTemp) == Lev );
1343 Abc_ObjSetLevel( pTemp, Abc_ObjLevelNew(pTemp) );
1344 // if the level did not change, no need to check the fanout levels
1345 if ( Abc_ObjLevel(pTemp) == Lev )
1346 continue;
1347 // schedule fanout for level update
1348 Abc_ObjForEachFanout( pTemp, pFanout, m )
1349 {
1350 if ( !Abc_ObjIsCo(pFanout) && !pFanout->fMarkA )
1351 {
1352 assert( Abc_ObjLevel(pFanout) >= Lev );
1353 Vec_VecPush( vLevels, Abc_ObjLevel(pFanout), pFanout );
1354// Counter++;
1355// CounterMax = Abc_MaxFloat( CounterMax, Counter );
1356 pFanout->fMarkA = 1;
1357 }
1358 }
1359 }
1360// printf( "%d ", CounterMax );
1361}
int Abc_ObjLevelNew(Abc_Obj_t *pObj)
Definition abcTiming.c:1170
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition abc.h:529
unsigned fMarkA
Definition abc.h:134
#define Vec_VecForEachEntryStart(Type, vGlob, pEntry, i, k, LevelStart)
Definition vecVec.h:92
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_NtkUpdateReverseLevel()

void Abc_NtkUpdateReverseLevel ( Abc_Obj_t * pObjNew,
Vec_Vec_t * vLevels )

Function*************************************************************

Synopsis [Incrementally updates level of the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 1374 of file abcTiming.c.

1375{
1376 Abc_Obj_t * pFanin, * pTemp;
1377 int LevelOld, LevFanin, Lev, k, m;
1378 // check if level has changed
1379 LevelOld = Abc_ObjReverseLevel(pObjNew);
1380 if ( LevelOld == Abc_ObjReverseLevelNew(pObjNew) )
1381 return;
1382 // start the data structure for level update
1383 // we cannot fail to visit a node when using this structure because the
1384 // nodes are stored by their _old_ levels, which are assumed to be correct
1385 Vec_VecClear( vLevels );
1386 Vec_VecPush( vLevels, LevelOld, pObjNew );
1387 pObjNew->fMarkA = 1;
1388 // recursively update level
1389 Vec_VecForEachEntryStart( Abc_Obj_t *, vLevels, pTemp, Lev, k, LevelOld )
1390 {
1391 pTemp->fMarkA = 0;
1392 LevelOld = Abc_ObjReverseLevel(pTemp);
1393 assert( LevelOld == Lev );
1395 // if the level did not change, no need to check the fanout levels
1396 if ( Abc_ObjReverseLevel(pTemp) == Lev )
1397 continue;
1398 // schedule fanins for level update
1399 Abc_ObjForEachFanin( pTemp, pFanin, m )
1400 {
1401 if ( !Abc_ObjIsCi(pFanin) && !pFanin->fMarkA )
1402 {
1403 LevFanin = Abc_ObjReverseLevel( pFanin );
1404 assert( LevFanin >= Lev );
1405 Vec_VecPush( vLevels, LevFanin, pFanin );
1406 pFanin->fMarkA = 1;
1407 }
1408 }
1409 }
1410}
int Abc_ObjReverseLevel(Abc_Obj_t *pObj)
Definition abcTiming.c:1233
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_ObjLevelNew()

int Abc_ObjLevelNew ( Abc_Obj_t * pObj)

Function*************************************************************

Synopsis [Computes the level of the node using its fanin levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 1170 of file abcTiming.c.

1171{
1172 Abc_Obj_t * pFanin;
1173 int i, Level = 0;
1174 Abc_ObjForEachFanin( pObj, pFanin, i )
1175 Level = Abc_MaxFloat( Level, Abc_ObjLevel(pFanin) );
1176 return Level + (int)(Abc_ObjFaninNum(pObj) > 0);
1177}
Here is the caller graph for this function:

◆ Abc_ObjRequiredLevel()

int Abc_ObjRequiredLevel ( Abc_Obj_t * pObj)

Function*************************************************************

Synopsis [Returns required level of the node.]

Description [Converts the reverse levels of the node into its required level as follows: ReqLevel(Node) = MaxLevels(Ntk) + 1 - LevelR(Node).]

SideEffects []

SeeAlso []

Definition at line 1214 of file abcTiming.c.

1215{
1216 Abc_Ntk_t * pNtk = pObj->pNtk;
1217 assert( pNtk->vLevelsR );
1218 return pNtk->LevelMax + 1 - Abc_ObjReverseLevel(pObj);
1219}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_ObjReverseLevel()

int Abc_ObjReverseLevel ( Abc_Obj_t * pObj)

Function*************************************************************

Synopsis [Returns the reverse level of the node.]

Description [The reverse level is the level of the node in reverse topological order, starting from the COs.]

SideEffects []

SeeAlso []

Definition at line 1233 of file abcTiming.c.

1234{
1235 Abc_Ntk_t * pNtk = pObj->pNtk;
1236 assert( pNtk->vLevelsR );
1237 Vec_IntFillExtra( pNtk->vLevelsR, pObj->Id + 1, 0 );
1238 return Vec_IntEntry(pNtk->vLevelsR, pObj->Id);
1239}
Here is the caller graph for this function:

◆ Abc_ObjReverseLevelNew()

int Abc_ObjReverseLevelNew ( Abc_Obj_t * pObj)

Function*************************************************************

Synopsis [Computes the reverse level of the node using its fanout levels.]

Description []

SideEffects []

SeeAlso []

Definition at line 1190 of file abcTiming.c.

1191{
1192 Abc_Obj_t * pFanout;
1193 int i, LevelCur, Level = 0;
1194 Abc_ObjForEachFanout( pObj, pFanout, i )
1195 {
1196 LevelCur = Abc_ObjReverseLevel( pFanout );
1197 Level = Abc_MaxFloat( Level, LevelCur );
1198 }
1199 return Level + 1;
1200}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_ObjSetReverseLevel()

void Abc_ObjSetReverseLevel ( Abc_Obj_t * pObj,
int LevelR )

Function*************************************************************

Synopsis [Sets the reverse level of the node.]

Description [The reverse level is the level of the node in reverse topological order, starting from the COs.]

SideEffects []

SeeAlso []

Definition at line 1253 of file abcTiming.c.

1254{
1255 Abc_Ntk_t * pNtk = pObj->pNtk;
1256 assert( pNtk->vLevelsR );
1257 Vec_IntFillExtra( pNtk->vLevelsR, pObj->Id + 1, 0 );
1258 Vec_IntWriteEntry( pNtk->vLevelsR, pObj->Id, LevelR );
1259}
Here is the caller graph for this function: