From ffe126af2af0536bdb2715f196387e6de6f272e5 Mon Sep 17 00:00:00 2001 From: James Cherry Date: Sat, 6 Jun 2026 11:55:51 -0700 Subject: [PATCH] PathGroups::inPathGroupNamed Signed-off-by: James Cherry --- include/sta/PathGroup.hh | 5 +++-- search/PathGroup.cc | 36 +++++++++++++++++------------------- search/Sta.cc | 14 +++++--------- 3 files changed, 25 insertions(+), 30 deletions(-) diff --git a/include/sta/PathGroup.hh b/include/sta/PathGroup.hh index df180016..46b4c9b1 100644 --- a/include/sta/PathGroup.hh +++ b/include/sta/PathGroup.hh @@ -146,8 +146,9 @@ public: PathGroup *findPathGroup(const Clock *clock, const MinMax *min_max) const; PathGroupSeq pathGroups(const PathEnd *path_end) const; - static StringSeq pathGroupNames(const PathEnd *path_end, - const StaState *sta); + static bool inPathGroupNamed(const PathEnd *path_end, + std::string_view path_group_name, + const StaState *sta); static std::string_view asyncPathGroupName() { return async_group_name_; } static std::string_view pathDelayGroupName() { return path_delay_group_name_; } static std::string_view gatedClkGroupName() { return gated_clk_group_name_; } diff --git a/search/PathGroup.cc b/search/PathGroup.cc index 725b52c7..ee10bd6e 100644 --- a/search/PathGroup.cc +++ b/search/PathGroup.cc @@ -474,23 +474,23 @@ PathGroups::pathGroups(const PathEnd *path_end) const } // Mirrors PathGroups::pathGroup. -StringSeq -PathGroups::pathGroupNames(const PathEnd *path_end, - const StaState *sta) +bool +PathGroups::inPathGroupNamed(const PathEnd *path_end, + std::string_view path_group_name, + const StaState *sta) { - StringSeq group_names; - std::string group_name; const Search *search = sta->search(); ExceptionPathSeq group_paths = search->groupPathsTo(path_end); if (path_end->isUnconstrained()) - group_name = unconstrained_group_name_; + return path_group_name == unconstrained_group_name_; else if (!group_paths.empty()) { // GroupPaths have precedence. for (ExceptionPath *group_path : group_paths) { - if (group_path->isDefault()) - group_names.emplace_back(path_delay_group_name_); - else - group_names.emplace_back(group_path->name()); + std::string_view group_name = group_path->isDefault() + ? path_delay_group_name_ + : group_path->name(); + if (path_group_name == group_name) + return true;; } } else if (path_end->isCheck() || path_end->isLatchCheck()) { @@ -498,18 +498,18 @@ PathGroups::pathGroupNames(const PathEnd *path_end, const Clock *tgt_clk = path_end->targetClk(sta); if (check_role == TimingRole::removal() || check_role == TimingRole::recovery()) - group_name = async_group_name_; + return path_group_name == async_group_name_; else - group_name = tgt_clk->name(); + return path_group_name == tgt_clk->name(); } else if (path_end->isOutputDelay() || path_end->isDataCheck()) { const Clock *tgt_clk = path_end->targetClk(sta); if (tgt_clk) - group_name = tgt_clk->name(); + return path_group_name == tgt_clk->name(); } else if (path_end->isGatedClock()) - group_name = gated_clk_group_name_; + return path_group_name == gated_clk_group_name_; else if (path_end->isPathDelay()) { // Path delays that end at timing checks are part of the target clk group // unless -ignore_clock_latency is true. @@ -517,13 +517,11 @@ PathGroups::pathGroupNames(const PathEnd *path_end, const Clock *tgt_clk = path_end->targetClk(sta); if (tgt_clk && !path_delay->ignoreClkLatency()) - group_name = tgt_clk->name(); + return path_group_name == tgt_clk->name(); else - group_name = path_delay_group_name_; + return path_group_name == path_delay_group_name_; } - if (!group_name.empty()) - group_names.push_back(group_name); - return group_names; + return false; } GroupPath * diff --git a/search/Sta.cc b/search/Sta.cc index ba98b3f6..9599d824 100644 --- a/search/Sta.cc +++ b/search/Sta.cc @@ -3279,15 +3279,11 @@ EndpointPathEndVisitor::copy() const void EndpointPathEndVisitor::visit(PathEnd *path_end) { - if (path_end->minMax(sta_) == min_max_) { - StringSeq group_names = PathGroups::pathGroupNames(path_end, sta_); - for (std::string &group_name : group_names) { - if (group_name == path_group_name_) { - Slack end_slack = path_end->slack(sta_); - if (delayLess(end_slack, slack_, sta_)) - slack_ = end_slack; - } - } + if (path_end->minMax(sta_) == min_max_ + && PathGroups::inPathGroupNamed(path_end, path_group_name_, sta_)) { + Slack end_slack = path_end->slack(sta_); + if (delayLess(end_slack, slack_, sta_)) + slack_ = end_slack; } }