Skip to content

Commit 8fb0cc3

Browse files
committed
Sta::endpointSlack
Signed-off-by: James Cherry <[email protected]>
1 parent 79ddebf commit 8fb0cc3

File tree

3 files changed

+61
-34
lines changed

3 files changed

+61
-34
lines changed

include/sta/PathGroup.hh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ protected:
107107
class PathGroups : public StaState
108108
{
109109
public:
110-
PathGroups(const StaState *sta);
111110
PathGroups(int group_path_count,
112111
int endpoint_path_count,
113112
bool unique_pins,
@@ -135,6 +134,8 @@ public:
135134
PathGroup *findPathGroup(const Clock *clock,
136135
const MinMax *min_max) const;
137136
PathGroup *pathGroup(const PathEnd *path_end) const;
137+
static std::string pathGroupName(const PathEnd *path_end,
138+
const StaState *sta);
138139
static const char *asyncPathGroupName() { return async_group_name_; }
139140
static const char *pathDelayGroupName() { return path_delay_group_name_; }
140141
static const char *gatedClkGroupName() { return gated_clk_group_name_; }
@@ -178,7 +179,8 @@ protected:
178179
const MinMax *min_max);
179180
bool reportGroup(const char *group_name,
180181
PathGroupNameSet *group_names) const;
181-
GroupPath *groupPathTo(const PathEnd *path_end) const;
182+
static GroupPath *groupPathTo(const PathEnd *path_end,
183+
const StaState *sta);
182184

183185
int group_path_count_;
184186
int endpoint_path_count_;

search/PathGroup.cc

Lines changed: 54 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -248,22 +248,6 @@ const char *PathGroups::gated_clk_group_name_ = "gated clock";
248248
const char *PathGroups::async_group_name_ = "asynchronous";
249249
const char *PathGroups::unconstrained_group_name_ = "unconstrained";
250250

251-
PathGroups::PathGroups(const StaState *sta) :
252-
StaState(sta),
253-
group_path_count_(0),
254-
endpoint_path_count_(0),
255-
unique_pins_(false),
256-
slack_min_(-INF),
257-
slack_max_(INF)
258-
{
259-
makeGroups(group_path_count_, endpoint_path_count_, unique_pins_,
260-
slack_min_, slack_max_, nullptr,
261-
true, true, true, true, MinMax::max());
262-
makeGroups(group_path_count_, endpoint_path_count_, unique_pins_,
263-
slack_min_, slack_max_, nullptr,
264-
true, true, true, true, MinMax::min());
265-
}
266-
267251
PathGroups::PathGroups(int group_path_count,
268252
int endpoint_path_count,
269253
bool unique_pins,
@@ -419,7 +403,7 @@ PathGroups::pathGroup(const PathEnd *path_end) const
419403
{
420404
const MinMax *min_max = path_end->minMax(this);
421405
int mm_index = min_max->index();
422-
GroupPath *group_path = groupPathTo(path_end);
406+
GroupPath *group_path = groupPathTo(path_end, this);
423407
if (path_end->isUnconstrained())
424408
return unconstrained_[mm_index];
425409
// GroupPaths have precedence.
@@ -462,16 +446,63 @@ PathGroups::pathGroup(const PathEnd *path_end) const
462446
}
463447
}
464448

449+
// Mirrors PathGroups::pathGroup.
450+
std::string
451+
PathGroups::pathGroupName(const PathEnd *path_end,
452+
const StaState *sta)
453+
{
454+
GroupPath *group_path = groupPathTo(path_end, sta);
455+
if (path_end->isUnconstrained())
456+
return unconstrained_group_name_;
457+
// GroupPaths have precedence.
458+
else if (group_path) {
459+
if (group_path->isDefault())
460+
return path_delay_group_name_;
461+
else
462+
return group_path->name();
463+
}
464+
else if (path_end->isCheck() || path_end->isLatchCheck()) {
465+
const TimingRole *check_role = path_end->checkRole(sta);
466+
const Clock *tgt_clk = path_end->targetClk(sta);
467+
if (check_role == TimingRole::removal()
468+
|| check_role == TimingRole::recovery())
469+
return async_group_name_;
470+
else
471+
return tgt_clk->name();
472+
}
473+
else if (path_end->isOutputDelay()
474+
|| path_end->isDataCheck())
475+
return path_end->targetClk(sta)->name();
476+
else if (path_end->isGatedClock())
477+
return gated_clk_group_name_;
478+
else if (path_end->isPathDelay()) {
479+
// Path delays that end at timing checks are part of the target clk group
480+
// unless -ignore_clock_latency is true.
481+
PathDelay *path_delay = path_end->pathDelay();
482+
const Clock *tgt_clk = path_end->targetClk(sta);
483+
if (tgt_clk
484+
&& !path_delay->ignoreClkLatency())
485+
return tgt_clk->name();
486+
else
487+
return path_delay_group_name_;
488+
}
489+
else {
490+
sta->report()->critical(1391, "unknown path end type");
491+
return nullptr;
492+
}
493+
}
494+
465495
GroupPath *
466-
PathGroups::groupPathTo(const PathEnd *path_end) const
496+
PathGroups::groupPathTo(const PathEnd *path_end,
497+
const StaState *sta)
467498
{
468499
const Path *path = path_end->path();
469-
const Pin *pin = path->pin(this);
500+
const Pin *pin = path->pin(sta);
470501
ExceptionPath *exception =
471-
search_->exceptionTo(ExceptionPathType::group_path, path,
472-
pin, path->transition(this),
473-
path_end->targetClkEdge(this),
474-
path->minMax(this), false, false);
502+
sta->search()->exceptionTo(ExceptionPathType::group_path, path,
503+
pin, path->transition(sta),
504+
path_end->targetClkEdge(sta),
505+
path->minMax(sta), false, false);
475506
return dynamic_cast<GroupPath*>(exception);
476507
}
477508

search/Sta.cc

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3036,7 +3036,6 @@ class EndpointPathEndVisitor : public PathEndVisitor
30363036
{
30373037
public:
30383038
EndpointPathEndVisitor(const std::string &path_group_name,
3039-
const PathGroups &path_groups,
30403039
const MinMax *min_max,
30413040
const StaState *sta);
30423041
PathEndVisitor *copy() const;
@@ -3045,18 +3044,15 @@ class EndpointPathEndVisitor : public PathEndVisitor
30453044

30463045
private:
30473046
const std::string &path_group_name_;
3048-
const PathGroups &path_groups_;
30493047
const MinMax *min_max_;
30503048
Slack slack_;
30513049
const StaState *sta_;
30523050
};
30533051

30543052
EndpointPathEndVisitor::EndpointPathEndVisitor(const std::string &path_group_name,
3055-
const PathGroups &path_groups,
30563053
const MinMax *min_max,
30573054
const StaState *sta) :
30583055
path_group_name_(path_group_name),
3059-
path_groups_(path_groups),
30603056
min_max_(min_max),
30613057
slack_(MinMax::min()->initValue()),
30623058
sta_(sta)
@@ -3066,14 +3062,14 @@ EndpointPathEndVisitor::EndpointPathEndVisitor(const std::string &path_group_nam
30663062
PathEndVisitor *
30673063
EndpointPathEndVisitor::copy() const
30683064
{
3069-
return new EndpointPathEndVisitor(path_group_name_, path_groups_, min_max_, sta_);
3065+
return new EndpointPathEndVisitor(path_group_name_, min_max_, sta_);
30703066
}
30713067

30723068
void
30733069
EndpointPathEndVisitor::visit(PathEnd *path_end)
30743070
{
30753071
if (path_end->minMax(sta_) == min_max_
3076-
&& path_groups_.pathGroup(path_end)->name() == path_group_name_) {
3072+
&& PathGroups::pathGroupName(path_end, sta_) == path_group_name_) {
30773073
Slack end_slack = path_end->slack(sta_);
30783074
if (delayLess(end_slack, slack_, sta_))
30793075
slack_ = end_slack;
@@ -3089,10 +3085,8 @@ Sta::endpointSlack(const Pin *pin,
30893085
Vertex *vertex = graph_->pinLoadVertex(pin);
30903086
if (vertex) {
30913087
findRequired(vertex);
3092-
// Make path groups to use PathGroups::pathGroup(PathEnd).
3093-
PathGroups path_groups(this);
30943088
VisitPathEnds visit_ends(this);
3095-
EndpointPathEndVisitor path_end_visitor(path_group_name, path_groups, min_max, this);
3089+
EndpointPathEndVisitor path_end_visitor(path_group_name, min_max, this);
30963090
visit_ends.visitPathEnds(vertex, &path_end_visitor);
30973091
return path_end_visitor.slack();
30983092
}

0 commit comments

Comments
 (0)