From 90df0cfea564a9fec649719d0565217fb08a95f2 Mon Sep 17 00:00:00 2001 From: James Cherry Date: Wed, 18 Mar 2026 12:15:57 -0700 Subject: [PATCH 1/4] LibertyScanner includes Signed-off-by: James Cherry --- liberty/LibertyScanner.hh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/liberty/LibertyScanner.hh b/liberty/LibertyScanner.hh index b32369cd..a649f514 100644 --- a/liberty/LibertyScanner.hh +++ b/liberty/LibertyScanner.hh @@ -24,6 +24,10 @@ #pragma once +#include +#include + +#include "LibertyParser.hh" #include "LibertyLocation.hh" #include "LibertyParse.hh" From 464bc3ae4ff6f0d980ea31937f45a3425e97122f Mon Sep 17 00:00:00 2001 From: James Cherry Date: Wed, 18 Mar 2026 13:01:05 -0700 Subject: [PATCH 2/4] Report use string instead of string_view Signed-off-by: James Cherry --- include/sta/Report.hh | 6 +++--- include/sta/ReportTcl.hh | 6 +++--- liberty/LibertyScanner.hh | 2 -- util/Report.cc | 21 +++++++++------------ util/ReportTcl.cc | 6 +++--- 5 files changed, 18 insertions(+), 23 deletions(-) diff --git a/include/sta/Report.hh b/include/sta/Report.hh index fb42f00b..7e9aab55 100644 --- a/include/sta/Report.hh +++ b/include/sta/Report.hh @@ -138,13 +138,13 @@ public: } // Log output to filename until logEnd is called. - virtual void logBegin(std::string_view filename); + virtual void logBegin(std::string filename); virtual void logEnd(); // Redirect output to filename until redirectFileEnd is called. - virtual void redirectFileBegin(std::string_view filename); + virtual void redirectFileBegin(std::string filename); // Redirect append output to filename until redirectFileEnd is called. - virtual void redirectFileAppendBegin(std::string_view filename); + virtual void redirectFileAppendBegin(std::string filename); virtual void redirectFileEnd(); // Redirect output to a string until redirectStringEnd is called. virtual void redirectStringBegin(); diff --git a/include/sta/ReportTcl.hh b/include/sta/ReportTcl.hh index 5f4a6cd0..acdf84dc 100644 --- a/include/sta/ReportTcl.hh +++ b/include/sta/ReportTcl.hh @@ -44,10 +44,10 @@ class ReportTcl : public Report public: ReportTcl(); virtual ~ReportTcl(); - void logBegin(std::string_view filename) override; + void logBegin(std::string filename) override; void logEnd() override; - void redirectFileBegin(std::string_view filename) override; - void redirectFileAppendBegin(std::string_view filename) override; + void redirectFileBegin(std::string filename) override; + void redirectFileAppendBegin(std::string filename) override; void redirectFileEnd() override; void redirectStringBegin() override; const char *redirectStringEnd() override; diff --git a/liberty/LibertyScanner.hh b/liberty/LibertyScanner.hh index a649f514..3623940c 100644 --- a/liberty/LibertyScanner.hh +++ b/liberty/LibertyScanner.hh @@ -27,8 +27,6 @@ #include #include -#include "LibertyParser.hh" -#include "LibertyLocation.hh" #include "LibertyParse.hh" #ifndef __FLEX_LEXER_H diff --git a/util/Report.cc b/util/Report.cc index d539c574..d8a6a04d 100644 --- a/util/Report.cc +++ b/util/Report.cc @@ -185,12 +185,11 @@ Report::isSuppressed(int id) //////////////////////////////////////////////////////////////// void -Report::logBegin(std::string_view filename) +Report::logBegin(std::string filename) { - std::string filename_str(filename); - log_stream_ = fopen(filename_str.c_str(), "w"); + log_stream_ = fopen(filename.c_str(), "w"); if (log_stream_ == nullptr) - throw FileNotWritable(std::move(filename_str)); + throw FileNotWritable(std::move(filename)); } void @@ -202,21 +201,19 @@ Report::logEnd() } void -Report::redirectFileBegin(std::string_view filename) +Report::redirectFileBegin(std::string filename) { - std::string filename_str(filename); - redirect_stream_ = fopen(filename_str.c_str(), "w"); + redirect_stream_ = fopen(filename.c_str(), "w"); if (redirect_stream_ == nullptr) - throw FileNotWritable(std::move(filename_str)); + throw FileNotWritable(std::move(filename)); } void -Report::redirectFileAppendBegin(std::string_view filename) +Report::redirectFileAppendBegin(std::string filename) { - std::string filename_str(filename); - redirect_stream_ = fopen(filename_str.c_str(), "a"); + redirect_stream_ = fopen(filename.c_str(), "a"); if (redirect_stream_ == nullptr) - throw FileNotWritable(std::move(filename_str)); + throw FileNotWritable(std::move(filename)); } void diff --git a/util/ReportTcl.cc b/util/ReportTcl.cc index a418a53a..97eef4af 100644 --- a/util/ReportTcl.cc +++ b/util/ReportTcl.cc @@ -183,7 +183,7 @@ ReportTcl::flush() // Tcl_Main can eval multiple commands before the flushing the command // output, so the log/redirect commands must force a flush. void -ReportTcl::logBegin(std::string_view filename) +ReportTcl::logBegin(std::string filename) { flush(); Report::logBegin(filename); @@ -197,14 +197,14 @@ ReportTcl::logEnd() } void -ReportTcl::redirectFileBegin(std::string_view filename) +ReportTcl::redirectFileBegin(std::string filename) { flush(); Report::redirectFileBegin(filename); } void -ReportTcl::redirectFileAppendBegin(std::string_view filename) +ReportTcl::redirectFileAppendBegin(std::string filename) { flush(); Report::redirectFileAppendBegin(filename); From 0b491ce1906dc9d96a1a3342cf518bde401a252b Mon Sep 17 00:00:00 2001 From: James Cherry Date: Wed, 18 Mar 2026 16:12:04 -0700 Subject: [PATCH 3/4] Delay float coercion for non-ssta applications Signed-off-by: James Cherry --- include/sta/Delay.hh | 4 ++++ search/Path.cc | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/sta/Delay.hh b/include/sta/Delay.hh index dae429af..d34f635c 100644 --- a/include/sta/Delay.hh +++ b/include/sta/Delay.hh @@ -63,6 +63,10 @@ public: void setSkewness(float skewness); void operator=(float delay); + // This allows applications that do not support statistical timing + // to treat Delays as floats without explicitly converting with + // delayAsFloat. + operator float() const { return mean(); } private: std::array values_; diff --git a/search/Path.cc b/search/Path.cc index c0bb35d1..e7f78bde 100644 --- a/search/Path.cc +++ b/search/Path.cc @@ -50,8 +50,8 @@ Path::Path() : Path::Path(const Path *path) : prev_path_(path ? path->prev_path_ : nullptr), - arrival_(path ? path->arrival_ : 0.0), - required_(path ? path->required_ : 0.0), + arrival_(path ? path->arrival_ : delay_zero), + required_(path ? path->required_ : delay_zero), vertex_id_(path ? path->vertex_id_ : vertex_id_null), tag_index_(path ? path->tag_index_ : tag_index_null), is_enum_(path ? path->is_enum_ : false), From 73c2cca24c930abd573c9d33b3d2b158319693bb Mon Sep 17 00:00:00 2001 From: James Cherry Date: Wed, 18 Mar 2026 16:33:15 -0700 Subject: [PATCH 4/4] delayAsString Signed-off-by: James Cherry --- dcalc/Delay.cc | 8 ++++++++ include/sta/Delay.hh | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/dcalc/Delay.cc b/dcalc/Delay.cc index c40bd429..48c867a3 100644 --- a/dcalc/Delay.cc +++ b/dcalc/Delay.cc @@ -223,6 +223,14 @@ delayAsString(const Delay &delay, sta->units()->timeUnit()->digits(), sta); } +std::string +delayAsString(const Delay &delay, + int digits, + const StaState *sta) +{ + return delayAsString(delay, EarlyLate::late(), digits, sta); +} + std::string delayAsString(const Delay &delay, const EarlyLate *early_late, diff --git a/include/sta/Delay.hh b/include/sta/Delay.hh index d34f635c..e2547557 100644 --- a/include/sta/Delay.hh +++ b/include/sta/Delay.hh @@ -207,9 +207,15 @@ void delaySetMean(Delay &delay, float mean); +// early_late == late std::string delayAsString(const Delay &delay, const StaState *sta); +// early_late == late +std::string +delayAsString(const Delay &delay, + int digits, + const StaState *sta); std::string delayAsString(const Delay &delay, const EarlyLate *early_late,