diff --git a/include/sta/Sdc.hh b/include/sta/Sdc.hh index 84914596..622ca6b7 100644 --- a/include/sta/Sdc.hh +++ b/include/sta/Sdc.hh @@ -136,15 +136,15 @@ typedef Set InputDelaySet; typedef Map InputDelaysPinMap; typedef Set OutputDelaySet; typedef Map OutputDelaysPinMap; -typedef UnorderedMap PinExceptionsMap; -typedef Map ClockExceptionsMap; -typedef Map InstanceExceptionsMap; -typedef Map NetExceptionsMap; -typedef UnorderedMap PinExceptionsMap; +typedef UnorderedMap ClockExceptionsMap; +typedef UnorderedMap InstanceExceptionsMap; +typedef UnorderedMap NetExceptionsMap; +typedef UnorderedMap EdgeExceptionsMap; typedef Vector ExceptionThruSeq; typedef Map InputDriveMap; -typedef Map > ExceptionPathPtHash; +typedef Map> ExceptionPathPtHash; typedef Set ClockLatencies; typedef Map PinClockUncertaintyMap; typedef Set InterClockUncertaintySet; @@ -1018,7 +1018,7 @@ public: const PinSet &pathDelayInternalFrom() const; bool isPathDelayInternalTo(const Pin *pin) const; bool isPathDelayInternalToBreak(const Pin *pin) const; - ExceptionPathSet *exceptions() { return &exceptions_; } + ExceptionPathSet &exceptions() { return exceptions_; } void deleteExceptions(); void deleteException(ExceptionPath *exception); void recordException(ExceptionPath *exception); @@ -1043,7 +1043,6 @@ protected: void removeLibertyAnnotations(); void deleteExceptionsReferencing(Clock *clk); void deleteClkPinMappings(Clock *clk); - void deleteExceptionPtHashMapSets(ExceptionPathPtHash &map); void makeClkPinMappings(Clock *clk); void deletePinClocks(Clock *defining_clk, PinSet *pins); diff --git a/include/sta/SdcClass.hh b/include/sta/SdcClass.hh index a6a5a49a..cb5e6712 100644 --- a/include/sta/SdcClass.hh +++ b/include/sta/SdcClass.hh @@ -95,7 +95,7 @@ typedef Set LibertyPortPairSet; typedef Map DisabledInstancePortsMap; typedef Map DisabledCellPortsMap; typedef MinMaxValues ClockUncertainties; -typedef Set ExceptionPathSet; +typedef std::set ExceptionPathSet; typedef PinPair EdgePins; typedef PinPairSet EdgePinsSet; typedef Map LogicValueMap; diff --git a/sdc/Sdc.cc b/sdc/Sdc.cc index b10a7add..d44979a9 100644 --- a/sdc/Sdc.cc +++ b/sdc/Sdc.cc @@ -3957,13 +3957,29 @@ Sdc::unrecordPathDelayInternalFrom(ExceptionPath *exception) } } +template +const ExceptionPathSet * +findExceptions(const UnorderedMap &map, + const OBJ *obj) +{ + const auto itr = map.find(obj); + if (itr != map.end()) + return &itr->second; + else + return nullptr; +} + bool Sdc::pathDelayFrom(const Pin *pin) { - ExceptionPathSet *exceptions = first_from_pin_exceptions_.findKey(pin); - for (ExceptionPath *exception : *exceptions) { - if (exception->isPathDelay()) - return true; + + const ExceptionPathSet *exceptions = + findExceptions(first_from_pin_exceptions_, pin); + if (exceptions) { + for (ExceptionPath *exception : *exceptions) { + if (exception->isPathDelay()) + return true; + } } return false; } @@ -4042,10 +4058,13 @@ Sdc::hasLibertyCheckTo(const Pin *pin) bool Sdc::pathDelayTo(const Pin *pin) { - ExceptionPathSet *exceptions = first_to_pin_exceptions_.findKey(pin); - for (ExceptionPath *exception : *exceptions) { - if (exception->isPathDelay()) - return true; + const ExceptionPathSet *exceptions = + findExceptions(first_to_pin_exceptions_, pin); + if (exceptions) { + for (ExceptionPath *exception : *exceptions) { + if (exception->isPathDelay()) + return true; + } } return false; } @@ -4210,11 +4229,14 @@ void Sdc::deleteLoopExceptions() { // erase prevents range iteration. - ExceptionPathSet::Iterator except_iter(exceptions_); - while (except_iter.hasNext()) { - ExceptionPath *except = except_iter.next(); - if (except->isLoop()) - deleteException(except); + for (auto itr = exceptions_.begin(); itr != exceptions_.end(); ) { + ExceptionPath *except = *itr; + if (except->isLoop()) { + itr = exceptions_.erase(itr); + deleteException(except); + } + else + itr++; } } @@ -4420,10 +4442,10 @@ Sdc::findMatchingExceptionsFirstThru(ExceptionPath *exception, for (const Net *net : *thru->nets()) { // Potential matches includes exceptions that match net that are not // the first exception point. - ExceptionPathSet *potential_matches = - first_thru_net_exceptions_.findKey(net); + const ExceptionPathSet *potential_matches = + findExceptions(first_thru_net_exceptions_, net); if (potential_matches) { - for (ExceptionPath *match : *potential_matches) { + for (ExceptionPath *match : *potential_matches) { ExceptionThru *match_thru = (*match->thrus())[0]; if (match_thru->nets()->hasKey(net) && match->overrides(exception) @@ -4457,8 +4479,11 @@ Sdc::findMatchingExceptionsClks(ExceptionPath *exception, { if (clks) { ExceptionPathSet clks_matches; - for (Clock *clk : *clks) - clks_matches.insertSet(exception_map.findKey(clk)); + for (Clock *clk : *clks) { + auto itr = exception_map.find(clk); + if (itr != exception_map.end()) + clks_matches.insert(itr->second.begin(), itr->second.end()); + } findMatchingExceptions(exception, &clks_matches, matches); } } @@ -4471,8 +4496,11 @@ Sdc::findMatchingExceptionsPins(ExceptionPath *exception, { if (pins) { ExceptionPathSet pins_matches; - for (const Pin *pin : *pins) - pins_matches.insertSet(exception_map.findKey(pin)); + for (const Pin *pin : *pins) { + auto itr = exception_map.find(pin); + if (itr != exception_map.end()) + pins_matches.insert(itr->second.begin(), itr->second.end()); + } findMatchingExceptions(exception, &pins_matches, matches); } } @@ -4484,10 +4512,13 @@ Sdc::findMatchingExceptionsInsts(ExceptionPath *exception, ExceptionPathSet &matches) { if (insts) { - ExceptionPathSet insts_matches; - for (const Instance *inst : *insts) - insts_matches.insertSet(exception_map.findKey(inst)); - findMatchingExceptions(exception, &insts_matches, matches); + ExceptionPathSet inst_matches; + for (const Instance *inst : *insts) { + auto itr = exception_map.find(inst); + if (itr != exception_map.end()) + inst_matches.insert(itr->second.begin(), itr->second.end()); + } + findMatchingExceptions(exception, &inst_matches, matches); } } @@ -4639,12 +4670,8 @@ Sdc::recordMergeHash(ExceptionPath *exception, hash, exception->asString(network_), missing_pt->asString(network_)); - ExceptionPathSet *set = exception_merge_hash_.findKey(hash); - if (set == nullptr) { - set = new ExceptionPathSet; - exception_merge_hash_[hash] = set; - } - set->insert(exception); + ExceptionPathSet &set = exception_merge_hash_[hash]; + set.insert(exception); } // Record a mapping from first pin/clock/instance's to a set of exceptions. @@ -4716,12 +4743,8 @@ Sdc::recordExceptionClks(ExceptionPath *exception, { if (clks) { for (Clock *clk : *clks) { - ExceptionPathSet *set = exception_map.findKey(clk); - if (set == nullptr) { - set = new ExceptionPathSet; - exception_map[clk] = set; - } - set->insert(exception); + ExceptionPathSet &set = exception_map[clk]; + set.insert(exception); } } } @@ -4733,12 +4756,8 @@ Sdc::recordExceptionEdges(ExceptionPath *exception, { if (edges) { for (const EdgePins &edge : *edges) { - ExceptionPathSet *set = exception_map.findKey(edge); - if (set == nullptr) { - set = new ExceptionPathSet; - exception_map.insert(edge, set); - } - set->insert(exception); + ExceptionPathSet &set = exception_map[edge]; + set.insert(exception); } } } @@ -4750,12 +4769,8 @@ Sdc::recordExceptionPins(ExceptionPath *exception, { if (pins) { for (const Pin *pin : *pins) { - ExceptionPathSet *set = exception_map.findKey(pin); - if (set == nullptr) { - set = new ExceptionPathSet; - exception_map.insert(pin, set); - } - set->insert(exception); + ExceptionPathSet &set = exception_map[pin]; + set.insert(exception); } } } @@ -4765,12 +4780,8 @@ Sdc::recordExceptionHpin(ExceptionPath *exception, Pin *pin, PinExceptionsMap &exception_map) { - ExceptionPathSet *set = exception_map.findKey(pin); - if (set == nullptr) { - set = new ExceptionPathSet; - exception_map.insert(pin, set); - } - set->insert(exception); + ExceptionPathSet &set = exception_map[pin]; + set.insert(exception); } void @@ -4780,12 +4791,8 @@ Sdc::recordExceptionInsts(ExceptionPath *exception, { if (insts) { for (const Instance *inst : *insts) { - ExceptionPathSet *set = exception_map.findKey(inst); - if (set == nullptr) { - set = new ExceptionPathSet; - exception_map[inst] = set; - } - set->insert(exception); + ExceptionPathSet &set = exception_map[inst]; + set.insert(exception); } } } @@ -4797,12 +4804,8 @@ Sdc::recordExceptionNets(ExceptionPath *exception, { if (nets) { for (const Net *net : *nets) { - ExceptionPathSet *set = exception_map.findKey(net); - if (set == nullptr) { - set = new ExceptionPathSet; - exception_map[net] = set; - } - set->insert(exception); + ExceptionPathSet &set = exception_map[net]; + set.insert(exception); } } } @@ -4836,9 +4839,10 @@ Sdc::findMergeMatch(ExceptionPath *exception) while (missing_pt_iter.hasNext()) { ExceptionPt *missing_pt = missing_pt_iter.next(); size_t hash = exception->hash(missing_pt); - ExceptionPathSet *matches = exception_merge_hash_.findKey(hash); - if (matches) { - for (ExceptionPath *match : *matches) { + auto itr = exception_merge_hash_.find(hash); + if (itr != exception_merge_hash_.end()) { + ExceptionPathSet &matches = itr->second; + for (ExceptionPath *match : matches) { ExceptionPt *match_missing_pt; if (match != exception // Exceptions are not merged if their priorities are @@ -4876,59 +4880,52 @@ Sdc::findMergeMatch(ExceptionPath *exception) void Sdc::deleteExceptions() { - exceptions_.deleteContentsClear(); + exceptions_.clear(); exception_id_ = 0; - first_from_pin_exceptions_.deleteContentsClear(); - first_from_clk_exceptions_.deleteContentsClear(); - first_from_inst_exceptions_.deleteContentsClear(); - first_to_pin_exceptions_.deleteContentsClear(); - first_to_clk_exceptions_.deleteContentsClear(); - first_to_inst_exceptions_.deleteContentsClear(); - first_thru_pin_exceptions_.deleteContentsClear(); - first_thru_inst_exceptions_.deleteContentsClear(); - first_thru_net_exceptions_.deleteContentsClear(); - first_thru_edge_exceptions_.deleteContentsClear(); + first_from_pin_exceptions_.clear(); + first_from_clk_exceptions_.clear(); + first_from_inst_exceptions_.clear(); + first_to_pin_exceptions_.clear(); + first_to_clk_exceptions_.clear(); + first_to_inst_exceptions_.clear(); + first_thru_pin_exceptions_.clear(); + first_thru_inst_exceptions_.clear(); + first_thru_net_exceptions_.clear(); + first_thru_edge_exceptions_.clear(); first_thru_edge_exceptions_.clear(); path_delay_internal_from_.clear(); path_delay_internal_from_break_.clear(); path_delay_internal_to_.clear(); path_delay_internal_to_break_.clear(); - pin_exceptions_.deleteContentsClear(); + pin_exceptions_.clear(); - deleteExceptionPtHashMapSets(exception_merge_hash_); + exception_merge_hash_.clear(); exception_merge_hash_.clear(); have_thru_hpin_exceptions_ = false; } -void -Sdc::deleteExceptionPtHashMapSets(ExceptionPathPtHash &map) -{ - map.deleteContents(); -} - //////////////////////////////////////////////////////////////// void Sdc::deleteExceptionsReferencing(Clock *clk) { // erase prevents range iteration. - ExceptionPathSet::ConstIterator exception_iter(exceptions_); - while (exception_iter.hasNext()) { - ExceptionPath *exception = exception_iter.next(); + for (auto itr = exceptions_.begin(); itr != exceptions_.end(); ) { + ExceptionPath *exception = *itr; bool deleted = false; ExceptionFrom *from = exception->from(); if (from) { ClockSet *clks = from->clks(); if (clks && clks->hasKey(clk)) { + itr = exceptions_.erase(itr); unrecordException(exception); + deleted = true; from->deleteClock(clk); if (from->hasObjects()) recordException(exception); - else { + else deleteException(exception); - deleted = true; - } } } @@ -4937,6 +4934,8 @@ Sdc::deleteExceptionsReferencing(Clock *clk) if (to) { ClockSet *clks = to->clks(); if (clks && clks->hasKey(clk)) { + itr = exceptions_.erase(itr); + deleted = true; unrecordException(exception); to->deleteClock(clk); if (to->hasObjects()) @@ -4946,6 +4945,8 @@ Sdc::deleteExceptionsReferencing(Clock *clk) } } } + if (!deleted) + itr++; } } @@ -4986,9 +4987,11 @@ Sdc::unrecordMergeHash(ExceptionPath *exception, hash, exception->asString(network_), missing_pt->asString(network_)); - ExceptionPathSet *matches = exception_merge_hash_.findKey(hash); - if (matches) - matches->erase(exception); + auto itr = exception_merge_hash_.find(hash); + if (itr != exception_merge_hash_.end()) { + ExceptionPathSet &matches = itr->second; + matches.erase(exception); + } } void @@ -5026,9 +5029,11 @@ Sdc::unrecordExceptionClks(ExceptionPath *exception, { if (clks) { for (Clock *clk : *clks) { - ExceptionPathSet *set = exception_map.findKey(clk); - if (set) - set->erase(exception); + auto itr = exception_map.find(clk); + if (itr != exception_map.end()) { + ExceptionPathSet &set = itr->second; + set.erase(exception); + } } } } @@ -5040,9 +5045,11 @@ Sdc::unrecordExceptionPins(ExceptionPath *exception, { if (pins) { for (const Pin *pin : *pins) { - ExceptionPathSet *set = exception_map.findKey(pin); - if (set) - set->erase(exception); + auto itr = exception_map.find(pin); + if (itr != exception_map.end()) { + ExceptionPathSet &set = itr->second; + set.erase(exception); + } } } } @@ -5054,9 +5061,11 @@ Sdc::unrecordExceptionInsts(ExceptionPath *exception, { if (insts) { for (const Instance *inst : *insts) { - ExceptionPathSet *set = exception_map.findKey(inst); - if (set) - set->erase(exception); + auto itr = exception_map.find(inst); + if (itr != exception_map.end()) { + ExceptionPathSet &set = itr->second; + set.erase(exception); + } } } } @@ -5068,9 +5077,11 @@ Sdc::unrecordExceptionEdges(ExceptionPath *exception, { if (edges) { for (const EdgePins &edge : *edges) { - ExceptionPathSet *set = exception_map.findKey(edge); - if (set) - set->erase(exception); + auto itr = exception_map.find(edge); + if (itr != exception_map.end()) { + ExceptionPathSet &set = itr->second; + set.erase(exception); + } } } } @@ -5082,9 +5093,11 @@ Sdc::unrecordExceptionNets(ExceptionPath *exception, { if (nets) { for (const Net *net : *nets) { - ExceptionPathSet *set = exception_map.findKey(net); - if (set) - set->erase(exception); + auto itr = exception_map.find(net); + if (itr != exception_map.end()) { + ExceptionPathSet &set = itr->second; + set.erase(exception); + } } } } @@ -5094,9 +5107,11 @@ Sdc::unrecordExceptionHpin(ExceptionPath *exception, Pin *pin, PinExceptionsMap &exception_map) { - ExceptionPathSet *set = exception_map.findKey(pin); - if (set) - set->erase(exception); + auto itr = exception_map.find(pin); + if (itr != exception_map.end()) { + ExceptionPathSet &set = itr->second; + set.erase(exception); + } } //////////////////////////////////////////////////////////////// @@ -5166,18 +5181,18 @@ Sdc::resetPath(ExceptionFrom *from, const MinMaxAll *min_max) { checkFromThrusTo(from, thrus, to); - ExceptionPathSet::Iterator except_iter(exceptions_); - while (except_iter.hasNext()) { - ExceptionPath *match = except_iter.next(); + // erase prevents range iteration. + for (auto itr = exceptions_.begin(); itr != exceptions_.end(); ) { + ExceptionPath *match = *itr; if (match->resetMatch(from, thrus, to, min_max, network_)) { debugPrint(debug_, "exception_match", 3, "reset match %s", match->asString(network_)); ExceptionPathSet expansions; expandException(match, expansions); + itr = exceptions_.erase(itr); deleteException(match); - ExceptionPathSet::Iterator expand_iter(expansions); - while (expand_iter.hasNext()) { - ExceptionPath *expand = expand_iter.next(); + + for (ExceptionPath *expand : expansions) { if (expand->resetMatch(from, thrus, to, min_max, network_)) { unrecordPathDelayInternalFrom(expand); unrecordPathDelayInternalTo(expand); @@ -5187,6 +5202,8 @@ Sdc::resetPath(ExceptionFrom *from, addException(expand); } } + else + itr++; } } @@ -5214,33 +5231,38 @@ Sdc::exceptionFromStates(const Pin *pin, { bool srch_from = true; if (pin) { - if (srch_from && !first_from_pin_exceptions_.empty()) - srch_from &= exceptionFromStates(first_from_pin_exceptions_.findKey(pin), - pin, rf, min_max, include_filter, - states); - if (srch_from && !first_thru_pin_exceptions_.empty()) - srch_from &= exceptionFromStates(first_thru_pin_exceptions_.findKey(pin), - pin, rf, min_max, include_filter, - states); - + if (srch_from) { + const ExceptionPathSet *exceptions = + findExceptions(first_from_pin_exceptions_, pin); + srch_from &= exceptionFromStates(exceptions, pin, rf, min_max, + include_filter, states); + } + if (srch_from) { + const ExceptionPathSet *exceptions = + findExceptions(first_thru_pin_exceptions_, pin); + srch_from &= exceptionFromStates(exceptions, pin, rf, min_max, + include_filter, states); + } if (srch_from && (!first_from_inst_exceptions_.empty() || !first_thru_inst_exceptions_.empty())) { Instance *inst = network_->instance(pin); - if (srch_from && !first_from_inst_exceptions_.empty()) - srch_from &= exceptionFromStates(first_from_inst_exceptions_.findKey(inst), - pin, rf, min_max, include_filter, - states); - if (srch_from && !first_thru_inst_exceptions_.empty()) - srch_from &= exceptionFromStates(first_thru_inst_exceptions_.findKey(inst), - pin, rf, min_max, include_filter, - states); + const ExceptionPathSet *exceptions = + findExceptions(first_from_inst_exceptions_, inst); + srch_from &= exceptionFromStates(exceptions, pin, rf, min_max, + include_filter, states); + const ExceptionPathSet *exceptions2 = + findExceptions(first_thru_inst_exceptions_, inst); + srch_from &= exceptionFromStates(exceptions2, pin, rf, min_max, + include_filter, states); } } - if (srch_from && clk && !first_from_clk_exceptions_.empty()) - srch_from &= exceptionFromStates(first_from_clk_exceptions_.findKey(clk), - pin, clk_rf, min_max, include_filter, - states); + if (srch_from && clk) { + const ExceptionPathSet *exceptions = + findExceptions(first_from_clk_exceptions_, clk); + srch_from &= exceptionFromStates(exceptions, pin, clk_rf, min_max, + include_filter, states); + } if (!srch_from) { delete states; states = nullptr; @@ -5299,20 +5321,22 @@ Sdc::exceptionFromClkStates(const Pin *pin, ExceptionStateSet *&states) const { if (pin) { - if (!first_from_pin_exceptions_.empty()) - exceptionFromStates(first_from_pin_exceptions_.findKey(pin), - nullptr, rf, min_max, true, states); + const ExceptionPathSet *exceptions = + findExceptions(first_from_pin_exceptions_, pin); + exceptionFromStates(exceptions, nullptr, rf, min_max, true, states); if (!first_from_inst_exceptions_.empty()) { Instance *inst = network_->instance(pin); - exceptionFromStates(first_from_inst_exceptions_.findKey(inst), - pin, rf, min_max, true, states); + const ExceptionPathSet *exceptions = + findExceptions(first_from_inst_exceptions_, inst); + exceptionFromStates(exceptions, pin, rf, min_max, true, states); } - exceptionThruStates(first_thru_pin_exceptions_.findKey(pin), - rf, min_max, states); + const ExceptionPathSet *exceptions2 = + findExceptions(first_thru_pin_exceptions_, pin); + exceptionThruStates(exceptions2, rf, min_max, states); } - if (!first_from_clk_exceptions_.empty()) - exceptionFromStates(first_from_clk_exceptions_.findKey(clk), - pin, clk_rf, min_max, true, states); + const ExceptionPathSet *exceptions = + findExceptions(first_from_clk_exceptions_, clk); + exceptionFromStates(exceptions, pin, clk_rf, min_max, true, states); } void @@ -5322,10 +5346,10 @@ Sdc::filterRegQStates(const Pin *to_pin, ExceptionStateSet *&states) const { if (!first_from_pin_exceptions_.empty()) { - const ExceptionPathSet *exceptions = - first_from_pin_exceptions_.findKey(to_pin); - if (exceptions) { - for (ExceptionPath *exception : *exceptions) { + auto itr = first_from_pin_exceptions_.find(to_pin); + if (itr != first_from_pin_exceptions_.end()) { + const ExceptionPathSet &exceptions = itr->second; + for (ExceptionPath *exception : exceptions) { // Hack for filter -from reg/Q. if (exception->isFilter() && exception->matchesFirstPt(to_rf, min_max)) { @@ -5346,19 +5370,25 @@ Sdc::exceptionThruStates(const Pin *from_pin, const MinMax *min_max, ExceptionStateSet *&states) const { - exceptionThruStates(first_thru_pin_exceptions_.findKey(to_pin), - to_rf, min_max, states); + const ExceptionPathSet *exceptions = + findExceptions(first_thru_pin_exceptions_, to_pin); + exceptionThruStates(exceptions, to_rf, min_max, states); + if (!first_thru_edge_exceptions_.empty()) { EdgePins edge_pins(from_pin, to_pin); - exceptionThruStates(first_thru_edge_exceptions_.findKey(edge_pins), - to_rf, min_max, states); + auto itr = first_thru_edge_exceptions_.find(edge_pins); + if (itr != first_thru_edge_exceptions_.end()) { + const ExceptionPathSet *exceptions = &itr->second; + exceptionThruStates(exceptions, to_rf, min_max, states); + } } if (!first_thru_inst_exceptions_.empty() && (network_->direction(to_pin)->isAnyOutput() || network_->isLatchData(to_pin))) { const Instance *to_inst = network_->instance(to_pin); - exceptionThruStates(first_thru_inst_exceptions_.findKey(to_inst), - to_rf, min_max, states); + const ExceptionPathSet *exceptions = + findExceptions(first_thru_inst_exceptions_, to_inst); + exceptionThruStates(exceptions, to_rf, min_max, states); } } @@ -5396,18 +5426,26 @@ Sdc::exceptionTo(ExceptionPathType type, { if (!first_to_inst_exceptions_.empty()) { Instance *inst = network_->instance(pin); - exceptionTo(first_to_inst_exceptions_.findKey(inst), type, pin, rf, + const ExceptionPathSet *exceptions = + findExceptions(first_to_inst_exceptions_, inst); + exceptionTo(exceptions, type, pin, rf, clk_edge, min_max, match_min_max_exactly, hi_priority_exception, hi_priority); } - if (!first_to_pin_exceptions_.empty()) - exceptionTo(first_to_pin_exceptions_.findKey(pin), type, pin, rf, + if (!first_to_pin_exceptions_.empty()) { + const ExceptionPathSet *exceptions = + findExceptions(first_to_pin_exceptions_, pin); + exceptionTo(exceptions, type, pin, rf, clk_edge, min_max, match_min_max_exactly, hi_priority_exception, hi_priority); - if (clk_edge && !first_to_clk_exceptions_.empty()) - exceptionTo(first_to_clk_exceptions_.findKey(clk_edge->clock()), - type, pin, rf, clk_edge, min_max, match_min_max_exactly, + } + if (clk_edge && !first_to_clk_exceptions_.empty()) { + const ExceptionPathSet *exceptions = + findExceptions(first_to_clk_exceptions_, clk_edge->clock()); + exceptionTo(exceptions, type, pin, rf, clk_edge, + min_max, match_min_max_exactly, hi_priority_exception, hi_priority); + } } void @@ -5515,15 +5553,20 @@ Sdc::groupPathsTo(const Pin *pin, { if (!first_to_inst_exceptions_.empty()) { Instance *inst = network_->instance(pin); - groupPathsTo(first_to_inst_exceptions_.findKey(inst), pin, rf, - clk_edge, min_max, group_paths); + const ExceptionPathSet *exceptions = + findExceptions(first_to_inst_exceptions_, inst); + groupPathsTo(exceptions, pin, rf, clk_edge, min_max, group_paths); + } + if (!first_to_pin_exceptions_.empty()) { + const ExceptionPathSet *exceptions = + findExceptions(first_to_pin_exceptions_, pin); + groupPathsTo(exceptions, pin, rf, clk_edge, min_max, group_paths); + } + if (clk_edge && !first_to_clk_exceptions_.empty()) { + const ExceptionPathSet *exceptions = + findExceptions(first_to_clk_exceptions_, clk_edge->clock()); + groupPathsTo(exceptions, pin, rf, clk_edge, min_max, group_paths); } - if (!first_to_pin_exceptions_.empty()) - groupPathsTo(first_to_pin_exceptions_.findKey(pin), pin, rf, - clk_edge, min_max, group_paths); - if (clk_edge && !first_to_clk_exceptions_.empty()) - groupPathsTo(first_to_clk_exceptions_.findKey(clk_edge->clock()), - pin, rf, clk_edge, min_max, group_paths); } void @@ -5627,7 +5670,7 @@ Sdc::disconnectPinBefore(const Pin *pin) { auto itr = pin_exceptions_.find(pin); if (itr != pin_exceptions_.end()) { - for (ExceptionPath *exception : *itr->second) { + for (ExceptionPath *exception : itr->second) { ExceptionFrom *from = exception->from(); if (from) from->disconnectPinBefore(pin, network_); diff --git a/sdc/WriteSdc.cc b/sdc/WriteSdc.cc index 5c448a8c..32c2450c 100644 --- a/sdc/WriteSdc.cc +++ b/sdc/WriteSdc.cc @@ -1196,7 +1196,7 @@ void WriteSdc::writeExceptions() const { ExceptionPathSeq exceptions; - for (ExceptionPath *exception : *sdc_->exceptions()) + for (ExceptionPath *exception : sdc_->exceptions()) exceptions.push_back(exception); sort(exceptions, ExceptionPathLess(network_)); for (ExceptionPath *exception : exceptions) { diff --git a/search/CheckTiming.cc b/search/CheckTiming.cc index 4ff5ee24..76e11698 100644 --- a/search/CheckTiming.cc +++ b/search/CheckTiming.cc @@ -273,10 +273,7 @@ CheckTiming::hasClkedDepature(Pin *pin) bool CheckTiming::hasMaxDelay(Pin *pin) { - ExceptionPathSet *exceptions = sdc_->exceptions(); - ExceptionPathSet::Iterator exception_iter(exceptions); - while (exception_iter.hasNext()) { - ExceptionPath *exception = exception_iter.next(); + for (ExceptionPath *exception : sdc_->exceptions()) { ExceptionTo *to = exception->to(); if (exception->isPathDelay() && exception->minMax() == MinMaxAll::max()