Skip to content

Commit 10a3cdc

Browse files
committed
Exception::delete* hash update resolves #325
Signed-off-by: James Cherry <[email protected]>
1 parent 28812da commit 10a3cdc

File tree

2 files changed

+39
-20
lines changed

2 files changed

+39
-20
lines changed

include/sta/Sdc.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ typedef UnorderedMap<EdgePins, ExceptionPathSet*,
144144
PinPairHash, PinPairEqual> EdgeExceptionsMap;
145145
typedef Vector<ExceptionThru*> ExceptionThruSeq;
146146
typedef Map<const Port*,InputDrive*> InputDriveMap;
147-
typedef Map<int, ExceptionPathSet*, std::less<int> > ExceptionPathPtHash;
147+
typedef Map<size_t, ExceptionPathSet*, std::less<size_t> > ExceptionPathPtHash;
148148
typedef Set<ClockLatency*, ClockLatencyLess> ClockLatencies;
149149
typedef Map<const Pin*, ClockUncertainties*> PinClockUncertaintyMap;
150150
typedef Set<InterClockUncertainty*, InterClockUncertaintyLess> InterClockUncertaintySet;

sdc/ExceptionPath.cc

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,8 @@ FalsePath::overrides(ExceptionPath *exception) const
630630

631631
////////////////////////////////////////////////////////////////
632632

633-
LoopPath::LoopPath(ExceptionThruSeq *thrus, bool own_pts) :
633+
LoopPath::LoopPath(ExceptionThruSeq *thrus,
634+
bool own_pts) :
634635
FalsePath(nullptr, thrus, nullptr, MinMaxAll::all(), own_pts,
635636
falsePathPriority() + fromThruToPriority(nullptr, thrus, nullptr),
636637
nullptr)
@@ -1128,19 +1129,25 @@ ExceptionFromTo::deletePin(const Pin *pin,
11281129
const Network *network)
11291130
{
11301131
if (pins_) {
1131-
pins_->erase(pin);
1132-
// Incrementally update hash.
1133-
hash_ -= network->id(pin) * hash_pin;
1132+
auto itr = pins_->find(pin);
1133+
if (itr != pins_->end()) {
1134+
pins_->erase(itr);
1135+
// Incrementally update hash.
1136+
hash_ -= network->id(pin) * hash_pin;
1137+
}
11341138
}
11351139
}
11361140

11371141
void
11381142
ExceptionFromTo::deleteClock(Clock *clk)
11391143
{
11401144
if (clks_) {
1141-
clks_->erase(clk);
1142-
// Incrementally update hash.
1143-
hash_ -= clk->index() * hash_clk;
1145+
auto itr = clks_->find(clk);
1146+
if (itr != clks_->end()) {
1147+
clks_->erase(itr);
1148+
// Incrementally update hash.
1149+
hash_ -= clk->index() * hash_clk;
1150+
}
11441151
}
11451152
}
11461153

@@ -1149,9 +1156,12 @@ ExceptionFromTo::deleteInstance(const Instance *inst,
11491156
const Network *network)
11501157
{
11511158
if (insts_) {
1152-
insts_->erase(inst);
1153-
// Incrementally update hash.
1154-
hash_ -= network->id(inst) * hash_inst;
1159+
auto itr = insts_->find(inst);
1160+
if (itr != insts_->end()) {
1161+
insts_->erase(itr);
1162+
// Incrementally update hash.
1163+
hash_ -= network->id(inst) * hash_inst;
1164+
}
11551165
}
11561166
}
11571167

@@ -1782,9 +1792,12 @@ ExceptionThru::deletePin(const Pin *pin,
17821792
const Network *network)
17831793
{
17841794
if (pins_) {
1785-
pins_->erase(pin);
1786-
// Incrementally update hash.
1787-
hash_ -= network->id(pin) * hash_pin;
1795+
auto itr = pins_->find(pin);
1796+
if (itr != pins_->end()) {
1797+
pins_->erase(itr);
1798+
// Incrementally update hash.
1799+
hash_ -= network->id(pin) * hash_pin;
1800+
}
17881801
}
17891802
}
17901803

@@ -1793,9 +1806,12 @@ ExceptionThru::deleteNet(const Net *net,
17931806
const Network *network)
17941807
{
17951808
if (nets_) {
1796-
nets_->erase(net);
1797-
// Incrementally update hash.
1798-
hash_ -= network->id(net) * hash_net;
1809+
auto itr = nets_->find(net);
1810+
if (itr != nets_->end()) {
1811+
nets_->erase(itr);
1812+
// Incrementally update hash.
1813+
hash_ -= network->id(net) * hash_net;
1814+
}
17991815
}
18001816
}
18011817

@@ -1804,9 +1820,12 @@ ExceptionThru::deleteInstance(const Instance *inst,
18041820
const Network *network)
18051821
{
18061822
if (insts_) {
1807-
insts_->erase(inst);
1808-
// Incrementally update hash.
1809-
hash_ -= network->id(inst) * hash_inst;
1823+
auto itr = insts_->find(inst);
1824+
if (itr != insts_->end()) {
1825+
insts_->erase(itr);
1826+
// Incrementally update hash.
1827+
hash_ -= network->id(inst) * hash_inst;
1828+
}
18101829
}
18111830
}
18121831

0 commit comments

Comments
 (0)