From beeb95d8304cfd04358f7d31905516480cccb52d Mon Sep 17 00:00:00 2001 From: James Cherry Date: Sat, 14 Nov 2020 10:34:26 -0700 Subject: [PATCH] Sdc::connectPinAfter minimize work if no hpins --- include/sta/Sdc.hh | 2 ++ sdc/Sdc.cc | 71 ++++++++++++++++++++++++++++++---------------- search/Sim.cc | 3 +- 3 files changed, 49 insertions(+), 27 deletions(-) diff --git a/include/sta/Sdc.hh b/include/sta/Sdc.hh index 82e4aac7..ac36b894 100644 --- a/include/sta/Sdc.hh +++ b/include/sta/Sdc.hh @@ -1034,6 +1034,7 @@ protected: void deleteMatchingExceptions(ExceptionPath *exception); void findMatchingExceptions(ExceptionPath *exception, ExceptionPathSet &matches); + void checkForThruHpins(ExceptionPath *exception); void findMatchingExceptionsFirstFrom(ExceptionPath *exception, ExceptionPathSet &matches); void findMatchingExceptionsFirstThru(ExceptionPath *exception, @@ -1334,6 +1335,7 @@ protected: PinSet disabled_clk_gating_checks_pin_; ExceptionPathSet exceptions_; + bool have_thru_hpin_exceptions_; // First pin/clock/instance/net/edge exception point to exception set map. PinExceptionsMap *first_from_pin_exceptions_; ClockExceptionsMap *first_from_clk_exceptions_; diff --git a/sdc/Sdc.cc b/sdc/Sdc.cc index d196d570..7dc4c429 100644 --- a/sdc/Sdc.cc +++ b/sdc/Sdc.cc @@ -96,6 +96,7 @@ Sdc::Sdc(StaState *sta) : port_cap_map_(nullptr), net_wire_cap_map_(nullptr), drvr_pin_wire_cap_map_(nullptr), + have_thru_hpin_exceptions_(false), first_from_pin_exceptions_(nullptr), first_from_clk_exceptions_(nullptr), first_from_inst_exceptions_(nullptr), @@ -4717,6 +4718,21 @@ Sdc::recordException(ExceptionPath *exception) exceptions_.insert(exception); recordMergeHashes(exception); recordExceptionFirstPts(exception); + checkForThruHpins(exception); +} + +void +Sdc::checkForThruHpins(ExceptionPath *exception) +{ + ExceptionThruSeq *thrus = exception->thrus(); + if (thrus) { + for (ExceptionThru *thru : *thrus) { + if (thru->edges()) { + have_thru_hpin_exceptions_ = true; + break; + } + } + } } void @@ -5016,6 +5032,7 @@ Sdc::deleteExceptions() deleteExceptionPtHashMapSets(exception_merge_hash_); exception_merge_hash_.clear(); + have_thru_hpin_exceptions_ = false; } void @@ -5954,19 +5971,21 @@ Sdc::setUseDefaultArrivalClock(bool enable) void Sdc::connectPinAfter(Pin *pin) { - PinSet *drvrs = network_->drivers(pin); - ExceptionPathSet::Iterator except_iter(exceptions_); - while (except_iter.hasNext()) { - ExceptionPath *exception = except_iter.next(); - ExceptionPt *first_pt = exception->firstPt(); - ExceptionThruSeq::Iterator thru_iter(exception->thrus()); - while (thru_iter.hasNext()) { - ExceptionThru *thru = thru_iter.next(); - if (thru->edges()) { - thru->connectPinAfter(drvrs, network_); - if (first_pt == thru) - recordExceptionEdges(exception, thru->edges(), - first_thru_edge_exceptions_); + if (have_thru_hpin_exceptions_) { + PinSet *drvrs = network_->drivers(pin); + ExceptionPathSet::Iterator except_iter(exceptions_); + while (except_iter.hasNext()) { + ExceptionPath *exception = except_iter.next(); + ExceptionPt *first_pt = exception->firstPt(); + ExceptionThruSeq::Iterator thru_iter(exception->thrus()); + while (thru_iter.hasNext()) { + ExceptionThru *thru = thru_iter.next(); + if (thru->edges()) { + thru->connectPinAfter(drvrs, network_); + if (first_pt == thru) + recordExceptionEdges(exception, thru->edges(), + first_thru_edge_exceptions_); + } } } } @@ -5975,18 +5994,20 @@ Sdc::connectPinAfter(Pin *pin) void Sdc::disconnectPinBefore(Pin *pin) { - ExceptionPathSet::Iterator except_iter(exceptions_); - while (except_iter.hasNext()) { - ExceptionPath *exception = except_iter.next(); - ExceptionPt *first_pt = exception->firstPt(); - ExceptionThruSeq::Iterator thru_iter(exception->thrus()); - while (thru_iter.hasNext()) { - ExceptionThru *thru = thru_iter.next(); - if (thru->edges()) { - thru->disconnectPinBefore(pin, network_); - if (thru == first_pt) - recordExceptionEdges(exception, thru->edges(), - first_thru_edge_exceptions_); + if (have_thru_hpin_exceptions_) { + ExceptionPathSet::Iterator except_iter(exceptions_); + while (except_iter.hasNext()) { + ExceptionPath *exception = except_iter.next(); + ExceptionPt *first_pt = exception->firstPt(); + ExceptionThruSeq::Iterator thru_iter(exception->thrus()); + while (thru_iter.hasNext()) { + ExceptionThru *thru = thru_iter.next(); + if (thru->edges()) { + thru->disconnectPinBefore(pin, network_); + if (thru == first_pt) + recordExceptionEdges(exception, thru->edges(), + first_thru_edge_exceptions_); + } } } } diff --git a/search/Sim.cc b/search/Sim.cc index 3a1d6fa8..21fe0bf1 100644 --- a/search/Sim.cc +++ b/search/Sim.cc @@ -688,9 +688,8 @@ Sim::deletePinBefore(Pin *pin) void Sim::connectPinAfter(Pin *pin) { - // Incrementally update const_func_pins_. - recordConstPinFunc(pin); if (incremental_) { + recordConstPinFunc(pin); if (network_->isLoad(pin)) invalid_load_pins_.insert(pin); if (network_->isDriver(pin))