From 865970e78c406f56e1bc1ca20eed678b58a9029c Mon Sep 17 00:00:00 2001 From: James Cherry Date: Fri, 20 Jan 2023 11:19:39 -0700 Subject: [PATCH] Sta::findPathEnds return seq Signed-off-by: James Cherry --- include/sta/PathGroup.hh | 17 +++++---- include/sta/Search.hh | 39 ++++++++++---------- include/sta/Sta.hh | 78 ++++++++++++++++++++-------------------- search/PathGroup.cc | 18 +++++----- search/Search.cc | 8 ++--- search/Sta.cc | 30 ++++++++-------- tcl/StaTcl.i | 24 +++++++------ 7 files changed, 107 insertions(+), 107 deletions(-) diff --git a/include/sta/PathGroup.hh b/include/sta/PathGroup.hh index 7d834d4e..7a4bf963 100644 --- a/include/sta/PathGroup.hh +++ b/include/sta/PathGroup.hh @@ -58,7 +58,7 @@ public: const PathEndSeq &pathEnds() const { return path_ends_; } void insert(PathEnd *path_end); // Push group_count into path_ends. - void pushEnds(PathEndSeq *path_ends); + void pushEnds(PathEndSeq &path_ends); // Predicates to determine if a PathEnd is worth saving. virtual bool savable(PathEnd *path_end); int maxPaths() const { return group_count_; } @@ -114,13 +114,12 @@ public: const StaState *sta); ~PathGroups(); // Use corner nullptr to make PathEnds for all corners. - // Returned PathEndSeq is owned by the caller. // The PathEnds in the vector are owned by the PathGroups. - PathEndSeq *makePathEnds(ExceptionTo *to, - bool unconstrained_paths, - const Corner *corner, - const MinMaxAll *min_max, - bool sort_by_slack); + PathEndSeq makePathEnds(ExceptionTo *to, + bool unconstrained_paths, + const Corner *corner, + const MinMaxAll *min_max, + bool sort_by_slack); PathGroup *findPathGroup(const char *name, const MinMax *min_max) const; PathGroup *findPathGroup(const Clock *clock, @@ -150,8 +149,8 @@ protected: bool unique_pins, bool cmp_slack); - void pushGroupPathEnds(PathEndSeq *path_ends); - void pushUnconstrainedPathEnds(PathEndSeq *path_ends, + void pushGroupPathEnds(PathEndSeq &path_ends); + void pushUnconstrainedPathEnds(PathEndSeq &path_ends, const MinMaxAll *min_max); void makeGroups(int group_count, diff --git a/include/sta/Search.hh b/include/sta/Search.hh index 810ef62b..887e768a 100644 --- a/include/sta/Search.hh +++ b/include/sta/Search.hh @@ -82,27 +82,26 @@ public: bool unconstrainedPaths() const { return unconstrained_paths_; } // from/thrus/to are owned and deleted by Search. // Use corner nullptr to report timing for all corners. - // Returned sequence is owned by the caller. // PathEnds are owned by Search PathGroups and deleted on next call. - PathEndSeq *findPathEnds(ExceptionFrom *from, - ExceptionThruSeq *thrus, - ExceptionTo *to, - bool unconstrained, - const Corner *corner, - const MinMaxAll *min_max, - int group_count, - int endpoint_count, - bool unique_pins, - float slack_min, - float slack_max, - bool sort_by_slack, - PathGroupNameSet *group_names, - bool setup, - bool hold, - bool recovery, - bool removal, - bool clk_gating_setup, - bool clk_gating_hold); + PathEndSeq findPathEnds(ExceptionFrom *from, + ExceptionThruSeq *thrus, + ExceptionTo *to, + bool unconstrained, + const Corner *corner, + const MinMaxAll *min_max, + int group_count, + int endpoint_count, + bool unique_pins, + float slack_min, + float slack_max, + bool sort_by_slack, + PathGroupNameSet *group_names, + bool setup, + bool hold, + bool recovery, + bool removal, + bool clk_gating_setup, + bool clk_gating_hold); bool arrivalsValid(); // Invalidate all arrival and required times. void arrivalsInvalid(); diff --git a/include/sta/Sta.hh b/include/sta/Sta.hh index 03195b56..914c1a17 100644 --- a/include/sta/Sta.hh +++ b/include/sta/Sta.hh @@ -841,45 +841,45 @@ public: bool generated_clks); // Path from/thrus/to filter. // from/thrus/to are owned and deleted by Search. - // Returned sequence is owned by the caller. - // PathEnds are owned by Search PathGroups and deleted on next call. - virtual PathEndSeq *findPathEnds(ExceptionFrom *from, - ExceptionThruSeq *thrus, - ExceptionTo *to, - bool unconstrained, - // Use corner nullptr to report timing - // for all corners. - const Corner *corner, - // max for setup checks. - // min for hold checks. - // min_max for setup and hold checks. - const MinMaxAll *min_max, - // Number of path ends to report in - // each group. - int group_count, - // Number of paths to report for - // each endpoint. - int endpoint_count, - // endpoint_count paths report unique pins - // without rise/fall variations. - bool unique_pins, - // Min/max bounds for slack of - // returned path ends. - float slack_min, - float slack_max, - // Sort path ends by slack ignoring path groups. - bool sort_by_slack, - // Path groups to report. - // Null or empty list reports all groups. - PathGroupNameSet *group_names, - // Predicates to filter the type of path - // ends returned. - bool setup, - bool hold, - bool recovery, - bool removal, - bool clk_gating_setup, - bool clk_gating_hold); + // PathEnds in the returned PathEndSeq are owned by Search PathGroups + // and deleted on next call. + virtual PathEndSeq findPathEnds(ExceptionFrom *from, + ExceptionThruSeq *thrus, + ExceptionTo *to, + bool unconstrained, + // Use corner nullptr to report timing + // for all corners. + const Corner *corner, + // max for setup checks. + // min for hold checks. + // min_max for setup and hold checks. + const MinMaxAll *min_max, + // Number of path ends to report in + // each group. + int group_count, + // Number of paths to report for + // each endpoint. + int endpoint_count, + // endpoint_count paths report unique pins + // without rise/fall variations. + bool unique_pins, + // Min/max bounds for slack of + // returned path ends. + float slack_min, + float slack_max, + // Sort path ends by slack ignoring path groups. + bool sort_by_slack, + // Path groups to report. + // Null or empty list reports all groups. + PathGroupNameSet *group_names, + // Predicates to filter the type of path + // ends returned. + bool setup, + bool hold, + bool recovery, + bool removal, + bool clk_gating_setup, + bool clk_gating_hold); void setReportPathFormat(ReportPathFormat format); void setReportPathFieldOrder(StringSeq *field_names); void setReportPathFields(bool report_input_pin, diff --git a/search/PathGroup.cc b/search/PathGroup.cc index d58eb71e..cd70c770 100644 --- a/search/PathGroup.cc +++ b/search/PathGroup.cc @@ -158,11 +158,11 @@ PathGroup::prune() } void -PathGroup::pushEnds(PathEndSeq *path_ends) +PathGroup::pushEnds(PathEndSeq &path_ends) { ensureSortedMaxPaths(); for (PathEnd *path_end : path_ends_) - path_ends->push_back(path_end); + path_ends.push_back(path_end); } PathGroupIterator * @@ -415,7 +415,7 @@ PathGroups::groupPathTo(const PathEnd *path_end) const } void -PathGroups::pushGroupPathEnds(PathEndSeq *path_ends) +PathGroups::pushGroupPathEnds(PathEndSeq &path_ends) { for (auto min_max : MinMax::range()) { int mm_index = min_max->index(); @@ -448,7 +448,7 @@ PathGroups::pushGroupPathEnds(PathEndSeq *path_ends) } void -PathGroups::pushUnconstrainedPathEnds(PathEndSeq *path_ends, +PathGroups::pushUnconstrainedPathEnds(PathEndSeq &path_ends, const MinMaxAll *min_max) { Set groups; @@ -477,7 +477,7 @@ typedef Set PathEndNoCrprSet; static bool exceptionToEmpty(ExceptionTo *to); -PathEndSeq * +PathEndSeq PathGroups::makePathEnds(ExceptionTo *to, bool unconstrained_paths, const Corner *corner, @@ -488,16 +488,16 @@ PathGroups::makePathEnds(ExceptionTo *to, makeGroupPathEnds(to, group_count_, endpoint_count_, unique_pins_, corner, min_max); - PathEndSeq *path_ends = new PathEndSeq; + PathEndSeq path_ends; pushGroupPathEnds(path_ends); if (sort_by_slack) { sort(path_ends, PathEndLess(this)); - if (static_cast(path_ends->size()) > group_count_) - path_ends->resize(group_count_); + if (static_cast(path_ends.size()) > group_count_) + path_ends.resize(group_count_); } if (unconstrained_paths - && path_ends->empty()) + && path_ends.empty()) // No constrained paths, so report unconstrained paths. pushUnconstrainedPathEnds(path_ends, min_max); diff --git a/search/Search.cc b/search/Search.cc index b1ea83ad..ec668104 100644 --- a/search/Search.cc +++ b/search/Search.cc @@ -423,7 +423,7 @@ Search::deletePaths(Vertex *vertex) // from/thrus/to are owned and deleted by Search. // Returned sequence is owned by the caller. // PathEnds are owned by Search PathGroups and deleted on next call. -PathEndSeq * +PathEndSeq Search::findPathEnds(ExceptionFrom *from, ExceptionThruSeq *thrus, ExceptionTo *to, @@ -455,9 +455,9 @@ Search::findPathEnds(ExceptionFrom *from, recovery, removal, clk_gating_setup, clk_gating_hold); ensureDownstreamClkPins(); - PathEndSeq *path_ends = path_groups_->makePathEnds(to, unconstrained_paths_, - corner, min_max, - sort_by_slack); + PathEndSeq path_ends = path_groups_->makePathEnds(to, unconstrained_paths_, + corner, min_max, + sort_by_slack); sdc_->reportClkToClkMaxCycleWarnings(); return path_ends; } diff --git a/search/Sta.cc b/search/Sta.cc index 0d58f0d5..8952ba50 100644 --- a/search/Sta.cc +++ b/search/Sta.cc @@ -2437,7 +2437,7 @@ Sta::setCmdCorner(Corner *corner) // from/thrus/to are owned and deleted by Search. // Returned sequence is owned by the caller. // PathEnds are owned by Search PathGroups and deleted on next call. -PathEndSeq * +PathEndSeq Sta::findPathEnds(ExceptionFrom *from, ExceptionThruSeq *thrus, ExceptionTo *to, @@ -2667,21 +2667,19 @@ Sta::findGroupPathPins(const char *group_path_name) { if (!(search_->havePathGroups() && search_->arrivalsValid())) { - PathEndSeq *path_ends = findPathEnds(// from, thrus, to, unconstrained - nullptr, nullptr, nullptr, false, - // corner, min_max, - nullptr, MinMaxAll::max(), - // group_count, endpoint_count, unique_pins - 1, 1, false, - -INF, INF, // slack_min, slack_max, - false, // sort_by_slack - nullptr, // group_names - // setup, hold, recovery, removal, - true, true, true, true, - // clk_gating_setup, clk_gating_hold - true, true); - // No use for the path end sequence. - delete path_ends; + PathEndSeq path_ends = findPathEnds(// from, thrus, to, unconstrained + nullptr, nullptr, nullptr, false, + // corner, min_max, + nullptr, MinMaxAll::max(), + // group_count, endpoint_count, unique_pins + 1, 1, false, + -INF, INF, // slack_min, slack_max, + false, // sort_by_slack + nullptr, // group_names + // setup, hold, recovery, removal, + true, true, true, true, + // clk_gating_setup, clk_gating_hold + true, true); } PathGroup *path_group = search_->findPathGroup(group_path_name, diff --git a/tcl/StaTcl.i b/tcl/StaTcl.i index b2a5c8fc..876126df 100644 --- a/tcl/StaTcl.i +++ b/tcl/StaTcl.i @@ -1155,6 +1155,10 @@ using namespace sta; Tcl_SetObjResult(interp, list); } +%typemap(out) PathEndSeq { + seqTclList($1, SWIGTYPE_p_PathEnd, interp); +} + %typemap(out) MinPulseWidthCheckSeqIterator* { Tcl_Obj *obj = SWIG_NewInstanceObj($1, $1_descriptor, false); Tcl_SetObjResult(interp, obj); @@ -4153,7 +4157,7 @@ set_propagate_all_clocks(bool prop) //////////////////////////////////////////////////////////////// -PathEndSeq * +PathEndSeq find_path_ends(ExceptionFrom *from, ExceptionThruSeq *thrus, ExceptionTo *to, @@ -4176,15 +4180,15 @@ find_path_ends(ExceptionFrom *from, { cmdLinkedNetwork(); Sta *sta = Sta::sta(); - PathEndSeq *ends = sta->findPathEnds(from, thrus, to, unconstrained, - corner, delay_min_max, - group_count, endpoint_count, unique_pins, - slack_min, slack_max, - sort_by_slack, - groups->size() ? groups : nullptr, - setup, hold, - recovery, removal, - clk_gating_setup, clk_gating_hold); + PathEndSeq ends = sta->findPathEnds(from, thrus, to, unconstrained, + corner, delay_min_max, + group_count, endpoint_count, unique_pins, + slack_min, slack_max, + sort_by_slack, + groups->size() ? groups : nullptr, + setup, hold, + recovery, removal, + clk_gating_setup, clk_gating_hold); delete groups; return ends; }