From c7debe5463caffd52989454c30d7b26b0a14b19b Mon Sep 17 00:00:00 2001 From: James Cherry Date: Tue, 9 Aug 2022 14:48:39 -0700 Subject: [PATCH] mutateTag cleanup Signed-off-by: James Cherry --- include/sta/Sdc.hh | 9 +++--- sdc/Sdc.cc | 7 +++-- search/Search.cc | 70 ++++++++++++++++++++++++---------------------- 3 files changed, 44 insertions(+), 42 deletions(-) diff --git a/include/sta/Sdc.hh b/include/sta/Sdc.hh index 5012e192..3c533c81 100644 --- a/include/sta/Sdc.hh +++ b/include/sta/Sdc.hh @@ -946,11 +946,10 @@ public: ExceptionStateSet *&states) const; // Return hierarchical -thru exceptions that start between // from_pin and to_pin. - void exceptionThruStates(const Pin *from_pin, - const Pin *to_pin, - const RiseFall *to_rf, - const MinMax *min_max, - ExceptionStateSet *&states) const; + ExceptionStateSet *exceptionThruStates(const Pin *from_pin, + const Pin *to_pin, + const RiseFall *to_rf, + const MinMax *min_max) const; // Find the highest priority exception with first exception pt at // pin/clk end. void exceptionTo(ExceptionPathType type, diff --git a/sdc/Sdc.cc b/sdc/Sdc.cc index 94075c28..0c087a8a 100644 --- a/sdc/Sdc.cc +++ b/sdc/Sdc.cc @@ -5467,13 +5467,13 @@ Sdc::filterRegQStates(const Pin *to_pin, } } -void +ExceptionStateSet * Sdc::exceptionThruStates(const Pin *from_pin, const Pin *to_pin, const RiseFall *to_rf, - const MinMax *min_max, - ExceptionStateSet *&states) const + const MinMax *min_max) const { + ExceptionStateSet *states = nullptr; if (first_thru_pin_exceptions_) exceptionThruStates(first_thru_pin_exceptions_->findKey(to_pin), to_rf, min_max, states); @@ -5489,6 +5489,7 @@ Sdc::exceptionThruStates(const Pin *from_pin, exceptionThruStates(first_thru_inst_exceptions_->findKey(to_inst), to_rf, min_max, states); } + return states; } void diff --git a/search/Search.cc b/search/Search.cc index a4a13d99..4bc7a3e9 100644 --- a/search/Search.cc +++ b/search/Search.cc @@ -2552,35 +2552,40 @@ Search::mutateTag(Tag *from_tag, bool state_change = false; for (auto state : *from_states) { ExceptionPath *exception = state->exception(); - if (state->isComplete() - && exception->isFalse() - && !from_is_clk) - // Don't propagate a completed false path -thru unless it is a - // clock (which ignores exceptions). - return nullptr; - - if (state->matchesNextThru(from_pin,to_pin,to_rf,min_max,network_)) { - // Found a -thru that we've been waiting for. - if (state->nextState()->isComplete() - && exception->isLoop()) - // to_pin/edge completes a loop path. - return nullptr; + // One edge may traverse multiple hierarchical thru pins. + while (state->matchesNextThru(from_pin,to_pin,to_rf,min_max,network_)) { + // Found a -thru that we've been waiting for. + state = state->nextState(); state_change = true; - break; + break; } + if (state_change) + break; + + // Don't propagate a completed false path -thru unless it is a + // clock. Clocks carry the completed false path to disable + // downstream paths that use the clock as data. + if ((state->isComplete() + && exception->isFalse() + && !from_is_clk) + // to_pin/edge completes a loop path. + || (exception->isLoop() + && state->isComplete())) + return nullptr; // Kill path delay tags past the -to pin. if ((exception->isPathDelay() && sdc_->isCompleteTo(state, from_pin, from_rf, min_max)) // Kill loop tags at register clock pins. - || (to_is_reg_clk - && exception->isLoop())) { + || (exception->isLoop() + && to_is_reg_clk)) { state_change = true; - break; + break; } } + // Get the set of -thru exceptions starting at to_pin/edge. - sdc_->exceptionThruStates(from_pin, to_pin, to_rf, min_max, new_states); + new_states = sdc_->exceptionThruStates(from_pin, to_pin, to_rf, min_max); if (new_states || state_change) { // Second pass to apply state changes and add updated existing // states to new states. @@ -2588,26 +2593,23 @@ Search::mutateTag(Tag *from_tag, new_states = new ExceptionStateSet; for (auto state : *from_states) { ExceptionPath *exception = state->exception(); - if (state->isComplete() - && exception->isFalse() - && !from_is_clk) { - // Don't propagate a completed false path -thru unless it is a - // clock. Clocks carry the completed false path to disable - // downstream paths that use the clock as data. - delete new_states; - return nullptr; - } // One edge may traverse multiple hierarchical thru pins. while (state->matchesNextThru(from_pin,to_pin,to_rf,min_max,network_)) // Found a -thru that we've been waiting for. state = state->nextState(); - if (state->isComplete() - && exception->isLoop()) { - // to_pin/edge completes a loop path. - delete new_states; - return nullptr; - } + // Don't propagate a completed false path -thru unless it is a + // clock. Clocks carry the completed false path to disable + // downstream paths that use the clock as data. + if ((state->isComplete() + && exception->isFalse() + && !from_is_clk) + // to_pin/edge completes a loop path. + || (exception->isLoop() + && state->isComplete())) { + delete new_states; + return nullptr; + } // Kill path delay tags past the -to pin. if (!((exception->isPathDelay() @@ -2621,7 +2623,7 @@ Search::mutateTag(Tag *from_tag, } else // Get the set of -thru exceptions starting at to_pin/edge. - sdc_->exceptionThruStates(from_pin, to_pin, to_rf, min_max, new_states); + new_states = sdc_->exceptionThruStates(from_pin, to_pin, to_rf, min_max); if (new_states) return findTag(to_rf, path_ap, to_clk_info, to_is_clk,