Skip to content

Commit

Permalink
Sta::findPathEnds return seq
Browse files Browse the repository at this point in the history
Signed-off-by: James Cherry <[email protected]>
  • Loading branch information
jjcherry56 committed Jan 20, 2023
1 parent 4b009e5 commit 865970e
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 107 deletions.
17 changes: 8 additions & 9 deletions include/sta/PathGroup.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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_; }
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
39 changes: 19 additions & 20 deletions include/sta/Search.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
78 changes: 39 additions & 39 deletions include/sta/Sta.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
18 changes: 9 additions & 9 deletions search/PathGroup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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<PathGroup *> groups;
Expand Down Expand Up @@ -477,7 +477,7 @@ typedef Set<PathEnd*, PathEndNoCrprLess> PathEndNoCrprSet;
static bool
exceptionToEmpty(ExceptionTo *to);

PathEndSeq *
PathEndSeq
PathGroups::makePathEnds(ExceptionTo *to,
bool unconstrained_paths,
const Corner *corner,
Expand All @@ -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<int>(path_ends->size()) > group_count_)
path_ends->resize(group_count_);
if (static_cast<int>(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);

Expand Down
8 changes: 4 additions & 4 deletions search/Search.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}
Expand Down
30 changes: 14 additions & 16 deletions search/Sta.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
24 changes: 14 additions & 10 deletions tcl/StaTcl.i
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,10 @@ using namespace sta;
Tcl_SetObjResult(interp, list);
}

%typemap(out) PathEndSeq {
seqTclList<PathEndSeq, PathEnd>($1, SWIGTYPE_p_PathEnd, interp);
}

%typemap(out) MinPulseWidthCheckSeqIterator* {
Tcl_Obj *obj = SWIG_NewInstanceObj($1, $1_descriptor, false);
Tcl_SetObjResult(interp, obj);
Expand Down Expand Up @@ -4153,7 +4157,7 @@ set_propagate_all_clocks(bool prop)

////////////////////////////////////////////////////////////////

PathEndSeq *
PathEndSeq
find_path_ends(ExceptionFrom *from,
ExceptionThruSeq *thrus,
ExceptionTo *to,
Expand All @@ -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;
}
Expand Down

0 comments on commit 865970e

Please sign in to comment.