00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #if !defined(oagTimerTPoint_P)
00014 #define oagTimerTPoint_P
00015
00016 #include <float.h>
00017 #include <vector>
00018 #include <map>
00019 #include "oaDesignDB.h"
00020
00021 #include "oagTimerModel.h"
00022
00023 #undef AFSHIN
00024
00025 using namespace oa;
00026 using namespace std;
00027
00028 namespace oagTimer {
00029
00031 typedef enum {
00032 TIMING_POINT_NULL,
00033 TIMING_POINT_SIGNAL_IN,
00034 TIMING_POINT_SIGNAL_OUT,
00035 TIMING_POINT_CLOCK,
00036 TIMING_POINT_PI,
00037 TIMING_POINT_PO,
00038 TIMING_POINT_PI_CLOCK
00039 } timingPointType;
00040
00041 class TPointMaster;
00042
00044
00052 struct timingData {
00053 int clockIndex;
00055 TimeType riseArr;
00057 TimeType riseReq;
00059 TimeType fallArr;
00061 TimeType fallReq;
00063 TimeType fallEarly;
00065 TimeType riseEarly;
00067 DelayType riseSlew;
00069 DelayType fallSlew;
00070 };
00071
00072 struct DPData {
00073 oaString cellSize;
00074 double inCap;
00075 double rAT;
00076 double arr;
00077 map<oaOccInstTerm*,oaString> faninMap;
00078 map<oaOccInstTerm*,oaString> fanoutMap;
00079 };
00080
00081 struct lrData {
00082 oaString cellSize;
00083 double inCap;
00084 double fObj;
00085 map<oaOccInstTerm*,oaString> fanoutMap;
00086 };
00087
00088 class TPoint {
00089 friend class Timer;
00090 friend class DuetSensitivity;
00091 friend class Opt;
00092 friend class Util;
00093 friend class TimerUtil;
00094 friend class lpSA;
00095 friend class LR;
00096 friend class DP;
00097 friend class SubTimer;
00098
00099 public:
00105 TPoint() : type(TIMING_POINT_NULL) {
00106 riseArr = riseReq = fallArr = fallReq = 0.0;
00107 netLoad = load = 0.0;
00108 res = 0.0;
00109 netDelay = 0.0;
00110 fallSlew = riseSlew = 0.0;
00111 atValid = ratValid = netValid = false;
00112 revTopValid = inverting = swapFlag = flag = slewValid = riseSlewValid = fallSlewValid = false;
00113
00114 delay1 = delay2 = 0.0;
00115 riseDelay = fallDelay = 0.0;
00116 isToFF = isFromFF = isFromPI = isToPO = false;
00117 oldRiseSlew = oldFallSlew = 0.0;
00118 multiCycleConstraint = 1;
00119 counter = 0;
00120 lm_old = lm = 0.0;
00121 dpIndex = lmIndex = -1;
00122 dpArr = -DBL_MAX;
00123 index = 0;
00124 clear();
00125 }
00127 ~TPoint() {}
00129
00130 public:
00134 void clear();
00135 void clearSlew();
00137
00138 private:
00140 double load;
00141 double netLoad;
00142 double res;
00143
00144 public:
00145 int multiCycleConstraint;
00146 std::vector<timingData*> multiClockData;
00147 std::string getBlockName(oaOccObject *block);
00148
00150 std::vector<DPData*> pinDPData;
00151 std::map<oaOccInstTerm*,oaString> DPSolutions;
00152 double dpArr;
00153 int dpIndex;
00154
00156 std::vector<lrData> lrDataVec;
00157 int lrDataIndex;
00158 oaString lrSolution;
00159
00160 private:
00162 TimeType riseArr;
00164 TimeType riseReq;
00166 TimeType fallArr;
00168 TimeType fallReq;
00170 DelayType riseSlew;
00172 DelayType fallSlew;
00173
00176 DelayType netDelay;
00177
00179 int index;
00180
00184
00185
00186
00187
00188
00189
00190 public:
00195 TimeType getRiseArr() const {
00196 TimeType ra = ModelType::MAX_TIME();
00197 for (unsigned k = 0; k < multiClockData.size(); ++k) {
00198 timingData *d = multiClockData[k];
00199 if (d->riseArr < ra) {
00200 ra = d->riseArr;
00201 }
00202 }
00203 return ra;
00204 }
00205 TimeType getRiseArr(int i) const { return multiClockData[i]->riseArr; }
00207 TimeType getFallArr() const {
00208 TimeType fa = ModelType::MAX_TIME();
00209 for (unsigned int k = 0; k < multiClockData.size(); ++k) {
00210 timingData *d = multiClockData[k];
00211 if (d->fallArr < fa) {
00212 fa = d->fallArr;
00213 }
00214 }
00215 return fa;
00216 }
00217 TimeType getFallArr(int i) const { return multiClockData[i]->fallArr; }
00220 TimeType getRiseReq() const {
00221 TimeType rr = ModelType::MAX_TIME();
00222 for (unsigned k = 0; k < multiClockData.size(); ++k) {
00223 timingData *d = multiClockData[k];
00224 if (d->riseReq < rr) {
00225 rr = d->riseReq;
00226
00227 }
00228 }
00229 return rr;
00230 }
00231 TimeType getRiseReq(int i) const { return multiClockData[i]->riseReq; }
00234 TimeType getFallReq() const {
00235 TimeType fr = ModelType::MAX_TIME();
00236 for (unsigned int k = 0; k < multiClockData.size(); ++k) {
00237 timingData *d = multiClockData[k];
00238 if (d->fallReq < fr) {
00239 fr = d->fallReq;
00240
00241 }
00242 }
00243 return fr;
00244 }
00245 TimeType getFallReq(int i) const { return multiClockData[i]->fallReq; }
00248 DelayType getRiseSlack() const {
00249
00250 DelayType rs = ModelType::MAX_DELAY();
00251 for (unsigned int k = 0; k < multiClockData.size(); ++k) {
00252 timingData *d = multiClockData[k];
00253 if (d->riseReq == ModelType::MAX_TIME() || d->riseArr == (-ModelType::MAX_TIME())) {
00254 continue;
00255 }
00256 if (d->riseReq - d->riseArr < rs) {
00257 rs = d->riseReq - d->riseArr;
00258 }
00259 }
00260 return rs;
00261
00262 if (riseReq == ModelType::MAX_TIME() || riseArr == -ModelType::MAX_TIME()) {
00263 return ModelType::MAX_DELAY();
00264 }
00265 DelayType t = riseReq - riseArr;
00266
00267 return t;
00268 }
00269
00270 DelayType getRiseSlack(int i) const {
00271 DelayType rs = ModelType::MAX_DELAY();
00272 timingData *d = multiClockData[i];
00273 if (d->riseReq == ModelType::MAX_TIME() || d->riseArr == -ModelType::MAX_TIME()) {
00274 return rs;
00275 }
00276 rs = d->riseReq - d->riseArr;
00277 return rs;
00278 }
00279
00281 DelayType getFallSlack() const {
00282
00283 DelayType fs = ModelType::MAX_DELAY();
00284 for (unsigned int k = 0; k < multiClockData.size(); ++k) {
00285 timingData *d = multiClockData[k];
00286 if (d->fallReq == ModelType::MAX_TIME() || d->fallArr == -ModelType::MAX_TIME()) {
00287 continue;
00288 }
00289 if (d->fallReq - d->fallArr < fs) {
00290 fs = d->fallReq - d->fallArr;
00291 }
00292 }
00293 return fs;
00294
00295 if (fallReq == ModelType::MAX_TIME() || fallArr == -ModelType::MAX_TIME()) {
00296 return ModelType::MAX_DELAY();
00297 }
00298 DelayType t = fallReq - fallArr;
00299
00300 return t;
00301 }
00302
00303 DelayType getFallSlack(int i) const {
00304 DelayType fs = ModelType::MAX_DELAY();
00305 timingData *d = multiClockData[i];
00306 if (d->fallReq == ModelType::MAX_TIME() || d->fallArr == -ModelType::MAX_TIME()) {
00307 return fs;
00308 }
00309 fs = d->fallReq - d->fallArr;
00310 return fs;
00311 }
00312
00314 DelayType getSlack() const {
00315 DelayType t1 = getRiseSlack();
00316 DelayType t2 = getFallSlack();
00317 DelayType r = (t1 < t2) ? t1 : t2;
00318 return r;
00319 }
00324 DelayType getStartingPointSlack() const {
00325 if (type == TIMING_POINT_CLOCK) {
00326 TimeType t1, t2;
00327 if (riseReq == ModelType::MAX_TIME() || riseArr == -ModelType::MAX_TIME()) {
00328 return ModelType::MAX_DELAY();
00329 }
00330 t1 = riseReq;
00331 t2 = fallReq;
00332 DelayType r = (t1 < t2) ? (t1 - ModelType::ZERO_TIME()) : (t2 - ModelType::ZERO_TIME());
00333 return r;
00334 } else {
00335 return getSlack();
00336 }
00337 }
00342 DelayType getEndingPointSlack(DelayType clkPeriod) const {
00343 return getSlack();
00344 if (type == TIMING_POINT_CLOCK) {
00345 DelayType t1;
00346 if (riseReq == ModelType::MAX_TIME() || riseArr == -ModelType::MAX_TIME()) {
00347 return ModelType::MAX_DELAY();
00348 }
00349 t1 = clkPeriod - riseArr;
00350 DelayType t2 = getFallSlack();
00351 DelayType r = (t1 < t2) ? t1 : t2;
00352 return r;
00353 } else {
00354 return getSlack();
00355 }
00356 }
00357
00359 double getLoad() const {
00360 return load;
00361 }
00363 DelayType getRiseSlew() const {
00364 return riseSlew;
00365 }
00366 DelayType getRiseSlew(int i) const {
00367 return multiClockData[i]->riseSlew;
00368 }
00370 DelayType getFallSlew() const {
00371 return fallSlew;
00372 }
00373 DelayType getFallSlew(int i) const {
00374 return multiClockData[i]->fallSlew;
00375 }
00377
00379 bool revTopValid;
00381 bool ratValid;
00383 bool atValid;
00384
00386 bool netValid;
00387
00389 bool isFromPI;
00391 bool isToPO;
00393 bool isFromFF;
00395 bool isToFF;
00396
00398 bool flag;
00399 bool swapFlag;
00400 bool slewValid;
00401 bool riseSlewValid;
00402 bool fallSlewValid;
00403 bool inverting;
00404 DelayType delay1;
00405 DelayType delay2;
00406 DelayType riseDelay;
00407 DelayType fallDelay;
00408 DelayType oldRiseSlew;
00409 DelayType oldFallSlew;
00410
00412 double lm;
00413 double lm_old;
00414 int lmIndex;
00415
00417 timingPointType type;
00418
00423 bool isClock() const {
00424 return type == TIMING_POINT_CLOCK || type == TIMING_POINT_PI_CLOCK;
00425 }
00426
00428 bool isPI() const {
00429 return type == TIMING_POINT_PI;
00430 }
00431
00433 bool isPO() const {
00434 return type == TIMING_POINT_PO;
00435 }
00437
00441 void piDriverForward(TPointMaster *tm, DelayType defaultSlew);
00443
00445
00446 private:
00447
00448 static oaVoidPointerAppDef<oaOccInstTerm> *_instTermAppDef;
00449 static oaVoidPointerAppDef<oaOccTerm> *_termAppDef;
00450 static oaVoidPointerAppDef<oaOccInstTerm> *_clockInstTermAppDef;
00451 static oaVoidPointerAppDef<oaOccTerm> *_clockTermAppDef;
00452
00454 static void initAppDefs();
00455
00456 public:
00467 static TPoint *create(oaOccObject *oPtr);
00468
00479 static TPoint *create(oaOccInstTerm *oPtr);
00480
00491 static TPoint *create(oaOccTerm *oPtr);
00492
00499 static TPoint *get(oaOccObject *oPtr);
00500
00508 static TPoint *getClock(oaOccObject *oPtr);
00509
00514 static void destroy(oaOccObject *oPtr);
00515
00519 void invalidateFanout(oaOccObject *oPtr);
00520
00524 void invalidateFanin(oaOccObject *oPtr);
00525
00529 void invalidateClockFanout(oaOccObject *oPtr);
00530
00534 void invalidateClockFanin(oaOccObject *oPtr);
00535
00536 int counter;
00538
00539 };
00540
00541 }
00542
00543 #endif