From 0f40a90e8c9afb5e59cb024609a08f585aae460d Mon Sep 17 00:00:00 2001 From: James Cherry Date: Fri, 9 May 2025 11:28:03 -0700 Subject: [PATCH] Search::reportArrivals Signed-off-by: James Cherry --- search/ClkInfo.cc | 13 ++----------- search/ClkInfo.hh | 9 +++++++++ search/Search.cc | 29 +++++++++++++++++++++++++++++ search/Tag.cc | 29 +++++++++++++++++------------ search/Tag.hh | 7 ++++++- 5 files changed, 63 insertions(+), 24 deletions(-) diff --git a/search/ClkInfo.cc b/search/ClkInfo.cc index 8025a0ba..26a3c4d0 100644 --- a/search/ClkInfo.cc +++ b/search/ClkInfo.cc @@ -34,15 +34,6 @@ namespace sta { -static bool -clkInfoEqual(const ClkInfo *clk_info1, - const ClkInfo *clk_info2, - const StaState *sta); -static int -clkInfoCmp(const ClkInfo *clk_info1, - const ClkInfo *clk_info2, - const StaState *sta); - ClkInfo::ClkInfo(const ClockEdge *clk_edge, const Pin *clk_src, bool is_propagated, @@ -210,7 +201,7 @@ ClkInfoEqual::operator()(const ClkInfo *clk_info1, return clkInfoEqual(clk_info1, clk_info2, sta_); } -static bool +bool clkInfoEqual(const ClkInfo *clk_info1, const ClkInfo *clk_info2, const StaState *sta) @@ -253,7 +244,7 @@ ClkInfoLess::operator()(const ClkInfo *clk_info1, return clkInfoCmp(clk_info1, clk_info2, sta_) < 0; } -static int +int clkInfoCmp(const ClkInfo *clk_info1, const ClkInfo *clk_info2, const StaState *sta) diff --git a/search/ClkInfo.hh b/search/ClkInfo.hh index f4706ee1..825a182c 100644 --- a/search/ClkInfo.hh +++ b/search/ClkInfo.hh @@ -93,6 +93,15 @@ private: unsigned int path_ap_index_:path_ap_index_bit_count; }; +int +clkInfoCmp(const ClkInfo *clk_info1, + const ClkInfo *clk_info2, + const StaState *sta); +bool +clkInfoEqual(const ClkInfo *clk_info1, + const ClkInfo *clk_info2, + const StaState *sta); + class ClkInfoLess { public: diff --git a/search/Search.cc b/search/Search.cc index 3f363c96..85370049 100644 --- a/search/Search.cc +++ b/search/Search.cc @@ -2760,6 +2760,30 @@ Search::setVertexArrivals(Vertex *vertex, } } +class ReportPathLess +{ +public: + ReportPathLess(const StaState *sta); + bool operator()(const Path *path1, + const Path *path2) const; + +private: + const StaState *sta_; +}; + + +ReportPathLess::ReportPathLess(const StaState *sta) : + sta_(sta) +{ +} + +bool +ReportPathLess::operator()(const Path *path1, + const Path *path2) const +{ + return tagCmp(path1->tag(sta_), path2->tag(sta_), sta_) < 0; +} + void Search::reportArrivals(Vertex *vertex) const { @@ -2767,9 +2791,14 @@ Search::reportArrivals(Vertex *vertex) const TagGroup *tag_group = tagGroup(vertex); if (tag_group) { report_->reportLine("Group %u", tag_group->index()); + std::vector paths; VertexPathIterator path_iter(vertex, this); while (path_iter.hasNext()) { const Path *path = path_iter.next(); + paths.push_back(path); + } + sort(paths.begin(), paths.end(), ReportPathLess(this)); + for (const Path *path : paths) { const Tag *tag = path->tag(this); const PathAnalysisPt *path_ap = tag->pathAnalysisPt(this); const RiseFall *rf = tag->transition(); diff --git a/search/Tag.cc b/search/Tag.cc index d064c0f2..d4e36bae 100644 --- a/search/Tag.cc +++ b/search/Tag.cc @@ -289,26 +289,31 @@ Tag::matchHash(bool match_crpr_clk_pin, //////////////////////////////////////////////////////////////// +TagLess::TagLess(const StaState *sta) : + sta_(sta) +{ +} + bool TagLess::operator()(const Tag *tag1, const Tag *tag2) const { - return tagCmp(tag1, tag2) < 0; + return tagCmp(tag1, tag2, sta_) < 0; } int tagCmp(const Tag *tag1, - const Tag *tag2) + const Tag *tag2, + const StaState *sta) { if (tag1 == tag2) return 0; - int rf_index1 = tag1->rfIndex(); - int rf_index2 = tag2->rfIndex(); - if (rf_index1 < rf_index2) - return -1; - if (rf_index1 > rf_index2) - return 1; + ClkInfo *clk_info1 = tag1->clkInfo(); + ClkInfo *clk_info2 = tag2->clkInfo(); + int clk_cmp = clkInfoCmp(clk_info1, clk_info2, sta); + if (clk_cmp != 0) + return clk_cmp; PathAPIndex path_ap_index1 = tag1->pathAPIndex(); PathAPIndex path_ap_index2 = tag2->pathAPIndex(); @@ -317,11 +322,11 @@ tagCmp(const Tag *tag1, if (path_ap_index1 > path_ap_index2) return 1; - size_t clk_info1 = tag1->clkInfo()->hash(); - size_t clk_info2 = tag2->clkInfo()->hash(); - if (clk_info1 < clk_info2) + int rf_index1 = tag1->rfIndex(); + int rf_index2 = tag2->rfIndex(); + if (rf_index1 < rf_index2) return -1; - if (clk_info1 > clk_info2) + if (rf_index1 > rf_index2) return 1; bool is_clk1 = tag1->isClock(); diff --git a/search/Tag.hh b/search/Tag.hh index 35d46cba..3fa91de2 100644 --- a/search/Tag.hh +++ b/search/Tag.hh @@ -112,8 +112,12 @@ private: class TagLess { public: + TagLess(const StaState *sta); bool operator()(const Tag *tag1, const Tag *tag2) const; + +private: + const StaState *sta_; }; class TagIndexLess @@ -138,7 +142,8 @@ public: int tagCmp(const Tag *tag1, - const Tag *tag2); + const Tag *tag2, + const StaState *sta); // Match tag clock edge, clock driver and exception states but not clk info. bool