diff --git a/include/sta/Search.hh b/include/sta/Search.hh index 2c1f2504..5b3d6772 100644 --- a/include/sta/Search.hh +++ b/include/sta/Search.hh @@ -238,25 +238,26 @@ public: const RiseFall *to_rf, const MinMax *min_max, const PathAnalysisPt *path_ap); - virtual Tag *thruTag(Tag *from_tag, - Edge *edge, - const RiseFall *to_rf, - const MinMax *min_max, - const PathAnalysisPt *path_ap); - virtual Tag *thruClkTag(PathVertex *from_path, - Tag *from_tag, - bool to_propagates_clk, - Edge *edge, - const RiseFall *to_rf, - const MinMax *min_max, - const PathAnalysisPt *path_ap); + Tag *thruTag(Tag *from_tag, + Edge *edge, + const RiseFall *to_rf, + const MinMax *min_max, + const PathAnalysisPt *path_ap); + Tag *thruClkTag(PathVertex *from_path, + Tag *from_tag, + bool to_propagates_clk, + Edge *edge, + const RiseFall *to_rf, + const MinMax *min_max, + const PathAnalysisPt *path_ap); ClkInfo *thruClkInfo(PathVertex *from_path, - ClkInfo *from_tag_clk, - Edge *edge, - Vertex *to_vertex, - const Pin *to_pin, - const MinMax *min_max, - const PathAnalysisPt *path_ap); + ClkInfo *from_clk_info, + bool from_is_clk, + Edge *edge, + const Pin *to_pin, + bool to_is_clk, + const MinMax *min_max, + const PathAnalysisPt *path_ap); ClkInfo *clkInfoWithCrprClkPath(ClkInfo *from_clk_info, PathVertex *from_path, const PathAnalysisPt *path_ap); diff --git a/search/ClkInfo.hh b/search/ClkInfo.hh index 2e4c198e..3989f368 100644 --- a/search/ClkInfo.hh +++ b/search/ClkInfo.hh @@ -54,8 +54,8 @@ public: const Arrival &insertion() const { return insertion_; } ClockUncertainties *uncertainties() const { return uncertainties_; } PathAPIndex pathAPIndex() const { return path_ap_index_; } - // Clock path for the last driver in the clock network used for - // crpr resolution. + // Clock path used for crpr resolution. + // Null for clocks because the path cannot point to itself. PathVertexRep &crprClkPath() { return crpr_clk_path_; } const PathVertexRep &crprClkPath() const { return crpr_clk_path_; } VertexId crprClkVertexId() const; diff --git a/search/Crpr.cc b/search/Crpr.cc index af1b14e8..7aa9605b 100644 --- a/search/Crpr.cc +++ b/search/Crpr.cc @@ -152,13 +152,22 @@ CheckCrpr::checkCrpr1(const Path *src_path, { crpr = 0.0; crpr_pin = nullptr; - ClkInfo *src_clk_info = src_path->tag(this)->clkInfo(); + const Tag *src_tag = src_path->tag(this); + ClkInfo *src_clk_info = src_tag->clkInfo(); ClkInfo *tgt_clk_info = tgt_clk_path->tag(this)->clkInfo(); const Clock *src_clk = src_clk_info->clock(); const Clock *tgt_clk = tgt_clk_info->clock(); - const PathVertex src_clk_path1(src_clk_info->crprClkPath(), this); - const PathVertex *src_clk_path = - src_clk_path1.isNull() ? nullptr : &src_clk_path1; + PathVertex src_clk_path1; + PathVertexRep &src_crpr_clk_path = src_clk_info->crprClkPath(); + const PathVertex *src_clk_path = nullptr; + if (src_tag->isClock()) { + src_clk_path1.init(src_path->vertex(this), src_path->tag(this), this); + src_clk_path = &src_clk_path1; + } + else if (!src_crpr_clk_path.isNull()) { + src_clk_path1.init(src_crpr_clk_path, this); + src_clk_path = &src_clk_path1; + } const MinMax *src_clk_min_max = src_clk_path ? src_clk_path->minMax(this) : src_path->minMax(this); if (src_clk && tgt_clk diff --git a/search/Search.cc b/search/Search.cc index 0a22323e..9cc3d1df 100644 --- a/search/Search.cc +++ b/search/Search.cc @@ -2417,8 +2417,9 @@ Search::thruClkTag(PathVertex *from_path, && to_propagates_clk && (role->isWire() || role == TimingRole::combinational())); - ClkInfo *to_clk_info = thruClkInfo(from_path, from_clk_info, - edge, to_vertex, to_pin, min_max, path_ap); + ClkInfo *to_clk_info = thruClkInfo(from_path, from_clk_info, from_is_clk, + edge, to_pin, to_is_clk, + min_max, path_ap); Tag *to_tag = mutateTag(from_tag,from_pin,from_rf,from_is_clk,from_clk_info, to_pin, to_rf, to_is_clk, to_is_reg_clk, false, to_clk_info, nullptr, min_max, path_ap); @@ -2429,9 +2430,10 @@ Search::thruClkTag(PathVertex *from_path, ClkInfo * Search::thruClkInfo(PathVertex *from_path, ClkInfo *from_clk_info, + bool from_is_clk, Edge *edge, - Vertex *to_vertex, const Pin *to_pin, + bool to_is_clk, const MinMax *min_max, const PathAnalysisPt *path_ap) { @@ -2462,7 +2464,7 @@ Search::thruClkInfo(PathVertex *from_path, PathVertex *to_crpr_clk_path = nullptr; if (sdc_->crprActive() - && to_vertex->isRegClk()) { + && from_is_clk && !to_is_clk) { to_crpr_clk_path = from_path; changed = true; }