From 128deaa7c02d6d33cb89f101c001754eead48634 Mon Sep 17 00:00:00 2001 From: James Cherry Date: Mon, 5 Aug 2024 16:51:46 -0700 Subject: [PATCH] issue66 set_min/max_delay -ignore_clock_latency on clock path Signed-off-by: James Cherry --- include/sta/PathEnd.hh | 5 +++++ search/PathEnd.cc | 26 ++++++++++++++++++++------ search/ReportPath.cc | 2 +- tcl/StaTclTypes.i | 1 + 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/include/sta/PathEnd.hh b/include/sta/PathEnd.hh index 8c27be9a..455b78dd 100644 --- a/include/sta/PathEnd.hh +++ b/include/sta/PathEnd.hh @@ -144,6 +144,7 @@ public: virtual const PathVertex *dataClkPath() const { return nullptr; } virtual int setupDefaultCycles() const { return 1; } virtual Delay clkSkew(const StaState *sta); + virtual bool ignoreClkLatency(const StaState * /* sta */) const { return false; } static bool less(const PathEnd *path_end1, const PathEnd *path_end2, @@ -206,6 +207,9 @@ protected: PathDelay *path_delay, Arrival src_clk_arrival, const StaState *sta); + static bool ignoreClkLatency(const PathRef &path, + PathDelay *path_delay, + const StaState *sta); PathRef path_; }; @@ -569,6 +573,7 @@ public: virtual int exceptPathCmp(const PathEnd *path_end, const StaState *sta) const; bool hasOutputDelay() const { return output_delay_ != nullptr; } + virtual bool ignoreClkLatency(const StaState *sta) const; protected: PathEndPathDelay(PathDelay *path_delay, diff --git a/search/PathEnd.cc b/search/PathEnd.cc index 9f8503d2..10c93394 100644 --- a/search/PathEnd.cc +++ b/search/PathEnd.cc @@ -1070,7 +1070,7 @@ PathEndLatchCheck::PathEndLatchCheck(Path *path, clk_path_ = enable_path; Search *search = sta->search(); // Same as PathEndPathDelay::findRequired. - if (path_delay_ && path_delay_->ignoreClkLatency()) + if (path_delay_ && ignoreClkLatency(sta)) src_clk_arrival_ = search->pathClkPathArrival(&path_); } @@ -1081,7 +1081,7 @@ PathEndLatchCheck::PathEndLatchCheck(Path *path, PathVertex *disable_path, MultiCyclePath *mcp, PathDelay *path_delay, - Delay src_clk_arrival, + Delay src_clk_arrival, Crpr crpr, bool crpr_valid) : PathEndCheck(path, check_arc, check_edge, clk_path, mcp, crpr, crpr_valid), @@ -1221,7 +1221,7 @@ PathEndLatchCheck::latchBorrowInfo(const StaState *sta, Latches *latches = sta->latches(); latches->latchBorrowInfo(path_.path(), targetClkPath(), latchDisable(), margin(sta), - path_delay_ && path_delay_->ignoreClkLatency(), + path_delay_ && ignoreClkLatency(sta), nom_pulse_width, open_latency, latency_diff, open_uncertainty, open_crpr, crpr_diff, max_borrow, @@ -1802,7 +1802,7 @@ PathEndPathDelay::typeName() const void PathEndPathDelay::findSrcClkArrival(const StaState *sta) { - if (path_delay_->ignoreClkLatency()) { + if (ignoreClkLatency(sta)) { Search *search = sta->search(); src_clk_arrival_ = search->pathClkPathArrival(&path_); } @@ -1873,7 +1873,7 @@ PathEnd::pathDelaySrcClkOffset(const PathRef &path, float offset = 0.0; const ClockEdge *clk_edge = path.clkEdge(sta); if (clk_edge) { - if (path_delay->ignoreClkLatency()) + if (ignoreClkLatency(path, path_delay, sta)) offset = -delayAsFloat(src_clk_arrival); else // Arrival includes src clock edge time that is not counted in the @@ -1883,6 +1883,14 @@ PathEnd::pathDelaySrcClkOffset(const PathRef &path, return offset; } +bool +PathEnd::ignoreClkLatency(const PathRef &path, + PathDelay *path_delay, + const StaState *sta) +{ + return path_delay->ignoreClkLatency() && !path.isClock(sta); +} + const ClockEdge * PathEndPathDelay::targetClkEdge(const StaState *sta) const { @@ -1927,7 +1935,7 @@ Required PathEndPathDelay::requiredTime(const StaState *sta) const { float delay = path_delay_->delay(); - if (path_delay_->ignoreClkLatency()) { + if (ignoreClkLatency(sta)) { if (minMax(sta) == MinMax::max()) return src_clk_arrival_ + delay - margin(sta); else @@ -1943,6 +1951,12 @@ PathEndPathDelay::requiredTime(const StaState *sta) const } } +bool +PathEndPathDelay::ignoreClkLatency(const StaState *sta) const +{ + return PathEnd::ignoreClkLatency(path_, path_delay_, sta); +} + int PathEndPathDelay::exceptPathCmp(const PathEnd *path_end, const StaState *sta) const diff --git a/search/ReportPath.cc b/search/ReportPath.cc index 662a1dba..f19f2e9e 100644 --- a/search/ReportPath.cc +++ b/search/ReportPath.cc @@ -686,7 +686,7 @@ ReportPath::reportFull(const PathEndPathDelay *end) // Based on reportSrcPathArrival. reportBlankLine(); PathDelay *path_delay = end->pathDelay(); - if (path_delay->ignoreClkLatency()) { + if (end->ignoreClkLatency(this)) { // Based on reportSrcPath. reportPathHeader(); reportPath3(end->path(), expanded, false, false, 0.0, diff --git a/tcl/StaTclTypes.i b/tcl/StaTclTypes.i index 08c30144..8a060807 100644 --- a/tcl/StaTclTypes.i +++ b/tcl/StaTclTypes.i @@ -40,6 +40,7 @@ #include "SearchClass.hh" #include "CircuitSim.hh" #include "ArcDelayCalc.hh" +#include "Property.hh" #include "Sta.hh" namespace sta {