sdc ExceptionPathSet*->ExceptionPathSet

commit 277de17b34f4b36b9c889f883872c604b39a7558
Author: James Cherry <cherry@parallaxsw.com>
Date:   Sat Nov 8 12:53:22 2025 -0700

    ExceptionPathSet Set -> std::set

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit ce9afb6d29a5532b9b5fdadcdaf48aeaf1ba9c99
Author: James Cherry <cherry@parallaxsw.com>
Date:   Sat Nov 8 12:17:01 2025 -0700

    ExceptionPathSet*->ExceptionPathSet

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2025-11-08 13:38:07 -07:00
parent 8287aec5f6
commit 82a37d0777
5 changed files with 230 additions and 191 deletions

View File

@ -136,15 +136,15 @@ typedef Set<InputDelay*> InputDelaySet;
typedef Map<const Pin*, InputDelaySet*, PinIdLess> InputDelaysPinMap; typedef Map<const Pin*, InputDelaySet*, PinIdLess> InputDelaysPinMap;
typedef Set<OutputDelay*> OutputDelaySet; typedef Set<OutputDelay*> OutputDelaySet;
typedef Map<const Pin*,OutputDelaySet*, PinIdLess> OutputDelaysPinMap; typedef Map<const Pin*,OutputDelaySet*, PinIdLess> OutputDelaysPinMap;
typedef UnorderedMap<const Pin*,ExceptionPathSet*> PinExceptionsMap; typedef UnorderedMap<const Pin*,ExceptionPathSet> PinExceptionsMap;
typedef Map<const Clock*,ExceptionPathSet*> ClockExceptionsMap; typedef UnorderedMap<const Clock*,ExceptionPathSet> ClockExceptionsMap;
typedef Map<const Instance*,ExceptionPathSet*> InstanceExceptionsMap; typedef UnorderedMap<const Instance*,ExceptionPathSet> InstanceExceptionsMap;
typedef Map<const Net*,ExceptionPathSet*> NetExceptionsMap; typedef UnorderedMap<const Net*,ExceptionPathSet> NetExceptionsMap;
typedef UnorderedMap<EdgePins, ExceptionPathSet*, typedef UnorderedMap<EdgePins, ExceptionPathSet,
PinPairHash, PinPairEqual> EdgeExceptionsMap; PinPairHash, PinPairEqual> EdgeExceptionsMap;
typedef Vector<ExceptionThru*> ExceptionThruSeq; typedef Vector<ExceptionThru*> ExceptionThruSeq;
typedef Map<const Port*,InputDrive*> InputDriveMap; typedef Map<const Port*,InputDrive*> InputDriveMap;
typedef Map<size_t, ExceptionPathSet*, std::less<size_t> > ExceptionPathPtHash; typedef Map<size_t, ExceptionPathSet, std::less<size_t>> ExceptionPathPtHash;
typedef Set<ClockLatency*, ClockLatencyLess> ClockLatencies; typedef Set<ClockLatency*, ClockLatencyLess> ClockLatencies;
typedef Map<const Pin*, ClockUncertainties*> PinClockUncertaintyMap; typedef Map<const Pin*, ClockUncertainties*> PinClockUncertaintyMap;
typedef Set<InterClockUncertainty*, InterClockUncertaintyLess> InterClockUncertaintySet; typedef Set<InterClockUncertainty*, InterClockUncertaintyLess> InterClockUncertaintySet;
@ -1018,7 +1018,7 @@ public:
const PinSet &pathDelayInternalFrom() const; const PinSet &pathDelayInternalFrom() const;
bool isPathDelayInternalTo(const Pin *pin) const; bool isPathDelayInternalTo(const Pin *pin) const;
bool isPathDelayInternalToBreak(const Pin *pin) const; bool isPathDelayInternalToBreak(const Pin *pin) const;
ExceptionPathSet *exceptions() { return &exceptions_; } ExceptionPathSet &exceptions() { return exceptions_; }
void deleteExceptions(); void deleteExceptions();
void deleteException(ExceptionPath *exception); void deleteException(ExceptionPath *exception);
void recordException(ExceptionPath *exception); void recordException(ExceptionPath *exception);
@ -1043,7 +1043,6 @@ protected:
void removeLibertyAnnotations(); void removeLibertyAnnotations();
void deleteExceptionsReferencing(Clock *clk); void deleteExceptionsReferencing(Clock *clk);
void deleteClkPinMappings(Clock *clk); void deleteClkPinMappings(Clock *clk);
void deleteExceptionPtHashMapSets(ExceptionPathPtHash &map);
void makeClkPinMappings(Clock *clk); void makeClkPinMappings(Clock *clk);
void deletePinClocks(Clock *defining_clk, void deletePinClocks(Clock *defining_clk,
PinSet *pins); PinSet *pins);

View File

@ -95,7 +95,7 @@ typedef Set<LibertyPortPair, LibertyPortPairLess> LibertyPortPairSet;
typedef Map<const Instance*, DisabledInstancePorts*> DisabledInstancePortsMap; typedef Map<const Instance*, DisabledInstancePorts*> DisabledInstancePortsMap;
typedef Map<LibertyCell*, DisabledCellPorts*> DisabledCellPortsMap; typedef Map<LibertyCell*, DisabledCellPorts*> DisabledCellPortsMap;
typedef MinMaxValues<float> ClockUncertainties; typedef MinMaxValues<float> ClockUncertainties;
typedef Set<ExceptionPath*> ExceptionPathSet; typedef std::set<ExceptionPath*> ExceptionPathSet;
typedef PinPair EdgePins; typedef PinPair EdgePins;
typedef PinPairSet EdgePinsSet; typedef PinPairSet EdgePinsSet;
typedef Map<const Pin*, LogicValue> LogicValueMap; typedef Map<const Pin*, LogicValue> LogicValueMap;

View File

@ -3957,14 +3957,30 @@ Sdc::unrecordPathDelayInternalFrom(ExceptionPath *exception)
} }
} }
template<class OBJ>
const ExceptionPathSet *
findExceptions(const UnorderedMap<const OBJ*, ExceptionPathSet> &map,
const OBJ *obj)
{
const auto itr = map.find(obj);
if (itr != map.end())
return &itr->second;
else
return nullptr;
}
bool bool
Sdc::pathDelayFrom(const Pin *pin) Sdc::pathDelayFrom(const Pin *pin)
{ {
ExceptionPathSet *exceptions = first_from_pin_exceptions_.findKey(pin);
const ExceptionPathSet *exceptions =
findExceptions<Pin>(first_from_pin_exceptions_, pin);
if (exceptions) {
for (ExceptionPath *exception : *exceptions) { for (ExceptionPath *exception : *exceptions) {
if (exception->isPathDelay()) if (exception->isPathDelay())
return true; return true;
} }
}
return false; return false;
} }
@ -4042,11 +4058,14 @@ Sdc::hasLibertyCheckTo(const Pin *pin)
bool bool
Sdc::pathDelayTo(const Pin *pin) Sdc::pathDelayTo(const Pin *pin)
{ {
ExceptionPathSet *exceptions = first_to_pin_exceptions_.findKey(pin); const ExceptionPathSet *exceptions =
findExceptions<Pin>(first_to_pin_exceptions_, pin);
if (exceptions) {
for (ExceptionPath *exception : *exceptions) { for (ExceptionPath *exception : *exceptions) {
if (exception->isPathDelay()) if (exception->isPathDelay())
return true; return true;
} }
}
return false; return false;
} }
@ -4210,12 +4229,15 @@ void
Sdc::deleteLoopExceptions() Sdc::deleteLoopExceptions()
{ {
// erase prevents range iteration. // erase prevents range iteration.
ExceptionPathSet::Iterator except_iter(exceptions_); for (auto itr = exceptions_.begin(); itr != exceptions_.end(); ) {
while (except_iter.hasNext()) { ExceptionPath *except = *itr;
ExceptionPath *except = except_iter.next(); if (except->isLoop()) {
if (except->isLoop()) itr = exceptions_.erase(itr);
deleteException(except); deleteException(except);
} }
else
itr++;
}
} }
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
@ -4420,8 +4442,8 @@ Sdc::findMatchingExceptionsFirstThru(ExceptionPath *exception,
for (const Net *net : *thru->nets()) { for (const Net *net : *thru->nets()) {
// Potential matches includes exceptions that match net that are not // Potential matches includes exceptions that match net that are not
// the first exception point. // the first exception point.
ExceptionPathSet *potential_matches = const ExceptionPathSet *potential_matches =
first_thru_net_exceptions_.findKey(net); findExceptions<Net>(first_thru_net_exceptions_, net);
if (potential_matches) { if (potential_matches) {
for (ExceptionPath *match : *potential_matches) { for (ExceptionPath *match : *potential_matches) {
ExceptionThru *match_thru = (*match->thrus())[0]; ExceptionThru *match_thru = (*match->thrus())[0];
@ -4457,8 +4479,11 @@ Sdc::findMatchingExceptionsClks(ExceptionPath *exception,
{ {
if (clks) { if (clks) {
ExceptionPathSet clks_matches; ExceptionPathSet clks_matches;
for (Clock *clk : *clks) for (Clock *clk : *clks) {
clks_matches.insertSet(exception_map.findKey(clk)); 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); findMatchingExceptions(exception, &clks_matches, matches);
} }
} }
@ -4471,8 +4496,11 @@ Sdc::findMatchingExceptionsPins(ExceptionPath *exception,
{ {
if (pins) { if (pins) {
ExceptionPathSet pins_matches; ExceptionPathSet pins_matches;
for (const Pin *pin : *pins) for (const Pin *pin : *pins) {
pins_matches.insertSet(exception_map.findKey(pin)); 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); findMatchingExceptions(exception, &pins_matches, matches);
} }
} }
@ -4484,10 +4512,13 @@ Sdc::findMatchingExceptionsInsts(ExceptionPath *exception,
ExceptionPathSet &matches) ExceptionPathSet &matches)
{ {
if (insts) { if (insts) {
ExceptionPathSet insts_matches; ExceptionPathSet inst_matches;
for (const Instance *inst : *insts) for (const Instance *inst : *insts) {
insts_matches.insertSet(exception_map.findKey(inst)); auto itr = exception_map.find(inst);
findMatchingExceptions(exception, &insts_matches, matches); 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, hash,
exception->asString(network_), exception->asString(network_),
missing_pt->asString(network_)); missing_pt->asString(network_));
ExceptionPathSet *set = exception_merge_hash_.findKey(hash); ExceptionPathSet &set = exception_merge_hash_[hash];
if (set == nullptr) { set.insert(exception);
set = new ExceptionPathSet;
exception_merge_hash_[hash] = set;
}
set->insert(exception);
} }
// Record a mapping from first pin/clock/instance's to a set of exceptions. // Record a mapping from first pin/clock/instance's to a set of exceptions.
@ -4716,12 +4743,8 @@ Sdc::recordExceptionClks(ExceptionPath *exception,
{ {
if (clks) { if (clks) {
for (Clock *clk : *clks) { for (Clock *clk : *clks) {
ExceptionPathSet *set = exception_map.findKey(clk); ExceptionPathSet &set = exception_map[clk];
if (set == nullptr) { set.insert(exception);
set = new ExceptionPathSet;
exception_map[clk] = set;
}
set->insert(exception);
} }
} }
} }
@ -4733,12 +4756,8 @@ Sdc::recordExceptionEdges(ExceptionPath *exception,
{ {
if (edges) { if (edges) {
for (const EdgePins &edge : *edges) { for (const EdgePins &edge : *edges) {
ExceptionPathSet *set = exception_map.findKey(edge); ExceptionPathSet &set = exception_map[edge];
if (set == nullptr) { set.insert(exception);
set = new ExceptionPathSet;
exception_map.insert(edge, set);
}
set->insert(exception);
} }
} }
} }
@ -4750,12 +4769,8 @@ Sdc::recordExceptionPins(ExceptionPath *exception,
{ {
if (pins) { if (pins) {
for (const Pin *pin : *pins) { for (const Pin *pin : *pins) {
ExceptionPathSet *set = exception_map.findKey(pin); ExceptionPathSet &set = exception_map[pin];
if (set == nullptr) { set.insert(exception);
set = new ExceptionPathSet;
exception_map.insert(pin, set);
}
set->insert(exception);
} }
} }
} }
@ -4765,12 +4780,8 @@ Sdc::recordExceptionHpin(ExceptionPath *exception,
Pin *pin, Pin *pin,
PinExceptionsMap &exception_map) PinExceptionsMap &exception_map)
{ {
ExceptionPathSet *set = exception_map.findKey(pin); ExceptionPathSet &set = exception_map[pin];
if (set == nullptr) { set.insert(exception);
set = new ExceptionPathSet;
exception_map.insert(pin, set);
}
set->insert(exception);
} }
void void
@ -4780,12 +4791,8 @@ Sdc::recordExceptionInsts(ExceptionPath *exception,
{ {
if (insts) { if (insts) {
for (const Instance *inst : *insts) { for (const Instance *inst : *insts) {
ExceptionPathSet *set = exception_map.findKey(inst); ExceptionPathSet &set = exception_map[inst];
if (set == nullptr) { set.insert(exception);
set = new ExceptionPathSet;
exception_map[inst] = set;
}
set->insert(exception);
} }
} }
} }
@ -4797,12 +4804,8 @@ Sdc::recordExceptionNets(ExceptionPath *exception,
{ {
if (nets) { if (nets) {
for (const Net *net : *nets) { for (const Net *net : *nets) {
ExceptionPathSet *set = exception_map.findKey(net); ExceptionPathSet &set = exception_map[net];
if (set == nullptr) { set.insert(exception);
set = new ExceptionPathSet;
exception_map[net] = set;
}
set->insert(exception);
} }
} }
} }
@ -4836,9 +4839,10 @@ Sdc::findMergeMatch(ExceptionPath *exception)
while (missing_pt_iter.hasNext()) { while (missing_pt_iter.hasNext()) {
ExceptionPt *missing_pt = missing_pt_iter.next(); ExceptionPt *missing_pt = missing_pt_iter.next();
size_t hash = exception->hash(missing_pt); size_t hash = exception->hash(missing_pt);
ExceptionPathSet *matches = exception_merge_hash_.findKey(hash); auto itr = exception_merge_hash_.find(hash);
if (matches) { if (itr != exception_merge_hash_.end()) {
for (ExceptionPath *match : *matches) { ExceptionPathSet &matches = itr->second;
for (ExceptionPath *match : matches) {
ExceptionPt *match_missing_pt; ExceptionPt *match_missing_pt;
if (match != exception if (match != exception
// Exceptions are not merged if their priorities are // Exceptions are not merged if their priorities are
@ -4876,59 +4880,52 @@ Sdc::findMergeMatch(ExceptionPath *exception)
void void
Sdc::deleteExceptions() Sdc::deleteExceptions()
{ {
exceptions_.deleteContentsClear(); exceptions_.clear();
exception_id_ = 0; exception_id_ = 0;
first_from_pin_exceptions_.deleteContentsClear(); first_from_pin_exceptions_.clear();
first_from_clk_exceptions_.deleteContentsClear(); first_from_clk_exceptions_.clear();
first_from_inst_exceptions_.deleteContentsClear(); first_from_inst_exceptions_.clear();
first_to_pin_exceptions_.deleteContentsClear(); first_to_pin_exceptions_.clear();
first_to_clk_exceptions_.deleteContentsClear(); first_to_clk_exceptions_.clear();
first_to_inst_exceptions_.deleteContentsClear(); first_to_inst_exceptions_.clear();
first_thru_pin_exceptions_.deleteContentsClear(); first_thru_pin_exceptions_.clear();
first_thru_inst_exceptions_.deleteContentsClear(); first_thru_inst_exceptions_.clear();
first_thru_net_exceptions_.deleteContentsClear(); first_thru_net_exceptions_.clear();
first_thru_edge_exceptions_.deleteContentsClear(); first_thru_edge_exceptions_.clear();
first_thru_edge_exceptions_.clear(); first_thru_edge_exceptions_.clear();
path_delay_internal_from_.clear(); path_delay_internal_from_.clear();
path_delay_internal_from_break_.clear(); path_delay_internal_from_break_.clear();
path_delay_internal_to_.clear(); path_delay_internal_to_.clear();
path_delay_internal_to_break_.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(); exception_merge_hash_.clear();
have_thru_hpin_exceptions_ = false; have_thru_hpin_exceptions_ = false;
} }
void
Sdc::deleteExceptionPtHashMapSets(ExceptionPathPtHash &map)
{
map.deleteContents();
}
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
void void
Sdc::deleteExceptionsReferencing(Clock *clk) Sdc::deleteExceptionsReferencing(Clock *clk)
{ {
// erase prevents range iteration. // erase prevents range iteration.
ExceptionPathSet::ConstIterator exception_iter(exceptions_); for (auto itr = exceptions_.begin(); itr != exceptions_.end(); ) {
while (exception_iter.hasNext()) { ExceptionPath *exception = *itr;
ExceptionPath *exception = exception_iter.next();
bool deleted = false; bool deleted = false;
ExceptionFrom *from = exception->from(); ExceptionFrom *from = exception->from();
if (from) { if (from) {
ClockSet *clks = from->clks(); ClockSet *clks = from->clks();
if (clks && clks->hasKey(clk)) { if (clks && clks->hasKey(clk)) {
itr = exceptions_.erase(itr);
unrecordException(exception); unrecordException(exception);
deleted = true;
from->deleteClock(clk); from->deleteClock(clk);
if (from->hasObjects()) if (from->hasObjects())
recordException(exception); recordException(exception);
else { else
deleteException(exception); deleteException(exception);
deleted = true;
}
} }
} }
@ -4937,6 +4934,8 @@ Sdc::deleteExceptionsReferencing(Clock *clk)
if (to) { if (to) {
ClockSet *clks = to->clks(); ClockSet *clks = to->clks();
if (clks && clks->hasKey(clk)) { if (clks && clks->hasKey(clk)) {
itr = exceptions_.erase(itr);
deleted = true;
unrecordException(exception); unrecordException(exception);
to->deleteClock(clk); to->deleteClock(clk);
if (to->hasObjects()) if (to->hasObjects())
@ -4946,6 +4945,8 @@ Sdc::deleteExceptionsReferencing(Clock *clk)
} }
} }
} }
if (!deleted)
itr++;
} }
} }
@ -4986,9 +4987,11 @@ Sdc::unrecordMergeHash(ExceptionPath *exception,
hash, hash,
exception->asString(network_), exception->asString(network_),
missing_pt->asString(network_)); missing_pt->asString(network_));
ExceptionPathSet *matches = exception_merge_hash_.findKey(hash); auto itr = exception_merge_hash_.find(hash);
if (matches) if (itr != exception_merge_hash_.end()) {
matches->erase(exception); ExceptionPathSet &matches = itr->second;
matches.erase(exception);
}
} }
void void
@ -5026,9 +5029,11 @@ Sdc::unrecordExceptionClks(ExceptionPath *exception,
{ {
if (clks) { if (clks) {
for (Clock *clk : *clks) { for (Clock *clk : *clks) {
ExceptionPathSet *set = exception_map.findKey(clk); auto itr = exception_map.find(clk);
if (set) if (itr != exception_map.end()) {
set->erase(exception); ExceptionPathSet &set = itr->second;
set.erase(exception);
}
} }
} }
} }
@ -5040,9 +5045,11 @@ Sdc::unrecordExceptionPins(ExceptionPath *exception,
{ {
if (pins) { if (pins) {
for (const Pin *pin : *pins) { for (const Pin *pin : *pins) {
ExceptionPathSet *set = exception_map.findKey(pin); auto itr = exception_map.find(pin);
if (set) if (itr != exception_map.end()) {
set->erase(exception); ExceptionPathSet &set = itr->second;
set.erase(exception);
}
} }
} }
} }
@ -5054,9 +5061,11 @@ Sdc::unrecordExceptionInsts(ExceptionPath *exception,
{ {
if (insts) { if (insts) {
for (const Instance *inst : *insts) { for (const Instance *inst : *insts) {
ExceptionPathSet *set = exception_map.findKey(inst); auto itr = exception_map.find(inst);
if (set) if (itr != exception_map.end()) {
set->erase(exception); ExceptionPathSet &set = itr->second;
set.erase(exception);
}
} }
} }
} }
@ -5068,9 +5077,11 @@ Sdc::unrecordExceptionEdges(ExceptionPath *exception,
{ {
if (edges) { if (edges) {
for (const EdgePins &edge : *edges) { for (const EdgePins &edge : *edges) {
ExceptionPathSet *set = exception_map.findKey(edge); auto itr = exception_map.find(edge);
if (set) if (itr != exception_map.end()) {
set->erase(exception); ExceptionPathSet &set = itr->second;
set.erase(exception);
}
} }
} }
} }
@ -5082,9 +5093,11 @@ Sdc::unrecordExceptionNets(ExceptionPath *exception,
{ {
if (nets) { if (nets) {
for (const Net *net : *nets) { for (const Net *net : *nets) {
ExceptionPathSet *set = exception_map.findKey(net); auto itr = exception_map.find(net);
if (set) if (itr != exception_map.end()) {
set->erase(exception); ExceptionPathSet &set = itr->second;
set.erase(exception);
}
} }
} }
} }
@ -5094,9 +5107,11 @@ Sdc::unrecordExceptionHpin(ExceptionPath *exception,
Pin *pin, Pin *pin,
PinExceptionsMap &exception_map) PinExceptionsMap &exception_map)
{ {
ExceptionPathSet *set = exception_map.findKey(pin); auto itr = exception_map.find(pin);
if (set) if (itr != exception_map.end()) {
set->erase(exception); ExceptionPathSet &set = itr->second;
set.erase(exception);
}
} }
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
@ -5166,18 +5181,18 @@ Sdc::resetPath(ExceptionFrom *from,
const MinMaxAll *min_max) const MinMaxAll *min_max)
{ {
checkFromThrusTo(from, thrus, to); checkFromThrusTo(from, thrus, to);
ExceptionPathSet::Iterator except_iter(exceptions_); // erase prevents range iteration.
while (except_iter.hasNext()) { for (auto itr = exceptions_.begin(); itr != exceptions_.end(); ) {
ExceptionPath *match = except_iter.next(); ExceptionPath *match = *itr;
if (match->resetMatch(from, thrus, to, min_max, network_)) { if (match->resetMatch(from, thrus, to, min_max, network_)) {
debugPrint(debug_, "exception_match", 3, "reset match %s", debugPrint(debug_, "exception_match", 3, "reset match %s",
match->asString(network_)); match->asString(network_));
ExceptionPathSet expansions; ExceptionPathSet expansions;
expandException(match, expansions); expandException(match, expansions);
itr = exceptions_.erase(itr);
deleteException(match); deleteException(match);
ExceptionPathSet::Iterator expand_iter(expansions);
while (expand_iter.hasNext()) { for (ExceptionPath *expand : expansions) {
ExceptionPath *expand = expand_iter.next();
if (expand->resetMatch(from, thrus, to, min_max, network_)) { if (expand->resetMatch(from, thrus, to, min_max, network_)) {
unrecordPathDelayInternalFrom(expand); unrecordPathDelayInternalFrom(expand);
unrecordPathDelayInternalTo(expand); unrecordPathDelayInternalTo(expand);
@ -5187,6 +5202,8 @@ Sdc::resetPath(ExceptionFrom *from,
addException(expand); addException(expand);
} }
} }
else
itr++;
} }
} }
@ -5214,33 +5231,38 @@ Sdc::exceptionFromStates(const Pin *pin,
{ {
bool srch_from = true; bool srch_from = true;
if (pin) { if (pin) {
if (srch_from && !first_from_pin_exceptions_.empty()) if (srch_from) {
srch_from &= exceptionFromStates(first_from_pin_exceptions_.findKey(pin), const ExceptionPathSet *exceptions =
pin, rf, min_max, include_filter, findExceptions<Pin>(first_from_pin_exceptions_, pin);
states); srch_from &= exceptionFromStates(exceptions, pin, rf, min_max,
if (srch_from && !first_thru_pin_exceptions_.empty()) include_filter, states);
srch_from &= exceptionFromStates(first_thru_pin_exceptions_.findKey(pin), }
pin, rf, min_max, include_filter, if (srch_from) {
states); const ExceptionPathSet *exceptions =
findExceptions<Pin>(first_thru_pin_exceptions_, pin);
srch_from &= exceptionFromStates(exceptions, pin, rf, min_max,
include_filter, states);
}
if (srch_from if (srch_from
&& (!first_from_inst_exceptions_.empty() && (!first_from_inst_exceptions_.empty()
|| !first_thru_inst_exceptions_.empty())) { || !first_thru_inst_exceptions_.empty())) {
Instance *inst = network_->instance(pin); Instance *inst = network_->instance(pin);
if (srch_from && !first_from_inst_exceptions_.empty()) const ExceptionPathSet *exceptions =
srch_from &= exceptionFromStates(first_from_inst_exceptions_.findKey(inst), findExceptions<Instance>(first_from_inst_exceptions_, inst);
pin, rf, min_max, include_filter, srch_from &= exceptionFromStates(exceptions, pin, rf, min_max,
states); include_filter, states);
if (srch_from && !first_thru_inst_exceptions_.empty()) const ExceptionPathSet *exceptions2 =
srch_from &= exceptionFromStates(first_thru_inst_exceptions_.findKey(inst), findExceptions<Instance>(first_thru_inst_exceptions_, inst);
pin, rf, min_max, include_filter, srch_from &= exceptionFromStates(exceptions2, pin, rf, min_max,
states); include_filter, states);
} }
} }
if (srch_from && clk && !first_from_clk_exceptions_.empty()) if (srch_from && clk) {
srch_from &= exceptionFromStates(first_from_clk_exceptions_.findKey(clk), const ExceptionPathSet *exceptions =
pin, clk_rf, min_max, include_filter, findExceptions<Clock>(first_from_clk_exceptions_, clk);
states); srch_from &= exceptionFromStates(exceptions, pin, clk_rf, min_max,
include_filter, states);
}
if (!srch_from) { if (!srch_from) {
delete states; delete states;
states = nullptr; states = nullptr;
@ -5299,20 +5321,22 @@ Sdc::exceptionFromClkStates(const Pin *pin,
ExceptionStateSet *&states) const ExceptionStateSet *&states) const
{ {
if (pin) { if (pin) {
if (!first_from_pin_exceptions_.empty()) const ExceptionPathSet *exceptions =
exceptionFromStates(first_from_pin_exceptions_.findKey(pin), findExceptions<Pin>(first_from_pin_exceptions_, pin);
nullptr, rf, min_max, true, states); exceptionFromStates(exceptions, nullptr, rf, min_max, true, states);
if (!first_from_inst_exceptions_.empty()) { if (!first_from_inst_exceptions_.empty()) {
Instance *inst = network_->instance(pin); Instance *inst = network_->instance(pin);
exceptionFromStates(first_from_inst_exceptions_.findKey(inst), const ExceptionPathSet *exceptions =
pin, rf, min_max, true, states); findExceptions<Instance>(first_from_inst_exceptions_, inst);
exceptionFromStates(exceptions, pin, rf, min_max, true, states);
} }
exceptionThruStates(first_thru_pin_exceptions_.findKey(pin), const ExceptionPathSet *exceptions2 =
rf, min_max, states); findExceptions<Pin>(first_thru_pin_exceptions_, pin);
exceptionThruStates(exceptions2, rf, min_max, states);
} }
if (!first_from_clk_exceptions_.empty()) const ExceptionPathSet *exceptions =
exceptionFromStates(first_from_clk_exceptions_.findKey(clk), findExceptions<Clock>(first_from_clk_exceptions_, clk);
pin, clk_rf, min_max, true, states); exceptionFromStates(exceptions, pin, clk_rf, min_max, true, states);
} }
void void
@ -5322,10 +5346,10 @@ Sdc::filterRegQStates(const Pin *to_pin,
ExceptionStateSet *&states) const ExceptionStateSet *&states) const
{ {
if (!first_from_pin_exceptions_.empty()) { if (!first_from_pin_exceptions_.empty()) {
const ExceptionPathSet *exceptions = auto itr = first_from_pin_exceptions_.find(to_pin);
first_from_pin_exceptions_.findKey(to_pin); if (itr != first_from_pin_exceptions_.end()) {
if (exceptions) { const ExceptionPathSet &exceptions = itr->second;
for (ExceptionPath *exception : *exceptions) { for (ExceptionPath *exception : exceptions) {
// Hack for filter -from reg/Q. // Hack for filter -from reg/Q.
if (exception->isFilter() if (exception->isFilter()
&& exception->matchesFirstPt(to_rf, min_max)) { && exception->matchesFirstPt(to_rf, min_max)) {
@ -5346,19 +5370,25 @@ Sdc::exceptionThruStates(const Pin *from_pin,
const MinMax *min_max, const MinMax *min_max,
ExceptionStateSet *&states) const ExceptionStateSet *&states) const
{ {
exceptionThruStates(first_thru_pin_exceptions_.findKey(to_pin), const ExceptionPathSet *exceptions =
to_rf, min_max, states); findExceptions<Pin>(first_thru_pin_exceptions_, to_pin);
exceptionThruStates(exceptions, to_rf, min_max, states);
if (!first_thru_edge_exceptions_.empty()) { if (!first_thru_edge_exceptions_.empty()) {
EdgePins edge_pins(from_pin, to_pin); EdgePins edge_pins(from_pin, to_pin);
exceptionThruStates(first_thru_edge_exceptions_.findKey(edge_pins), auto itr = first_thru_edge_exceptions_.find(edge_pins);
to_rf, min_max, states); 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() if (!first_thru_inst_exceptions_.empty()
&& (network_->direction(to_pin)->isAnyOutput() && (network_->direction(to_pin)->isAnyOutput()
|| network_->isLatchData(to_pin))) { || network_->isLatchData(to_pin))) {
const Instance *to_inst = network_->instance(to_pin); const Instance *to_inst = network_->instance(to_pin);
exceptionThruStates(first_thru_inst_exceptions_.findKey(to_inst), const ExceptionPathSet *exceptions =
to_rf, min_max, states); findExceptions<Instance>(first_thru_inst_exceptions_, to_inst);
exceptionThruStates(exceptions, to_rf, min_max, states);
} }
} }
@ -5396,19 +5426,27 @@ Sdc::exceptionTo(ExceptionPathType type,
{ {
if (!first_to_inst_exceptions_.empty()) { if (!first_to_inst_exceptions_.empty()) {
Instance *inst = network_->instance(pin); Instance *inst = network_->instance(pin);
exceptionTo(first_to_inst_exceptions_.findKey(inst), type, pin, rf, const ExceptionPathSet *exceptions =
findExceptions<Instance>(first_to_inst_exceptions_, inst);
exceptionTo(exceptions, type, pin, rf,
clk_edge, min_max, match_min_max_exactly, clk_edge, min_max, match_min_max_exactly,
hi_priority_exception, hi_priority); hi_priority_exception, hi_priority);
} }
if (!first_to_pin_exceptions_.empty()) if (!first_to_pin_exceptions_.empty()) {
exceptionTo(first_to_pin_exceptions_.findKey(pin), type, pin, rf, const ExceptionPathSet *exceptions =
findExceptions<Pin>(first_to_pin_exceptions_, pin);
exceptionTo(exceptions, type, pin, rf,
clk_edge, min_max, match_min_max_exactly, clk_edge, min_max, match_min_max_exactly,
hi_priority_exception, hi_priority); hi_priority_exception, hi_priority);
if (clk_edge && !first_to_clk_exceptions_.empty()) }
exceptionTo(first_to_clk_exceptions_.findKey(clk_edge->clock()), if (clk_edge && !first_to_clk_exceptions_.empty()) {
type, pin, rf, clk_edge, min_max, match_min_max_exactly, const ExceptionPathSet *exceptions =
findExceptions<Clock>(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); hi_priority_exception, hi_priority);
} }
}
void void
Sdc::exceptionTo(const ExceptionPathSet *to_exceptions, Sdc::exceptionTo(const ExceptionPathSet *to_exceptions,
@ -5515,15 +5553,20 @@ Sdc::groupPathsTo(const Pin *pin,
{ {
if (!first_to_inst_exceptions_.empty()) { if (!first_to_inst_exceptions_.empty()) {
Instance *inst = network_->instance(pin); Instance *inst = network_->instance(pin);
groupPathsTo(first_to_inst_exceptions_.findKey(inst), pin, rf, const ExceptionPathSet *exceptions =
clk_edge, min_max, group_paths); findExceptions<Instance>(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<Pin>(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<Clock>(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 void
@ -5627,7 +5670,7 @@ Sdc::disconnectPinBefore(const Pin *pin)
{ {
auto itr = pin_exceptions_.find(pin); auto itr = pin_exceptions_.find(pin);
if (itr != pin_exceptions_.end()) { if (itr != pin_exceptions_.end()) {
for (ExceptionPath *exception : *itr->second) { for (ExceptionPath *exception : itr->second) {
ExceptionFrom *from = exception->from(); ExceptionFrom *from = exception->from();
if (from) if (from)
from->disconnectPinBefore(pin, network_); from->disconnectPinBefore(pin, network_);

View File

@ -1196,7 +1196,7 @@ void
WriteSdc::writeExceptions() const WriteSdc::writeExceptions() const
{ {
ExceptionPathSeq exceptions; ExceptionPathSeq exceptions;
for (ExceptionPath *exception : *sdc_->exceptions()) for (ExceptionPath *exception : sdc_->exceptions())
exceptions.push_back(exception); exceptions.push_back(exception);
sort(exceptions, ExceptionPathLess(network_)); sort(exceptions, ExceptionPathLess(network_));
for (ExceptionPath *exception : exceptions) { for (ExceptionPath *exception : exceptions) {

View File

@ -273,10 +273,7 @@ CheckTiming::hasClkedDepature(Pin *pin)
bool bool
CheckTiming::hasMaxDelay(Pin *pin) CheckTiming::hasMaxDelay(Pin *pin)
{ {
ExceptionPathSet *exceptions = sdc_->exceptions(); for (ExceptionPath *exception : sdc_->exceptions()) {
ExceptionPathSet::Iterator exception_iter(exceptions);
while (exception_iter.hasNext()) {
ExceptionPath *exception = exception_iter.next();
ExceptionTo *to = exception->to(); ExceptionTo *to = exception->to();
if (exception->isPathDelay() if (exception->isPathDelay()
&& exception->minMax() == MinMaxAll::max() && exception->minMax() == MinMaxAll::max()