PathGroup::savable->saveable

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2025-01-13 16:58:47 -07:00
parent e751cd0b49
commit 96d066c7cc
2 changed files with 12 additions and 13 deletions

View File

@ -37,7 +37,7 @@ typedef Map<const char*, PathGroup*, CharPtrLess> PathGroupNamedMap;
class PathGroup class PathGroup
{ {
public: public:
virtual ~PathGroup(); ~PathGroup();
// Path group that compares compare slacks. // Path group that compares compare slacks.
static PathGroup *makePathGroupArrival(const char *name, static PathGroup *makePathGroupArrival(const char *name,
int group_path_count, int group_path_count,
@ -59,8 +59,8 @@ public:
void insert(PathEnd *path_end); void insert(PathEnd *path_end);
// Push group_path_count into path_ends. // Push group_path_count into path_ends.
void pushEnds(PathEndSeq &path_ends); void pushEnds(PathEndSeq &path_ends);
// Predicates to determine if a PathEnd is worth saving. // Predicate to determine if a PathEnd is worth saving.
virtual bool savable(PathEnd *path_end); bool saveable(PathEnd *path_end);
int maxPaths() const { return group_path_count_; } int maxPaths() const { return group_path_count_; }
PathGroupIterator *iterator(); PathGroupIterator *iterator();
// This does NOT delete the path ends. // This does NOT delete the path ends.

View File

@ -93,14 +93,13 @@ PathGroup::~PathGroup()
} }
bool bool
PathGroup::savable(PathEnd *path_end) PathGroup::saveable(PathEnd *path_end)
{ {
float threshold; float threshold;
{ {
LockGuard lock(lock_); LockGuard lock(lock_);
threshold = threshold_; threshold = threshold_;
} }
bool savable = false;
if (compare_slack_) { if (compare_slack_) {
// Crpr increases the slack, so check the slack // Crpr increases the slack, so check the slack
// without crpr first because it is expensive to find. // without crpr first because it is expensive to find.
@ -110,17 +109,17 @@ PathGroup::savable(PathEnd *path_end)
&& delayLessEqual(slack, slack_max_, sta_)) { && delayLessEqual(slack, slack_max_, sta_)) {
// Now check with crpr. // Now check with crpr.
slack = path_end->slack(sta_); slack = path_end->slack(sta_);
savable = delayLessEqual(slack, threshold, sta_) return delayLessEqual(slack, threshold, sta_)
&& delayLessEqual(slack, slack_max_, sta_) && delayLessEqual(slack, slack_max_, sta_)
&& delayGreaterEqual(slack, slack_min_, sta_); && delayGreaterEqual(slack, slack_min_, sta_);
} }
} }
else { else {
const Arrival &arrival = path_end->dataArrivalTime(sta_); const Arrival &arrival = path_end->dataArrivalTime(sta_);
savable = !delayIsInitValue(arrival, min_max_) return !delayIsInitValue(arrival, min_max_)
&& delayGreaterEqual(arrival, threshold, min_max_, sta_); && delayGreaterEqual(arrival, threshold, min_max_, sta_);
} }
return savable; return false;
} }
void void
@ -565,7 +564,7 @@ void
MakePathEnds1::visitPathEnd(PathEnd *path_end, MakePathEnds1::visitPathEnd(PathEnd *path_end,
PathGroup *group) PathGroup *group)
{ {
if (group->savable(path_end)) { if (group->saveable(path_end)) {
// Only keep the path end with the smallest slack/latest arrival. // Only keep the path end with the smallest slack/latest arrival.
PathEnd *worst_end = ends_.findKey(group); PathEnd *worst_end = ends_.findKey(group);
if (worst_end) { if (worst_end) {
@ -588,7 +587,7 @@ MakePathEnds1::vertexEnd(Vertex *)
PathGroup *group; PathGroup *group;
PathEnd *end; PathEnd *end;
group_iter.next(group, end); group_iter.next(group, end);
// visitPathEnd already confirmed slack is savable. // visitPathEnd already confirmed slack is saveable.
if (end) { if (end) {
group->insert(end); group->insert(end);
// Clear ends_ for next vertex. // Clear ends_ for next vertex.
@ -701,7 +700,7 @@ MakePathEndsAll::vertexEnd(Vertex *)
path_end->path()->tag(sta_)->index()); path_end->path()->tag(sta_)->index());
// Give the group a copy of the path end because // Give the group a copy of the path end because
// it may delete it during pruning. // it may delete it during pruning.
if (group->savable(path_end)) { if (group->saveable(path_end)) {
group->insert(path_end->copy()); group->insert(path_end->copy());
unique_ends.insert(path_end); unique_ends.insert(path_end);
n++; n++;
@ -788,7 +787,7 @@ PathGroups::enumPathEnds(PathGroup *group,
PathGroupIterator *end_iter = group->iterator(); PathGroupIterator *end_iter = group->iterator();
while (end_iter->hasNext()) { while (end_iter->hasNext()) {
PathEnd *end = end_iter->next(); PathEnd *end = end_iter->next();
if (group->savable(end)) if (group->saveable(end))
path_enum.insert(end); path_enum.insert(end);
} }
delete end_iter; delete end_iter;
@ -797,7 +796,7 @@ PathGroups::enumPathEnds(PathGroup *group,
// Parallel path enumeratation to find the endpoint_path_count/max path ends. // Parallel path enumeratation to find the endpoint_path_count/max path ends.
for (int n = 0; path_enum.hasNext() && n < group_path_count; n++) { for (int n = 0; path_enum.hasNext() && n < group_path_count; n++) {
PathEnd *end = path_enum.next(); PathEnd *end = path_enum.next();
if (group->savable(end)) if (group->saveable(end))
group->insert(end); group->insert(end);
} }
} }