ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
sclTime.h
Go to the documentation of this file.
1
20
21#ifndef ABC__map__scl__sclTime_h
22#define ABC__map__scl__sclTime_h
23
24
28
29#include "misc/vec/vec.h"
30#include "sclLib.h"
31
33
37
41
42typedef struct SC_Time_ SC_Time;
43struct SC_Time_
44{
45 SC_Lib * pLib; // library
46 Vec_Int_t * vCis; // comb inputs
47 Vec_Int_t * vCos; // comb outputs
48 int nObjs; // allocated size
49 // get assignment
50 Vec_Int_t * vGates; // mapping of objId into gateId
51 // timing information
52 SC_Pair * pLoads; // loads for each gate
53 SC_Pair * pLoads2; // loads for each gate
54 SC_Pair * pDepts; // departures for each gate
55 SC_Pair * pTimes; // arrivals for each gate
56 SC_Pair * pSlews; // slews for each gate
57 SC_Pair * pTimes2; // arrivals for each gate
58 SC_Pair * pSlews2; // slews for each gate
59 float * pSlack; // slacks for each gate
60 SC_WireLoad * pWLoadUsed; // name of the used WireLoad model
61 // optimization parameters
62 float SumArea; // total area
63 float MaxDelay; // max delay
64 float SumArea0; // total area at the begining
65 float MaxDelay0; // max delay at the begining
66 float BestDelay; // best delay in the middle
67};
68
72
76
77static inline SC_Cell * Scl_ObjCell( SC_Time * p, int i ) { return SC_LibCell( p->pLib, Vec_IntEntry(p->vGates, i) ); }
78static inline void Scl_ObjSetCell( SC_Time * p, int i, SC_Cell * pCell ) { Vec_IntWriteEntry( p->vGates, i, pCell->Id ); }
79
80static inline SC_Pair * Scl_ObjLoad( SC_Time * p, int i ) { return p->pLoads + i; }
81static inline SC_Pair * Scl_ObjLoad2( SC_Time * p, int i ) { return p->pLoads2 + i; }
82static inline SC_Pair * Scl_ObjDept( SC_Time * p, int i ) { return p->pDepts + i; }
83static inline SC_Pair * Scl_ObjTime( SC_Time * p, int i ) { return p->pTimes + i; }
84static inline SC_Pair * Scl_ObjSlew( SC_Time * p, int i ) { return p->pSlews + i; }
85static inline SC_Pair * Scl_ObjTime2( SC_Time * p, int i ) { return p->pTimes2 + i; }
86static inline SC_Pair * Scl_ObjSlew2( SC_Time * p, int i ) { return p->pSlews2 + i; }
87
88static inline float Scl_ObjTimeMax( SC_Time * p, int i ) { return Abc_MaxFloat(Scl_ObjTime(p, i)->rise, Scl_ObjTime(p, i)->fall); }
89static inline float Scl_ObjDepthMax( SC_Time * p, int i ) { return Abc_MaxFloat(Scl_ObjDept(p, i)->rise, Scl_ObjDept(p, i)->fall); }
90static inline float Scl_ObjGetSlack( SC_Time * p, int i, float D ) { return D - Abc_MaxFloat(Scl_ObjTime(p, i)->rise + Scl_ObjDept(p, i)->rise, Scl_ObjTime(p, i)->fall + Scl_ObjDept(p, i)->fall); }
91static inline float Scl_ObjGetSlackR( SC_Time * p, int i, float D ) { return D - (Scl_ObjTime(p, i)->rise + Scl_ObjDept(p, i)->rise); }
92static inline float Scl_ObjGetSlackF( SC_Time * p, int i, float D ) { return D - (Scl_ObjTime(p, i)->fall + Scl_ObjDept(p, i)->fall); }
93static inline float Scl_ObjSlack( SC_Time * p, int i ) { return p->pSlack[i]; }
94
95static inline void Scl_ObjDupFanin( SC_Time * p, int i, int iFanin ) { *Scl_ObjTime(p, i) = *Scl_ObjTime(p, iFanin); }
96static inline float Scl_ObjGain( SC_Time * p, int i ) { return 0.5*((Scl_ObjTime2(p, i)->rise - Scl_ObjTime(p, i)->rise) + (Scl_ObjTime2(p, i)->fall - Scl_ObjTime(p, i)->fall)); }
97static inline int Scl_ObjLegal( SC_Time * p, int i, float D ) { return Scl_ObjTime(p, i)->rise <= Scl_ObjTime2(p, i)->rise + Scl_ObjGetSlackR(p, i, D) && Scl_ObjTime(p, i)->fall <= Scl_ObjTime2(p, i)->fall + Scl_ObjGetSlackF(p, i, D); }
98
99static inline double Scl_ObjLoadFf( SC_Time * p, int i, int fRise ) { return fRise ? Scl_ObjLoad(p, i)->rise : Scl_ObjLoad(p, i)->fall; }
100static inline double Scl_ObjTimePs( SC_Time * p, int i, int fRise ) { return fRise ? Scl_ObjTime(p, i)->rise : Scl_ObjTime(p, i)->fall; }
101static inline double Scl_ObjSlewPs( SC_Time * p, int i, int fRise ) { return fRise ? Scl_ObjSlew(p, i)->rise : Scl_ObjSlew(p, i)->fall; }
102
106
118static inline SC_Time * Scl_ManAlloc( SC_Lib * pLib, Vec_Int_t * vCis, Vec_Int_t * vCos, int nObjs )
119{
120 SC_Time * p;
121 p = ABC_CALLOC( SC_Time, 1 );
122 p->pLib = pLib;
123 p->vCis = vCis;
124 p->vCos = vCos;
125 p->nObjs = nObjs;
126 p->pLoads = ABC_CALLOC( SC_Pair, p->nObjs );
127 p->pLoads2 = ABC_CALLOC( SC_Pair, p->nObjs );
128 p->pDepts = ABC_CALLOC( SC_Pair, p->nObjs );
129 p->pTimes = ABC_CALLOC( SC_Pair, p->nObjs );
130 p->pSlews = ABC_CALLOC( SC_Pair, p->nObjs );
131 p->pTimes2 = ABC_CALLOC( SC_Pair, p->nObjs );
132 p->pSlews2 = ABC_CALLOC( SC_Pair, p->nObjs );
133 p->pSlack = ABC_FALLOC( float, p->nObjs );
134 return p;
135}
136static inline void Scl_ManFree( SC_Time * p )
137{
138 Vec_IntFreeP( &p->vGates );
139 ABC_FREE( p->pLoads );
140 ABC_FREE( p->pLoads2 );
141 ABC_FREE( p->pDepts );
142 ABC_FREE( p->pTimes );
143 ABC_FREE( p->pSlews );
144 ABC_FREE( p->pTimes2 );
145 ABC_FREE( p->pSlews2 );
146 ABC_FREE( p->pSlack );
147 ABC_FREE( p );
148}
149static inline void Scl_ManCleanTime( SC_Time * p )
150{
151 memset( p->pDepts, 0, sizeof(SC_Pair) * p->nObjs );
152 memset( p->pTimes, 0, sizeof(SC_Pair) * p->nObjs );
153 memset( p->pSlews, 0, sizeof(SC_Pair) * p->nObjs );
154}
155
156
168static inline void Scl_ConeStore( SC_Time * p, Vec_Int_t * vCone )
169{
170 int i, iObj;
171 Vec_IntForEachEntry( vCone, iObj, i )
172 {
173 *Scl_ObjTime2(p, iObj) = *Scl_ObjTime(p, iObj);
174 *Scl_ObjSlew2(p, iObj) = *Scl_ObjSlew(p, iObj);
175 }
176}
177static inline void Scl_ConeRestore( SC_Time * p, Vec_Int_t * vCone )
178{
179 int i, iObj;
180 Vec_IntForEachEntry( vCone, iObj, i )
181 {
182 *Scl_ObjTime(p, iObj) = *Scl_ObjTime2(p, iObj);
183 *Scl_ObjSlew(p, iObj) = *Scl_ObjSlew2(p, iObj);
184 }
185}
186static inline void Scl_ConeClear( SC_Time * p, Vec_Int_t * vCone )
187{
188 SC_Pair Zero = { 0.0, 0.0 };
189 int i, iObj;
190 Vec_IntForEachEntry( vCone, iObj, i )
191 {
192 *Scl_ObjTime(p, iObj) = Zero;
193 *Scl_ObjSlew(p, iObj) = Zero;
194 }
195}
196
208static inline void Scl_PinTimeArrival( SC_Time * p, SC_Timing * pTime, int iObj, int iFanin )
209{
210 SC_Pair * pArrIn = Scl_ObjTime( p, iFanin );
211 SC_Pair * pSlewIn = Scl_ObjSlew( p, iFanin );
212 SC_Pair * pLoad = Scl_ObjLoad( p, iObj );
213 SC_Pair * pArrOut = Scl_ObjTime( p, iObj ); // modified
214 SC_Pair * pSlewOut = Scl_ObjSlew( p, iObj ); // modified
215 Scl_LibPinArrival( pTime, pArrIn, pSlewIn, pLoad, pArrOut, pSlewOut );
216}
217static inline void Scl_PinTimeDeparture( SC_Time * p, SC_Timing * pTime, int iObj, int iFanin )
218{
219 SC_Pair * pDepIn = Scl_ObjDept( p, iFanin ); // modified
220 SC_Pair * pSlewIn = Scl_ObjSlew( p, iFanin );
221 SC_Pair * pLoad = Scl_ObjLoad( p, iObj );
222 SC_Pair * pDepOut = Scl_ObjDept( p, iObj );
223 Scl_LibPinDeparture( pTime, pDepIn, pSlewIn, pLoad, pDepOut );
224}
225
226
227
229
230#endif
231
#define ABC_FALLOC(type, num)
Definition abc_global.h:266
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define ABC_FREE(obj)
Definition abc_global.h:267
#define ABC_NAMESPACE_HEADER_END
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Cube * p
Definition exorList.c:222
struct SC_Timing_ SC_Timing
Definition sclLib.h:124
struct SC_Lib_ SC_Lib
Definition sclLib.h:128
struct SC_Pair_ SC_Pair
Definition sclLib.h:69
struct SC_WireLoad_ SC_WireLoad
STRUCTURE DEFINITIONS ///.
Definition sclLib.h:120
struct SC_Cell_ SC_Cell
Definition sclLib.h:127
typedefABC_NAMESPACE_HEADER_START struct SC_Time_ SC_Time
INCLUDES ///.
Definition sclTime.h:42
int Id
Definition sclLib.h:203
Vec_Int_t * vCos
Definition sclTime.h:47
int nObjs
Definition sclTime.h:48
float SumArea0
Definition sclTime.h:64
SC_WireLoad * pWLoadUsed
Definition sclTime.h:60
SC_Pair * pSlews2
Definition sclTime.h:58
Vec_Int_t * vGates
Definition sclTime.h:50
SC_Pair * pTimes2
Definition sclTime.h:57
SC_Pair * pTimes
Definition sclTime.h:55
SC_Pair * pSlews
Definition sclTime.h:56
float * pSlack
Definition sclTime.h:59
float MaxDelay0
Definition sclTime.h:65
float BestDelay
Definition sclTime.h:66
float SumArea
Definition sclTime.h:62
SC_Pair * pDepts
Definition sclTime.h:54
SC_Lib * pLib
Definition sclTime.h:45
Vec_Int_t * vCis
Definition sclTime.h:46
SC_Pair * pLoads2
Definition sclTime.h:53
SC_Pair * pLoads
Definition sclTime.h:52
float MaxDelay
Definition sclTime.h:63
char * memset()
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54