diff --git a/include/sta/ExceptionPath.hh b/include/sta/ExceptionPath.hh index 92e8c47a..c50b5c82 100644 --- a/include/sta/ExceptionPath.hh +++ b/include/sta/ExceptionPath.hh @@ -49,6 +49,8 @@ public: int priority, const char *comment); virtual ~ExceptionPath(); + size_t id() const { return id_; } + void setId(size_t id); virtual bool isFalse() const { return false; } virtual bool isLoop() const { return false; } virtual bool isMultiCycle() const { return false; } @@ -128,6 +130,7 @@ protected: const MinMaxAll *min_max_; bool own_pts_; int priority_; + size_t id_; // Unique ID assigned by Sdc. ExceptionState *states_; }; diff --git a/include/sta/Sdc.hh b/include/sta/Sdc.hh index 945093ee..7f9198ad 100644 --- a/include/sta/Sdc.hh +++ b/include/sta/Sdc.hh @@ -1369,6 +1369,7 @@ protected: InstanceSet disabled_clk_gating_checks_inst_; PinSet disabled_clk_gating_checks_pin_; ExceptionPathSet exceptions_; + size_t exception_id_; // Unique ID for exceptions. bool have_thru_hpin_exceptions_; // First pin/clock/instance/net/edge exception point to exception set map. diff --git a/include/sta/SdcClass.hh b/include/sta/SdcClass.hh index 8b30dca4..68f1ef14 100644 --- a/include/sta/SdcClass.hh +++ b/include/sta/SdcClass.hh @@ -107,12 +107,8 @@ class ExceptionState; class ExceptionStateLess { public: - ExceptionStateLess(const Network *network); bool operator()(const ExceptionState *state1, const ExceptionState *state2) const; - -private: - const Network *network_; }; class ExceptionPath; diff --git a/sdc/ExceptionPath.cc b/sdc/ExceptionPath.cc index 204a75a3..b04fb5a8 100644 --- a/sdc/ExceptionPath.cc +++ b/sdc/ExceptionPath.cc @@ -90,7 +90,8 @@ ExceptionPath::ExceptionPath(ExceptionFrom *from, to_(to), min_max_(min_max), own_pts_(own_pts), - priority_(priority) + priority_(priority), + id_(0) { makeStates(); } @@ -125,6 +126,12 @@ ExceptionPath::asString(const Network *network) const return result; } +void +ExceptionPath::setId(size_t id) +{ + id_ = id; +} + ExceptionPt * ExceptionPath::firstPt() { @@ -2247,19 +2254,14 @@ ExceptionState::hash() const return hashSum(exception_->hash(), index_); } -ExceptionStateLess::ExceptionStateLess(const Network *network) : - network_(network) -{ -} - bool ExceptionStateLess::operator()(const ExceptionState *state1, const ExceptionState *state2) const { const ExceptionPath *except1 = state1->exception(); const ExceptionPath *except2 = state2->exception(); - ExceptionPathLess except_less(network_); - return except_less(except1, except2) + return except1->id() < except2->id() + //return except1 < except2 || (except1 == except2 && state1->index() < state2->index()); } diff --git a/sdc/Sdc.cc b/sdc/Sdc.cc index fefbec01..7925f048 100644 --- a/sdc/Sdc.cc +++ b/sdc/Sdc.cc @@ -110,6 +110,7 @@ Sdc::Sdc(StaState *sta) : disabled_wire_edges_(network_), disabled_clk_gating_checks_inst_(network_), disabled_clk_gating_checks_pin_(network_), + exception_id_(0), have_thru_hpin_exceptions_(false), first_thru_edge_exceptions_(0, PinPairHash(network_), PinPairEqual()), path_delay_internal_startpoints_(network_), @@ -4552,6 +4553,7 @@ void Sdc::recordException(ExceptionPath *exception) { exceptions_.insert(exception); + exception->setId(++exception_id_); recordMergeHashes(exception); recordExceptionFirstPts(exception); checkForThruHpins(exception); @@ -4813,6 +4815,7 @@ void Sdc::deleteExceptions() { exceptions_.deleteContentsClear(); + exception_id_ = 0; first_from_pin_exceptions_.deleteContentsClear(); first_from_clk_exceptions_.deleteContentsClear(); @@ -5203,7 +5206,7 @@ Sdc::exceptionFromStates(const ExceptionPathSet *exceptions, // but flush all other exception states because they are lower // priority. if (states == nullptr) - states = new ExceptionStateSet(network_); + states = new ExceptionStateSet(); states->clear(); states->insert(state); // No need to examine other exceptions from this @@ -5211,7 +5214,7 @@ Sdc::exceptionFromStates(const ExceptionPathSet *exceptions, return false; } if (states == nullptr) - states = new ExceptionStateSet(network_); + states = new ExceptionStateSet(); states->insert(state); } } @@ -5258,7 +5261,7 @@ Sdc::filterRegQStates(const Pin *to_pin, && exception->matchesFirstPt(to_rf, min_max)) { ExceptionState *state = exception->firstState(); if (states == nullptr) - states = new ExceptionStateSet(network_); + states = new ExceptionStateSet(); states->insert(state); } } @@ -5302,7 +5305,7 @@ Sdc::exceptionThruStates(const ExceptionPathSet *exceptions, if (exception->matchesFirstPt(to_rf, min_max)) { ExceptionState *state = exception->firstState(); if (states == nullptr) - states = new ExceptionStateSet(network_); + states = new ExceptionStateSet(); states->insert(state); } } diff --git a/search/Genclks.cc b/search/Genclks.cc index 1066df86..7d264770 100644 --- a/search/Genclks.cc +++ b/search/Genclks.cc @@ -703,7 +703,7 @@ Genclks::makeTag(const Clock *gclk, // from the get go. if (master_pin == gclk->srcPin()) state = state->nextState(); - ExceptionStateSet *states = new ExceptionStateSet(network_); + ExceptionStateSet *states = new ExceptionStateSet(); states->insert(state); ClkInfo *clk_info = search_->findClkInfo(master_clk->edge(master_rf), master_pin, true, nullptr, true, diff --git a/search/PathVertex.cc b/search/PathVertex.cc index 85b0f186..799a9715 100644 --- a/search/PathVertex.cc +++ b/search/PathVertex.cc @@ -428,7 +428,7 @@ PrevPathVisitor::unfilteredTag(const Tag *tag) const ExceptionPath *except = state->exception(); if (!except->isFilter()) { if (unfiltered_states == nullptr) - unfiltered_states = new ExceptionStateSet(network_); + unfiltered_states = new ExceptionStateSet(); unfiltered_states->insert(state); } } diff --git a/search/Search.cc b/search/Search.cc index 350084f2..48a4956f 100644 --- a/search/Search.cc +++ b/search/Search.cc @@ -2563,7 +2563,7 @@ Search::mutateTag(Tag *from_tag, // Second pass to apply state changes and add updated existing // states to new states. if (new_states == nullptr) - new_states = new ExceptionStateSet(network_); + new_states = new ExceptionStateSet(); for (auto state : *from_states) { ExceptionPath *exception = state->exception(); // One edge may traverse multiple hierarchical thru pins.