update STA to Parallaxsw version on 4/7 with fix for issue 416 and some unrelated stuff

Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
This commit is contained in:
dsengupta0628 2026-04-07 12:59:25 +00:00
commit 3eec04f4e8
38 changed files with 806 additions and 939 deletions

View File

@ -236,7 +236,6 @@ private:
int pin_n_; int pin_n_;
ArnoldiReduce *reduce_; ArnoldiReduce *reduce_;
delay_work *delay_work_; delay_work *delay_work_;
std::vector<rcmodel*> unsaved_parasitics_;
}; };
ArcDelayCalc * ArcDelayCalc *
@ -247,6 +246,7 @@ makeArnoldiDelayCalc(StaState *sta)
ArnoldiDelayCalc::ArnoldiDelayCalc(StaState *sta) : ArnoldiDelayCalc::ArnoldiDelayCalc(StaState *sta) :
LumpedCapDelayCalc(sta), LumpedCapDelayCalc(sta),
rcmodel_(nullptr),
reduce_(new ArnoldiReduce(sta)), reduce_(new ArnoldiReduce(sta)),
delay_work_(delay_work_create()) delay_work_(delay_work_create())
{ {
@ -267,6 +267,7 @@ ArnoldiDelayCalc::~ArnoldiDelayCalc()
free(_delayV); free(_delayV);
free(_slewV); free(_slewV);
delete reduce_; delete reduce_;
delete rcmodel_;
} }
Parasitic * Parasitic *
@ -297,12 +298,11 @@ ArnoldiDelayCalc::findParasitic(const Pin *drvr_pin,
} }
if (parasitic_network) { if (parasitic_network) {
rcmodel *rcmodel = reduce_->reduceToArnoldi(parasitic_network, drvr_pin, rcmodel_ = reduce_->reduceToArnoldi(parasitic_network, drvr_pin,
parasitics->couplingCapFactor(), parasitics->couplingCapFactor(),
drvr_rf, scene, min_max); drvr_rf, scene, min_max);
// Arnoldi parasitics are their own class that are not saved in the parasitic db. // Arnoldi parasitics are their own class that are not saved in the parasitic db.
unsaved_parasitics_.push_back(rcmodel); parasitic = rcmodel_;
parasitic = rcmodel;
} }
return parasitic; return parasitic;
} }
@ -321,9 +321,8 @@ ArnoldiDelayCalc::reduceParasitic(const Parasitic *,
void void
ArnoldiDelayCalc::finishDrvrPin() ArnoldiDelayCalc::finishDrvrPin()
{ {
for (auto parasitic : unsaved_parasitics_) delete rcmodel_;
delete parasitic; rcmodel_ = nullptr;
unsaved_parasitics_.clear();
} }
ArcDcalcResult ArcDcalcResult

View File

@ -445,14 +445,13 @@ CcsCeffDelayCalc::findVlTime(double v,
{ {
double t_init = region_ramp_times_[0]; double t_init = region_ramp_times_[0];
double t_final = region_ramp_times_[region_count_]; double t_final = region_ramp_times_[region_count_];
bool root_fail = false; auto [time, failed] =
double time = findRoot( findRoot([&](double t, double &y, double &dy) {
[&](double t, double &y, double &dy) { vl(t, elmore, y, dy);
vl(t, elmore, y, dy); y -= v;
y -= v; },
}, t_init, t_final + elmore * 3.0, .001, 20);
t_init, t_final + elmore * 3.0, .001, 20, root_fail); vl_fail_ |= failed;
vl_fail_ |= root_fail;
return time; return time;
} }

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,9 @@
#pragma once #pragma once
#include <optional>
#include <utility>
#include "LibertyClass.hh" #include "LibertyClass.hh"
#include "LumpedCapDelayCalc.hh" #include "LumpedCapDelayCalc.hh"
@ -71,13 +74,10 @@ protected:
// Return values. // Return values.
double &wire_delay, double &wire_delay,
double &load_slew) = 0; double &load_slew) = 0;
void gateDelaySlew(// Return values. std::pair<double, double> gateDelaySlew();
double &delay, std::optional<std::pair<double, double>>
double &slew); loadDelaySlewElmore(const Pin *load_pin,
void loadDelaySlewElmore(const Pin *load_pin, double elmore);
double elmore,
double &delay,
double &slew);
// Select the appropriate special case Dartu/Menezes/Pileggi algorithm. // Select the appropriate special case Dartu/Menezes/Pileggi algorithm.
void setCeffAlgorithm(const LibertyLibrary *library, void setCeffAlgorithm(const LibertyLibrary *library,
const LibertyCell *cell, const LibertyCell *cell,

View File

@ -125,8 +125,12 @@ DmpCeffElmoreDelayCalc::loadDelaySlew(const Pin *load_pin,
float elmore = 0.0; float elmore = 0.0;
if (parasitic) if (parasitic)
parasitics_->findElmore(parasitic, load_pin, elmore, elmore_exists); parasitics_->findElmore(parasitic, load_pin, elmore, elmore_exists);
if (elmore_exists) if (elmore_exists) {
loadDelaySlewElmore(load_pin, elmore, wire_delay, load_slew); if (auto r = loadDelaySlewElmore(load_pin, elmore)) {
wire_delay = r->first;
load_slew = r->second;
}
}
thresholdAdjust(load_pin, drvr_library, rf, wire_delay, load_slew); thresholdAdjust(load_pin, drvr_library, rf, wire_delay, load_slew);
} }

View File

@ -28,47 +28,38 @@
namespace sta { namespace sta {
double std::pair<double, bool>
findRoot(FindRootFunc func, findRoot(FindRootFunc func,
double x1, double x1,
double x2, double x2,
double x_tol, double x_tol,
int max_iter, int max_iter)
// Return value.
bool &fail)
{ {
double y1, y2, dy1; double y1, y2, dy1;
func(x1, y1, dy1); func(x1, y1, dy1);
func(x2, y2, dy1); func(x2, y2, dy1);
return findRoot(func, x1, y1, x2, y2, x_tol, max_iter, fail); return findRoot(func, x1, y1, x2, y2, x_tol, max_iter);
} }
double std::pair<double, bool>
findRoot(FindRootFunc func, findRoot(FindRootFunc func,
double x1, double x1,
double y1, double y1,
double x2, double x2,
double y2, double y2,
double x_tol, double x_tol,
int max_iter, int max_iter)
// Return value.
bool &fail)
{ {
if ((y1 > 0.0 && y2 > 0.0) || (y1 < 0.0 && y2 < 0.0)) { if ((y1 > 0.0 && y2 > 0.0) || (y1 < 0.0 && y2 < 0.0)) {
// Initial bounds do not surround a root. // Initial bounds do not surround a root.
fail = true; return {0.0, true};
return 0.0;
} }
if (y1 == 0.0) { if (y1 == 0.0)
fail = false; return {x1, false};
return x1;
}
if (y2 == 0.0) { if (y2 == 0.0)
fail = false; return {x2, false};
return x2;
}
if (y1 > 0.0) if (y1 > 0.0)
// Swap x1/x2 so func(x1) < 0. // Swap x1/x2 so func(x1) < 0.
@ -95,8 +86,7 @@ findRoot(FindRootFunc func,
} }
if (std::abs(dx) <= x_tol * std::abs(root)) { if (std::abs(dx) <= x_tol * std::abs(root)) {
// Converged. // Converged.
fail = false; return {root, false};
return root;
} }
func(root, y, dy); func(root, y, dy);
@ -105,8 +95,7 @@ findRoot(FindRootFunc func,
else else
x2 = root; x2 = root;
} }
fail = true; return {root, true};
return root;
} }
} // namespace } // namespace

View File

@ -25,6 +25,7 @@
#pragma once #pragma once
#include <functional> #include <functional>
#include <utility>
namespace sta { namespace sta {
@ -33,24 +34,22 @@ using FindRootFunc = const std::function<void (double x,
double &y, double &y,
double &dy)>; double &dy)>;
double // first: root estimate; second: true if the search failed.
std::pair<double, bool>
findRoot(FindRootFunc func, findRoot(FindRootFunc func,
double x1, double x1,
double x2, double x2,
double x_tol, double x_tol,
int max_iter, int max_iter);
// Return value.
bool &fail);
double // first: root estimate; second: true if the search failed.
std::pair<double, bool>
findRoot(FindRootFunc func, findRoot(FindRootFunc func,
double x1, double x1,
double y1, double y1,
double x2, double x2,
double y2, double y2,
double x_tol, double x_tol,
int max_iter, int max_iter);
// Return value.
bool &fail);
} // namespace } // namespace

View File

@ -648,12 +648,12 @@ GraphDelayCalc::findInputArcDelay(const Pin *drvr_pin,
LoadPinIndexMap load_pin_index_map = makeLoadPinIndexMap(drvr_vertex); LoadPinIndexMap load_pin_index_map = makeLoadPinIndexMap(drvr_vertex);
ArcDcalcResult intrinsic_result = ArcDcalcResult intrinsic_result =
arc_delay_calc->gateDelay(drvr_pin, arc, Slew(from_slew), 0.0, nullptr, arc_delay_calc->gateDelay(drvr_pin, arc, from_slew, 0.0, nullptr,
load_pin_index_map, scene, min_max); load_pin_index_map, scene, min_max);
const ArcDelay &intrinsic_delay = intrinsic_result.gateDelay(); const ArcDelay &intrinsic_delay = intrinsic_result.gateDelay();
ArcDcalcResult gate_result = arc_delay_calc->gateDelay(drvr_pin, arc, ArcDcalcResult gate_result = arc_delay_calc->gateDelay(drvr_pin, arc,
Slew(from_slew), load_cap, from_slew, load_cap,
parasitic, parasitic,
load_pin_index_map, load_pin_index_map,
scene, min_max); scene, min_max);

View File

@ -194,8 +194,8 @@ PrimaDelayCalc::gateDelay(const Pin *drvr_pin,
ArcDcalcArgSeq dcalc_args; ArcDcalcArgSeq dcalc_args;
dcalc_args.emplace_back(nullptr, drvr_pin, nullptr, arc, in_slew, load_cap, dcalc_args.emplace_back(nullptr, drvr_pin, nullptr, arc, in_slew, load_cap,
parasitic); parasitic);
ArcDcalcResultSeq dcalc_results = ArcDcalcResultSeq dcalc_results = gateDelays(dcalc_args, load_pin_index_map,
gateDelays(dcalc_args, load_pin_index_map, scene, min_max); scene, min_max);
return dcalc_results[0]; return dcalc_results[0];
} }
@ -399,6 +399,7 @@ void
PrimaDelayCalc::initSim() PrimaDelayCalc::initSim()
{ {
ceff_.resize(drvr_count_); ceff_.resize(drvr_count_);
ceff_vth_.resize(drvr_count_);
drvr_current_.resize(drvr_count_); drvr_current_.resize(drvr_count_);
findNodeCount(); findNodeCount();
@ -615,8 +616,12 @@ PrimaDelayCalc::updateCeffIdrvr()
if (drvr_rf_ == RiseFall::rise()) { if (drvr_rf_ == RiseFall::rise()) {
if (drvr_current != 0.0 && dv > 0.0) { if (drvr_current != 0.0 && dv > 0.0) {
double ceff = drvr_current * time_step_ / dv; double ceff = drvr_current * time_step_ / dv;
if (output_waveforms_[drvr_idx]->capAxis()->inBounds(ceff)) if (output_waveforms_[drvr_idx]->capAxis()->inBounds(ceff)) {
ceff_[drvr_idx] = ceff; ceff_[drvr_idx] = ceff;
// Record the Ceff at Vth.
if (v1 >= vth_ && v2 < vth_)
ceff_vth_[drvr_idx] = ceff;
}
} }
if (v1 > (vdd_ - .01)) if (v1 > (vdd_ - .01))
// Whoa partner. Head'n for the weeds. // Whoa partner. Head'n for the weeds.
@ -628,8 +633,12 @@ PrimaDelayCalc::updateCeffIdrvr()
else { else {
if (drvr_current != 0.0 && dv < 0.0) { if (drvr_current != 0.0 && dv < 0.0) {
double ceff = drvr_current * time_step_ / dv; double ceff = drvr_current * time_step_ / dv;
if (output_waveforms_[drvr_idx]->capAxis()->inBounds(ceff)) if (output_waveforms_[drvr_idx]->capAxis()->inBounds(ceff)) {
ceff_[drvr_idx] = ceff; ceff_[drvr_idx] = ceff;
// Record the Ceff at Vth.
if (v1 <= vth_ && v2 > vth_)
ceff_vth_[drvr_idx] = ceff;
}
} }
if (v1 < 0.01) { if (v1 < 0.01) {
// Whoa partner. Head'n for the weeds. // Whoa partner. Head'n for the weeds.
@ -711,8 +720,13 @@ PrimaDelayCalc::dcalcResults()
float ref_time = output_waveforms_[drvr_idx]->referenceTime(dcalc_arg.inSlewFlt()); float ref_time = output_waveforms_[drvr_idx]->referenceTime(dcalc_arg.inSlewFlt());
double gate_delay = drvr_times[threshold_vth] - ref_time; double gate_delay = drvr_times[threshold_vth] - ref_time;
double drvr_slew = std::abs(drvr_times[threshold_vh] - drvr_times[threshold_vl]); double drvr_slew = std::abs(drvr_times[threshold_vh] - drvr_times[threshold_vl]);
dcalc_result.setGateDelay(gate_delay);
dcalc_result.setDrvrSlew(drvr_slew); ArcDelay gate_delay2(gate_delay);
Slew drvr_slew2(drvr_slew);
delaySlewPocv(dcalc_arg, drvr_idx, gate_delay2, drvr_slew2);
dcalc_result.setGateDelay(gate_delay2);
dcalc_result.setDrvrSlew(drvr_slew2);
debugPrint(debug_, "ccs_dcalc", 2, "{} gate delay {} slew {}", debugPrint(debug_, "ccs_dcalc", 2, "{} gate delay {} slew {}",
network_->pathName(drvr_pin), delayAsString(gate_delay, this), network_->pathName(drvr_pin), delayAsString(gate_delay, this),
delayAsString(drvr_slew, this)); delayAsString(drvr_slew, this));
@ -740,6 +754,28 @@ PrimaDelayCalc::dcalcResults()
return dcalc_results; return dcalc_results;
} }
// Fill in pocv parameters in gate_delay/drvr_slew.
void
PrimaDelayCalc::delaySlewPocv(ArcDcalcArg &dcalc_arg,
size_t drvr_idx,
ArcDelay &gate_delay,
Slew &drvr_slew)
{
if (variables_->pocvEnabled()) {
GateTableModel *table_model = dcalc_arg.arc()->gateTableModel(scene_, min_max_);
if (table_model) {
double ceff = ceff_vth_[drvr_idx];
if (ceff == 0.0)
ceff = dcalc_arg.loadCap();
float in_slew = delayAsFloat(dcalc_arg.inSlew());
const Pvt *pvt = pinPvt(dcalc_arg.drvrPin(), scene_, min_max_);
table_model->gateDelayPocv(pvt, in_slew, ceff, min_max_,
variables_->pocvMode(),
gate_delay, drvr_slew);
}
}
}
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
void void
@ -895,7 +931,7 @@ std::string
PrimaDelayCalc::reportGateDelay(const Pin *drvr_pin, PrimaDelayCalc::reportGateDelay(const Pin *drvr_pin,
const TimingArc *arc, const TimingArc *arc,
const Slew &in_slew, const Slew &in_slew,
float load_cap, float,
const Parasitic *, const Parasitic *,
const LoadPinIndexMap &, const LoadPinIndexMap &,
const Scene *scene, const Scene *scene,
@ -905,8 +941,9 @@ PrimaDelayCalc::reportGateDelay(const Pin *drvr_pin,
GateTimingModel *model = arc->gateModel(scene, min_max); GateTimingModel *model = arc->gateModel(scene, min_max);
if (model) { if (model) {
float in_slew1 = delayAsFloat(in_slew); float in_slew1 = delayAsFloat(in_slew);
float ceff = ceff_vth_[0];
return model->reportGateDelay(pinPvt(drvr_pin, scene, min_max), return model->reportGateDelay(pinPvt(drvr_pin, scene, min_max),
in_slew1, load_cap, min_max, in_slew1, ceff, min_max,
PocvMode::scalar, digits); PocvMode::scalar, digits);
} }
return ""; return "";

View File

@ -108,6 +108,10 @@ public:
Waveform watchWaveform(const Pin *pin) override; Waveform watchWaveform(const Pin *pin) override;
protected: protected:
void delaySlewPocv(ArcDcalcArg &dcalc_arg,
size_t drvr_idx,
ArcDelay &gate_delay,
Slew &drvr_slew);
ArcDcalcResultSeq tableDcalcResults(); ArcDcalcResultSeq tableDcalcResults();
void simulate(); void simulate();
void simulate1(const MatrixSd &G, void simulate1(const MatrixSd &G,
@ -215,6 +219,8 @@ protected:
// Indexed by driver index. // Indexed by driver index.
std::vector<double> ceff_; std::vector<double> ceff_;
// Ceff at Vth
std::vector<double> ceff_vth_;
std::vector<double> drvr_current_; std::vector<double> drvr_current_;
double time_step_; double time_step_;

View File

@ -56,8 +56,8 @@ using ConcretePortMemberIterator = VectorIterator<ConcretePortSeq, ConcretePort*
class ConcreteLibrary class ConcreteLibrary
{ {
public: public:
ConcreteLibrary(std::string name, ConcreteLibrary(std::string_view name,
std::string filename, std::string_view filename,
bool is_liberty); bool is_liberty);
virtual ~ConcreteLibrary(); virtual ~ConcreteLibrary();
const std::string &name() const { return name_; } const std::string &name() const { return name_; }

View File

@ -24,14 +24,15 @@
#pragma once #pragma once
#include <algorithm>
#include <functional>
#include <map>
#include <ranges>
#include <set>
#include <string_view>
#include <type_traits> #include <type_traits>
#include <utility> // for std::declval #include <utility> // for std::declval
#include <map>
#include <set>
#include <vector> #include <vector>
#include <algorithm>
#include <ranges>
#include <functional>
namespace sta { namespace sta {

View File

@ -40,67 +40,56 @@ class Report;
PortSeq PortSeq
filterPorts(std::string_view filter_expression, filterPorts(std::string_view filter_expression,
PortSeq *objects, PortSeq *objects,
bool bool_props_as_int,
Sta *sta); Sta *sta);
InstanceSeq InstanceSeq
filterInstances(std::string_view filter_expression, filterInstances(std::string_view filter_expression,
InstanceSeq *objects, InstanceSeq *objects,
bool bool_props_as_int,
Sta *sta); Sta *sta);
PinSeq PinSeq
filterPins(std::string_view filter_expression, filterPins(std::string_view filter_expression,
PinSeq *objects, PinSeq *objects,
bool bool_props_as_int,
Sta *sta); Sta *sta);
NetSeq NetSeq
filterNets(std::string_view filter_expression, filterNets(std::string_view filter_expression,
NetSeq *objects, NetSeq *objects,
bool bool_props_as_int,
Sta *sta); Sta *sta);
ClockSeq ClockSeq
filterClocks(std::string_view filter_expression, filterClocks(std::string_view filter_expression,
ClockSeq *objects, ClockSeq *objects,
bool bool_props_as_int,
Sta *sta); Sta *sta);
LibertyCellSeq LibertyCellSeq
filterLibCells(std::string_view filter_expression, filterLibCells(std::string_view filter_expression,
LibertyCellSeq *objects, LibertyCellSeq *objects,
bool bool_props_as_int,
Sta *sta); Sta *sta);
LibertyPortSeq LibertyPortSeq
filterLibPins(std::string_view filter_expression, filterLibPins(std::string_view filter_expression,
LibertyPortSeq *objects, LibertyPortSeq *objects,
bool bool_props_as_int,
Sta *sta); Sta *sta);
LibertyLibrarySeq LibertyLibrarySeq
filterLibertyLibraries(std::string_view filter_expression, filterLibertyLibraries(std::string_view filter_expression,
LibertyLibrarySeq *objects, LibertyLibrarySeq *objects,
bool bool_props_as_int,
Sta *sta); Sta *sta);
EdgeSeq EdgeSeq
filterTimingArcs(std::string_view filter_expression, filterTimingArcs(std::string_view filter_expression,
EdgeSeq *objects, EdgeSeq *objects,
bool bool_props_as_int,
Sta *sta); Sta *sta);
PathEndSeq PathEndSeq
filterPathEnds(std::string_view filter_expression, filterPathEnds(std::string_view filter_expression,
PathEndSeq *objects, PathEndSeq *objects,
bool bool_props_as_int,
Sta *sta); Sta *sta);
// For FilterExpr unit tests. // For FilterExpr unit tests.
StringSeq StringSeq
filterExprToPostfix(std::string_view expr, filterExprToPostfix(std::string_view expr,
bool bool_props_as_int,
Report *report); Report *report);
} // namespace } // namespace

View File

@ -69,7 +69,7 @@ class DriverWaveform;
class ModeValueDef class ModeValueDef
{ {
public: public:
ModeValueDef(std::string value); ModeValueDef(std::string_view value);
ModeValueDef(ModeValueDef &&other) noexcept; ModeValueDef(ModeValueDef &&other) noexcept;
~ModeValueDef(); ~ModeValueDef();
const std::string &value() const { return value_; } const std::string &value() const { return value_; }
@ -204,8 +204,8 @@ timingSenseOpposite(TimingSense sense);
class LibertyLibrary : public ConcreteLibrary class LibertyLibrary : public ConcreteLibrary
{ {
public: public:
LibertyLibrary(std::string name, LibertyLibrary(std::string_view name,
std::string filename); std::string_view filename);
virtual ~LibertyLibrary(); virtual ~LibertyLibrary();
LibertyCell *findLibertyCell(std::string_view name) const; LibertyCell *findLibertyCell(std::string_view name) const;
LibertyCellSeq findLibertyCellsMatching(PatternMatch *pattern); LibertyCellSeq findLibertyCellsMatching(PatternMatch *pattern);
@ -215,12 +215,12 @@ public:
DelayModelType delayModelType() const { return delay_model_type_; } DelayModelType delayModelType() const { return delay_model_type_; }
void setDelayModelType(DelayModelType type); void setDelayModelType(DelayModelType type);
BusDcl *makeBusDcl(std::string name, BusDcl *makeBusDcl(std::string_view name,
int from, int from,
int to); int to);
BusDcl *findBusDcl(std::string_view name); BusDcl *findBusDcl(std::string_view name);
BusDclSeq busDcls() const; BusDclSeq busDcls() const;
TableTemplate *makeTableTemplate(std::string name, TableTemplate *makeTableTemplate(std::string_view name,
TableTemplateType type); TableTemplateType type);
TableTemplate *findTableTemplate(std::string_view name, TableTemplate *findTableTemplate(std::string_view name,
TableTemplateType type); TableTemplateType type);
@ -235,7 +235,7 @@ public:
void setScaleFactors(ScaleFactors *scales); void setScaleFactors(ScaleFactors *scales);
// Make named scale factor group. Returns pointer to the inserted element. // Make named scale factor group. Returns pointer to the inserted element.
ScaleFactors *makeScaleFactors(std::string name); ScaleFactors *makeScaleFactors(std::string_view name);
ScaleFactors *findScaleFactors(std::string_view name); ScaleFactors *findScaleFactors(std::string_view name);
ScaleFactors *scaleFactors() const { return scale_factors_; } ScaleFactors *scaleFactors() const { return scale_factors_; }
float scaleFactor(ScaleFactorType type, float scaleFactor(ScaleFactorType type,
@ -336,18 +336,18 @@ public:
Units *units() { return units_; } Units *units() { return units_; }
const Units *units() const { return units_; } const Units *units() const { return units_; }
Wireload *makeWireload(std::string name); Wireload *makeWireload(std::string_view name);
const Wireload *findWireload(std::string_view name); const Wireload *findWireload(std::string_view name);
void setDefaultWireload(const Wireload *wireload); void setDefaultWireload(const Wireload *wireload);
const Wireload *defaultWireload() const; const Wireload *defaultWireload() const;
WireloadSelection *makeWireloadSelection(std::string name); WireloadSelection *makeWireloadSelection(std::string_view name);
const WireloadSelection *findWireloadSelection(std::string_view name) const; const WireloadSelection *findWireloadSelection(std::string_view name) const;
const WireloadSelection *defaultWireloadSelection() const; const WireloadSelection *defaultWireloadSelection() const;
WireloadMode defaultWireloadMode() const; WireloadMode defaultWireloadMode() const;
void setDefaultWireloadMode(WireloadMode mode); void setDefaultWireloadMode(WireloadMode mode);
void setDefaultWireloadSelection(const WireloadSelection *selection); void setDefaultWireloadSelection(const WireloadSelection *selection);
OperatingConditions *makeOperatingConditions(std::string name); OperatingConditions *makeOperatingConditions(std::string_view name);
OperatingConditions *findOperatingConditions(std::string_view name); OperatingConditions *findOperatingConditions(std::string_view name);
OperatingConditions *defaultOperatingConditions() const; OperatingConditions *defaultOperatingConditions() const;
void setDefaultOperatingConditions(OperatingConditions *op_cond); void setDefaultOperatingConditions(OperatingConditions *op_cond);
@ -358,9 +358,9 @@ public:
void setOcvArcDepth(float depth); void setOcvArcDepth(float depth);
OcvDerate *defaultOcvDerate() const; OcvDerate *defaultOcvDerate() const;
void setDefaultOcvDerate(OcvDerate *derate); void setDefaultOcvDerate(OcvDerate *derate);
OcvDerate *makeOcvDerate(std::string name); OcvDerate *makeOcvDerate(std::string_view name);
OcvDerate *findOcvDerate(std::string_view derate_name); OcvDerate *findOcvDerate(std::string_view derate_name);
void addSupplyVoltage(std::string suppy_name, void addSupplyVoltage(std::string_view suppy_name,
float voltage); float voltage);
bool supplyExists(std::string_view supply_name) const; bool supplyExists(std::string_view supply_name) const;
void supplyVoltage(std::string_view supply_name, void supplyVoltage(std::string_view supply_name,
@ -369,8 +369,8 @@ public:
bool &exists) const; bool &exists) const;
// Make scaled cell. Call LibertyCell::addScaledCell after it is complete. // Make scaled cell. Call LibertyCell::addScaledCell after it is complete.
LibertyCell *makeScaledCell(std::string name, LibertyCell *makeScaledCell(std::string_view name,
std::string filename); std::string_view filename);
static void static void
makeSceneMap(LibertyLibrary *lib, makeSceneMap(LibertyLibrary *lib,
@ -395,7 +395,7 @@ public:
DriverWaveform *findDriverWaveform(std::string_view name); DriverWaveform *findDriverWaveform(std::string_view name);
DriverWaveform *driverWaveformDefault() { return findDriverWaveform(""); } DriverWaveform *driverWaveformDefault() { return findDriverWaveform(""); }
DriverWaveform *makeDriverWaveform(std::string name, DriverWaveform *makeDriverWaveform(std::string_view name,
TablePtr waveforms); TablePtr waveforms);
protected: protected:
@ -474,8 +474,8 @@ class LibertyCell : public ConcreteCell
{ {
public: public:
LibertyCell(LibertyLibrary *library, LibertyCell(LibertyLibrary *library,
std::string name, std::string_view name,
std::string filename); std::string_view filename);
virtual ~LibertyCell(); virtual ~LibertyCell();
LibertyLibrary *libertyLibrary() const { return liberty_library_; } LibertyLibrary *libertyLibrary() const { return liberty_library_; }
LibertyLibrary *libertyLibrary() { return liberty_library_; } LibertyLibrary *libertyLibrary() { return liberty_library_; }
@ -484,7 +484,7 @@ public:
bool hasInternalPorts() const { return has_internal_ports_; } bool hasInternalPorts() const { return has_internal_ports_; }
ScaleFactors *scaleFactors() const { return scale_factors_; } ScaleFactors *scaleFactors() const { return scale_factors_; }
void setScaleFactors(ScaleFactors *scale_factors); void setScaleFactors(ScaleFactors *scale_factors);
ModeDef *makeModeDef(std::string name); ModeDef *makeModeDef(std::string_view name);
const ModeDef *findModeDef(std::string_view name) const; const ModeDef *findModeDef(std::string_view name) const;
float area() const { return area_; } float area() const { return area_; }
@ -544,7 +544,7 @@ public:
const Statetable *statetable() const { return statetable_; } const Statetable *statetable() const { return statetable_; }
// Find bus declaration local to this cell. // Find bus declaration local to this cell.
BusDcl *makeBusDcl(std::string name, BusDcl *makeBusDcl(std::string_view name,
int from, int from,
int to); int to);
BusDcl *findBusDcl(std::string_view name); BusDcl *findBusDcl(std::string_view name);
@ -565,7 +565,7 @@ public:
// AOCV // AOCV
float ocvArcDepth() const; float ocvArcDepth() const;
OcvDerate *ocvDerate() const; OcvDerate *ocvDerate() const;
OcvDerate *makeOcvDerate(std::string name); OcvDerate *makeOcvDerate(std::string_view name);
OcvDerate *findOcvDerate(std::string_view derate_name); OcvDerate *findOcvDerate(std::string_view derate_name);
// Build helpers. // Build helpers.
@ -620,9 +620,9 @@ public:
static void checkLibertyScenes(); static void checkLibertyScenes();
void ensureVoltageWaveforms(const SceneSeq &scenes); void ensureVoltageWaveforms(const SceneSeq &scenes);
const std::string &footprint() const { return footprint_; } const std::string &footprint() const { return footprint_; }
void setFootprint(std::string footprint); void setFootprint(std::string_view footprint);
const std::string &userFunctionClass() const { return user_function_class_; } const std::string &userFunctionClass() const { return user_function_class_; }
void setUserFunctionClass(std::string user_function_class); void setUserFunctionClass(std::string_view user_function_class);
protected: protected:
void addPort(ConcretePort *port); void addPort(ConcretePort *port);
@ -758,7 +758,7 @@ public:
PwrGndType pwrGndType() const { return pwr_gnd_type_; } PwrGndType pwrGndType() const { return pwr_gnd_type_; }
void setPwrGndType(PwrGndType type); void setPwrGndType(PwrGndType type);
const std::string &voltageName() const { return voltage_name_; } const std::string &voltageName() const { return voltage_name_; }
void setVoltageName(std::string voltage_name); void setVoltageName(std::string_view voltage_name);
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
ScanSignalType scanSignalType() const { return scan_signal_type_; } ScanSignalType scanSignalType() const { return scan_signal_type_; }
@ -906,7 +906,7 @@ public:
protected: protected:
// Constructor is internal to LibertyBuilder. // Constructor is internal to LibertyBuilder.
LibertyPort(LibertyCell *cell, LibertyPort(LibertyCell *cell,
std::string name, std::string_view name,
bool is_bus, bool is_bus,
BusDcl *bus_dcl, BusDcl *bus_dcl,
int from_index, int from_index,
@ -1016,7 +1016,7 @@ protected:
class OperatingConditions : public Pvt class OperatingConditions : public Pvt
{ {
public: public:
OperatingConditions(std::string name); OperatingConditions(std::string_view name);
const std::string &name() const { return name_; } const std::string &name() const { return name_; }
WireloadTree wireloadTree() const { return wire_load_tree_; } WireloadTree wireloadTree() const { return wire_load_tree_; }
void setWireloadTree(WireloadTree tree); void setWireloadTree(WireloadTree tree);
@ -1029,7 +1029,7 @@ protected:
class ScaleFactors class ScaleFactors
{ {
public: public:
ScaleFactors(std::string name); ScaleFactors(std::string_view name);
const std::string &name() const { return name_; } const std::string &name() const { return name_; }
float scale(ScaleFactorType type, float scale(ScaleFactorType type,
ScaleFactorPvt pvt, ScaleFactorPvt pvt,
@ -1056,7 +1056,7 @@ protected:
class BusDcl class BusDcl
{ {
public: public:
BusDcl(std::string name, BusDcl(std::string_view name,
int from, int from,
int to); int to);
const std::string &name() const { return name_; } const std::string &name() const { return name_; }
@ -1073,9 +1073,9 @@ protected:
class ModeDef class ModeDef
{ {
public: public:
ModeDef(std::string name); ModeDef(std::string_view name);
const std::string &name() const { return name_; } const std::string &name() const { return name_; }
ModeValueDef *defineValue(std::string value); ModeValueDef *defineValue(std::string_view value);
const ModeValueDef *findValueDef(std::string_view value) const; const ModeValueDef *findValueDef(std::string_view value) const;
const ModeValueMap &values() const { return values_; } const ModeValueMap &values() const { return values_; }
@ -1090,15 +1090,15 @@ private:
class TableTemplate class TableTemplate
{ {
public: public:
TableTemplate(std::string name); TableTemplate(std::string_view name);
TableTemplate(std::string name, TableTemplate(std::string_view name,
TableTemplateType type); TableTemplateType type);
TableTemplate(std::string name, TableTemplate(std::string_view name,
TableAxisPtr axis1, TableAxisPtr axis1,
TableAxisPtr axis2, TableAxisPtr axis2,
TableAxisPtr axis3); TableAxisPtr axis3);
const std::string &name() const { return name_; } const std::string &name() const { return name_; }
void setName(std::string name); void setName(std::string_view name);
TableTemplateType type() const { return type_; } TableTemplateType type() const { return type_; }
const TableAxis *axis1() const { return axis1_.get(); } const TableAxis *axis1() const { return axis1_.get(); }
TableAxisPtr axis1ptr() const { return axis1_; } TableAxisPtr axis1ptr() const { return axis1_; }
@ -1122,8 +1122,8 @@ class TestCell : public LibertyCell
{ {
public: public:
TestCell(LibertyLibrary *library, TestCell(LibertyLibrary *library,
std::string name, std::string_view name,
std::string filename); std::string_view filename);
protected: protected:
}; };
@ -1131,7 +1131,7 @@ protected:
class OcvDerate class OcvDerate
{ {
public: public:
OcvDerate(std::string name); OcvDerate(std::string_view name);
~OcvDerate(); ~OcvDerate();
const std::string &name() const { return name_; } const std::string &name() const { return name_; }
const Table *derateTable(const RiseFall *rf, const Table *derateTable(const RiseFall *rf,

View File

@ -307,18 +307,18 @@ public:
[[nodiscard]] bool isHierarchical(const Pin *pin) const; [[nodiscard]] bool isHierarchical(const Pin *pin) const;
[[nodiscard]] bool isTopLevelPort(const Pin *pin) const; [[nodiscard]] bool isTopLevelPort(const Pin *pin) const;
// Is pin inside the instance hier_pin is attached to? // Is pin inside the instance hier_pin is attached to?
bool isInside(const Pin *pin, [[nodiscard]] bool isInside(const Pin *pin,
const Pin *hier_pin) const; const Pin *hier_pin) const;
// Is pin inside of hier_inst? // Is pin inside of hier_inst?
bool isInside(const Pin *pin, [[nodiscard]] bool isInside(const Pin *pin,
const Instance *hier_inst) const; const Instance *hier_inst) const;
bool isDriver(const Pin *pin) const; [[nodiscard]] bool isDriver(const Pin *pin) const;
bool isLoad(const Pin *pin) const; [[nodiscard]] bool isLoad(const Pin *pin) const;
// Has register/latch rise/fall edges from pin. // Has register/latch rise/fall edges from pin.
bool isRegClkPin(const Pin *pin) const; [[nodiscard]] bool isRegClkPin(const Pin *pin) const;
// Pin clocks a timing check. // Pin clocks a timing check.
bool isCheckClk(const Pin *pin) const; [[nodiscard]] bool isCheckClk(const Pin *pin) const;
bool isLatchData(const Pin *pin) const; [[nodiscard]] bool isLatchData(const Pin *pin) const;
// Iterate over all of the pins connected to a pin and the parent // Iterate over all of the pins connected to a pin and the parent
// and child nets it is hierarchically connected to (port, leaf and // and child nets it is hierarchically connected to (port, leaf and

View File

@ -62,9 +62,9 @@ deleteLiberty()
TimingArcSet::destroy(); TimingArcSet::destroy();
} }
LibertyLibrary::LibertyLibrary(std::string name, LibertyLibrary::LibertyLibrary(std::string_view name,
std::string filename) : std::string_view filename) :
ConcreteLibrary(std::move(name), std::move(filename), true), ConcreteLibrary(name, filename, true),
units_(new Units()), units_(new Units()),
delay_model_type_(DelayModelType::table), // default delay_model_type_(DelayModelType::table), // default
nominal_process_(0.0), nominal_process_(0.0),
@ -178,12 +178,12 @@ LibertyLibrary::setDelayModelType(DelayModelType type)
} }
BusDcl * BusDcl *
LibertyLibrary::makeBusDcl(std::string name, LibertyLibrary::makeBusDcl(std::string_view name,
int from, int from,
int to) int to)
{ {
std::string key = name; std::string key(name);
auto [it, inserted] = bus_dcls_.try_emplace(std::move(key), std::move(name), from, to); auto [it, inserted] = bus_dcls_.try_emplace(std::move(key), std::string(name), from, to);
return &it->second; return &it->second;
} }
@ -203,13 +203,13 @@ LibertyLibrary::busDcls() const
} }
TableTemplate * TableTemplate *
LibertyLibrary::makeTableTemplate(std::string name, LibertyLibrary::makeTableTemplate(std::string_view name,
TableTemplateType type) TableTemplateType type)
{ {
std::string key = name; std::string key(name);
auto [it, inserted] = template_maps_[int(type)].try_emplace(std::move(key), auto [it, inserted] = template_maps_[int(type)].try_emplace(std::move(key),
std::move(name), std::string(name),
type); type);
return &it->second; return &it->second;
} }
@ -265,10 +265,10 @@ LibertyLibrary::setScaleFactors(ScaleFactors *scales)
} }
ScaleFactors * ScaleFactors *
LibertyLibrary::makeScaleFactors(std::string name) LibertyLibrary::makeScaleFactors(std::string_view name)
{ {
std::string key = name; std::string key(name);
auto [it, inserted] = scale_factors_map_.emplace(std::move(key), std::move(name)); auto [it, inserted] = scale_factors_map_.emplace(std::move(key), std::string(name));
return &it->second; return &it->second;
} }
@ -565,9 +565,10 @@ LibertyLibrary::setDefaultOutputPinRes(const RiseFall *rf,
} }
Wireload * Wireload *
LibertyLibrary::makeWireload(std::string name) LibertyLibrary::makeWireload(std::string_view name)
{ {
auto [it, inserted] = wireloads_.try_emplace(name, name, this); std::string key(name);
auto [it, inserted] = wireloads_.try_emplace(std::move(key), std::string(name), this);
return &it->second; return &it->second;
} }
@ -590,11 +591,11 @@ LibertyLibrary::defaultWireload() const
} }
WireloadSelection * WireloadSelection *
LibertyLibrary::makeWireloadSelection(std::string name) LibertyLibrary::makeWireloadSelection(std::string_view name)
{ {
std::string key = name; std::string key(name);
auto [it, inserted] = wire_load_selections_.try_emplace(std::move(key), auto [it, inserted] = wire_load_selections_.try_emplace(std::move(key),
std::move(name)); std::string(name));
return &it->second; return &it->second;
} }
@ -629,10 +630,10 @@ LibertyLibrary::setDefaultWireloadMode(WireloadMode mode)
} }
OperatingConditions * OperatingConditions *
LibertyLibrary::makeOperatingConditions(std::string name) LibertyLibrary::makeOperatingConditions(std::string_view name)
{ {
std::string key = name; std::string key(name);
auto [it, inserted] = operating_conditions_.try_emplace(std::move(key), std::move(name)); auto [it, inserted] = operating_conditions_.try_emplace(std::move(key), std::string(name));
return &it->second; return &it->second;
} }
@ -719,10 +720,10 @@ LibertyLibrary::setSlewDerateFromLibrary(float derate)
} }
LibertyCell * LibertyCell *
LibertyLibrary::makeScaledCell(std::string name, LibertyLibrary::makeScaledCell(std::string_view name,
std::string filename) std::string_view filename)
{ {
return new LibertyCell(this, std::move(name), std::move(filename)); return new LibertyCell(this, name, filename);
} }
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
@ -853,10 +854,10 @@ LibertyLibrary::setDefaultOcvDerate(OcvDerate *derate)
} }
OcvDerate * OcvDerate *
LibertyLibrary::makeOcvDerate(std::string name) LibertyLibrary::makeOcvDerate(std::string_view name)
{ {
std::string key = name; std::string key(name);
auto [it, inserted] = ocv_derate_map_.try_emplace(std::move(key), std::move(name)); auto [it, inserted] = ocv_derate_map_.try_emplace(std::move(key), std::string(name));
return &it->second; return &it->second;
} }
@ -867,10 +868,10 @@ LibertyLibrary::findOcvDerate(std::string_view derate_name)
} }
void void
LibertyLibrary::addSupplyVoltage(std::string supply_name, LibertyLibrary::addSupplyVoltage(std::string_view supply_name,
float voltage) float voltage)
{ {
supply_voltage_map_[std::move(supply_name)] = voltage; supply_voltage_map_[std::string(supply_name)] = voltage;
} }
void void
@ -903,13 +904,13 @@ LibertyLibrary::findDriverWaveform(std::string_view name)
} }
DriverWaveform * DriverWaveform *
LibertyLibrary::makeDriverWaveform(std::string name, LibertyLibrary::makeDriverWaveform(std::string_view name,
TablePtr waveforms) TablePtr waveforms)
{ {
std::string key = name; std::string key(name);
auto [it, inserted] = driver_waveform_map_.try_emplace(std::move(key), auto [it, inserted] = driver_waveform_map_.try_emplace(std::move(key),
std::move(name), std::string(name),
waveforms); waveforms);
return &it->second; return &it->second;
} }
@ -935,8 +936,8 @@ LibertyCellIterator::next()
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
LibertyCell::LibertyCell(LibertyLibrary *library, LibertyCell::LibertyCell(LibertyLibrary *library,
std::string name, std::string_view name,
std::string filename) : std::string_view filename) :
ConcreteCell(name, filename, true, library), ConcreteCell(name, filename, true, library),
liberty_library_(library), liberty_library_(library),
area_(0.0), area_(0.0),
@ -1019,10 +1020,10 @@ LibertyCell::setHasInternalPorts(bool has_internal)
} }
ModeDef * ModeDef *
LibertyCell::makeModeDef(std::string name) LibertyCell::makeModeDef(std::string_view name)
{ {
std::string key = name; std::string key(name);
auto [it, inserted] = mode_defs_.try_emplace(std::move(key), std::move(name)); auto [it, inserted] = mode_defs_.try_emplace(std::move(key), std::string(name));
return &it->second; return &it->second;
} }
@ -1039,12 +1040,12 @@ LibertyCell::setScaleFactors(ScaleFactors *scale_factors)
} }
BusDcl * BusDcl *
LibertyCell::makeBusDcl(std::string name, LibertyCell::makeBusDcl(std::string_view name,
int from, int from,
int to) int to)
{ {
std::string key = name; std::string key(name);
auto [it, inserted] = bus_dcls_.try_emplace(std::move(key), std::move(name), from, to); auto [it, inserted] = bus_dcls_.try_emplace(std::move(key), std::string(name), from, to);
return &it->second; return &it->second;
} }
@ -1624,10 +1625,10 @@ LibertyCell::setOcvDerate(OcvDerate *derate)
} }
OcvDerate * OcvDerate *
LibertyCell::makeOcvDerate(std::string name) LibertyCell::makeOcvDerate(std::string_view name)
{ {
std::string key = name; std::string key(name);
auto [it, inserted] = ocv_derate_map_.try_emplace(std::move(key), std::move(name)); auto [it, inserted] = ocv_derate_map_.try_emplace(std::move(key), std::string(name));
return &it->second; return &it->second;
} }
@ -1929,15 +1930,15 @@ LibertyCell::ensureVoltageWaveforms(const SceneSeq &scenes)
} }
void void
LibertyCell::setFootprint(std::string footprint) LibertyCell::setFootprint(std::string_view footprint)
{ {
footprint_ = std::move(footprint); footprint_ = footprint;
} }
void void
LibertyCell::setUserFunctionClass(std::string user_function_class) LibertyCell::setUserFunctionClass(std::string_view user_function_class)
{ {
user_function_class_ = std::move(user_function_class); user_function_class_ = user_function_class;
} }
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
@ -1986,7 +1987,7 @@ LibertyCellPortBitIterator::next()
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
LibertyPort::LibertyPort(LibertyCell *cell, LibertyPort::LibertyPort(LibertyCell *cell,
std::string name, std::string_view name,
bool is_bus, bool is_bus,
BusDcl *bus_dcl, BusDcl *bus_dcl,
int from_index, int from_index,
@ -2079,9 +2080,9 @@ LibertyPort::setPwrGndType(PwrGndType type)
} }
void void
LibertyPort::setVoltageName(std::string voltage_name) LibertyPort::setVoltageName(std::string_view voltage_name)
{ {
voltage_name_ = std::move(voltage_name); voltage_name_ = voltage_name;
} }
static EnumNameMap<PwrGndType> pwr_gnd_type_map = static EnumNameMap<PwrGndType> pwr_gnd_type_map =
@ -2840,10 +2841,10 @@ LibertyPortMemberIterator::next()
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
BusDcl::BusDcl(std::string name, BusDcl::BusDcl(std::string_view name,
int from, int from,
int to) : int to) :
name_(std::move(name)), name_(name),
from_(from), from_(from),
to_(to) to_(to)
{ {
@ -2851,16 +2852,16 @@ BusDcl::BusDcl(std::string name,
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
ModeDef::ModeDef(std::string name) : ModeDef::ModeDef(std::string_view name) :
name_(std::move(name)) name_(name)
{ {
} }
ModeValueDef * ModeValueDef *
ModeDef::defineValue(std::string value) ModeDef::defineValue(std::string_view value)
{ {
std::string key = value; std::string key(value);
auto [it, inserted] = values_.try_emplace(std::move(key), std::move(value)); auto [it, inserted] = values_.try_emplace(std::move(key), std::string(value));
return &it->second; return &it->second;
} }
@ -2872,8 +2873,8 @@ ModeDef::findValueDef(std::string_view value) const
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
ModeValueDef::ModeValueDef(std::string value) : ModeValueDef::ModeValueDef(std::string_view value) :
value_(std::move(value)), value_(value),
cond_(nullptr) cond_(nullptr)
{ {
} }
@ -2905,8 +2906,8 @@ ModeValueDef::setSdfCond(std::string sdf_cond)
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
TableTemplate::TableTemplate(std::string name) : TableTemplate::TableTemplate(std::string_view name) :
name_(std::move(name)), name_(name),
type_(TableTemplateType::delay), type_(TableTemplateType::delay),
axis1_(nullptr), axis1_(nullptr),
axis2_(nullptr), axis2_(nullptr),
@ -2914,9 +2915,9 @@ TableTemplate::TableTemplate(std::string name) :
{ {
} }
TableTemplate::TableTemplate(std::string name, TableTemplate::TableTemplate(std::string_view name,
TableTemplateType type) : TableTemplateType type) :
name_(std::move(name)), name_(name),
type_(type), type_(type),
axis1_(nullptr), axis1_(nullptr),
axis2_(nullptr), axis2_(nullptr),
@ -2924,11 +2925,11 @@ TableTemplate::TableTemplate(std::string name,
{ {
} }
TableTemplate::TableTemplate(std::string name, TableTemplate::TableTemplate(std::string_view name,
TableAxisPtr axis1, TableAxisPtr axis1,
TableAxisPtr axis2, TableAxisPtr axis2,
TableAxisPtr axis3) : TableAxisPtr axis3) :
name_(std::move(name)), name_(name),
type_(TableTemplateType::delay), type_(TableTemplateType::delay),
axis1_(axis1), axis1_(axis1),
axis2_(axis2), axis2_(axis2),
@ -2937,9 +2938,9 @@ TableTemplate::TableTemplate(std::string name,
} }
void void
TableTemplate::setName(std::string name) TableTemplate::setName(std::string_view name)
{ {
name_ = std::move(name); name_ = name;
} }
void void
@ -2989,9 +2990,9 @@ Pvt::setTemperature(float temp)
temperature_ = temp; temperature_ = temp;
} }
OperatingConditions::OperatingConditions(std::string name) : OperatingConditions::OperatingConditions(std::string_view name) :
Pvt(0.0, 0.0, 0.0), Pvt(0.0, 0.0, 0.0),
name_(std::move(name)), name_(name),
// Default wireload tree. // Default wireload tree.
wire_load_tree_(WireloadTree::unknown) wire_load_tree_(WireloadTree::unknown)
{ {
@ -3085,8 +3086,8 @@ scaleFactorPvtName(ScaleFactorPvt pvt)
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
ScaleFactors::ScaleFactors(std::string name) : ScaleFactors::ScaleFactors(std::string_view name) :
name_(std::move(name)) name_(name)
{ {
for (int type = 0; type < scale_factor_type_count; type++) { for (int type = 0; type < scale_factor_type_count; type++) {
for (int pvt = 0; pvt < scale_factor_pvt_count; pvt++) { for (int pvt = 0; pvt < scale_factor_pvt_count; pvt++) {
@ -3168,16 +3169,16 @@ ScaleFactors::report(Report *report)
} }
TestCell::TestCell(LibertyLibrary *library, TestCell::TestCell(LibertyLibrary *library,
std::string name, std::string_view name,
std::string filename) : std::string_view filename) :
LibertyCell(library, name, filename) LibertyCell(library, name, filename)
{ {
} }
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
OcvDerate::OcvDerate(std::string name) : OcvDerate::OcvDerate(std::string_view name) :
name_(std::move(name)) name_(name)
{ {
for (auto el_index : EarlyLate::rangeIndex()) { for (auto el_index : EarlyLate::rangeIndex()) {
for (auto rf_index : RiseFall::rangeIndex()) { for (auto rf_index : RiseFall::rangeIndex()) {

View File

@ -124,7 +124,7 @@ LibertyBuilder::makePort(LibertyCell *cell,
LibertyPort * LibertyPort *
LibertyBuilder::makeBundlePort(LibertyCell *cell, LibertyBuilder::makeBundlePort(LibertyCell *cell,
const char *name, std::string_view name,
ConcretePortSeq *members) ConcretePortSeq *members)
{ {
LibertyPort *port = new LibertyPort(cell, name, false, nullptr, -1, -1, true, members); LibertyPort *port = new LibertyPort(cell, name, false, nullptr, -1, -1, true, members);

View File

@ -54,7 +54,7 @@ public:
int to_index, int to_index,
BusDcl *bus_dcl); BusDcl *bus_dcl);
LibertyPort *makeBundlePort(LibertyCell *cell, LibertyPort *makeBundlePort(LibertyCell *cell,
const char *name, std::string_view name,
ConcretePortSeq *members); ConcretePortSeq *members);
// Build timing arc sets and their arcs given a type and sense. // Build timing arc sets and their arcs given a type and sense.
// Port functions and cell latches are also used by this builder // Port functions and cell latches are also used by this builder

View File

@ -176,7 +176,7 @@ LibertyReader::endCell(const LibertyGroup *cell_group,
if (cell_group->hasFirstParam()) { if (cell_group->hasFirstParam()) {
const std::string &name = cell_group->firstParam(); const std::string &name = cell_group->firstParam();
debugPrint(debug_, "liberty", 1, "cell {}", name); debugPrint(debug_, "liberty", 1, "cell {}", name);
LibertyCell *cell = builder_.makeCell(library_, name, std::string(filename_)); LibertyCell *cell = builder_.makeCell(library_, name, filename_);
readCell(cell, cell_group); readCell(cell, cell_group);
} }
else else
@ -849,7 +849,7 @@ LibertyReader::readDefaultWireLoadSelection(const LibertyGroup *library_group)
library_group->findAttrString("default_wire_load_selection"); library_group->findAttrString("default_wire_load_selection");
if (!selection_name.empty()) { if (!selection_name.empty()) {
const WireloadSelection *selection = const WireloadSelection *selection =
library_->findWireloadSelection(selection_name.c_str()); library_->findWireloadSelection(selection_name);
if (selection) if (selection)
library_->setDefaultWireloadSelection(selection); library_->setDefaultWireloadSelection(selection);
else else
@ -1003,9 +1003,8 @@ LibertyReader::readScaledCell(const LibertyGroup *scaled_cell_group)
OperatingConditions *op_cond = library_->findOperatingConditions(op_cond_name); OperatingConditions *op_cond = library_->findOperatingConditions(op_cond_name);
if (op_cond) { if (op_cond) {
debugPrint(debug_, "liberty", 1, "scaled cell {} {}", debugPrint(debug_, "liberty", 1, "scaled cell {} {}",
name.c_str(), op_cond_name.c_str()); name, op_cond_name);
LibertyCell *scaled_cell = library_->makeScaledCell(name, LibertyCell *scaled_cell = library_->makeScaledCell(name, filename_);
std::string(filename_));
readCell(scaled_cell, scaled_cell_group); readCell(scaled_cell, scaled_cell_group);
checkScaledCell(scaled_cell, owner, scaled_cell_group, op_cond_name); checkScaledCell(scaled_cell, owner, scaled_cell_group, op_cond_name);
// Add scaled cell AFTER ports and timing arcs are defined. // Add scaled cell AFTER ports and timing arcs are defined.
@ -1163,8 +1162,7 @@ LibertyReader::makeBundlePort(LibertyCell *cell,
members->push_back(member); members->push_back(member);
} }
} }
LibertyPort *bundle_port = builder_.makeBundlePort(cell, bundle_name.c_str(), LibertyPort *bundle_port = builder_.makeBundlePort(cell, bundle_name, members);
members);
port_group_map[bundle_group].push_back(bundle_port); port_group_map[bundle_group].push_back(bundle_port);
// Make ports for pin groups inside the bundle group. // Make ports for pin groups inside the bundle group.
makeBundlePinPorts(cell, bundle_group, port_group_map); makeBundlePinPorts(cell, bundle_group, port_group_map);
@ -1204,7 +1202,7 @@ LibertyReader::makePgPinPort(LibertyCell *cell,
const std::string &type_name = pg_pin_group->findAttrString("pg_type"); const std::string &type_name = pg_pin_group->findAttrString("pg_type");
if (!type_name.empty()) { if (!type_name.empty()) {
PwrGndType type = findPwrGndType(type_name.c_str()); PwrGndType type = findPwrGndType(type_name);
PortDirection *dir = PortDirection::unknown(); PortDirection *dir = PortDirection::unknown();
switch (type) { switch (type) {
case PwrGndType::primary_ground: case PwrGndType::primary_ground:
@ -1235,7 +1233,7 @@ LibertyReader::makePgPinPort(LibertyCell *cell,
const std::string &voltate_name = pg_pin_group->findAttrString("voltage_name"); const std::string &voltate_name = pg_pin_group->findAttrString("voltage_name");
if (!voltate_name.empty()) if (!voltate_name.empty())
pg_port->setVoltageName(voltate_name.c_str()); pg_port->setVoltageName(voltate_name);
} }
else else
warn(1314, pg_pin_group, "pg_pin missing name."); warn(1314, pg_pin_group, "pg_pin missing name.");
@ -1295,7 +1293,7 @@ LibertyReader::readDriverWaveform(const LibertyPortSeq &ports,
: "driver_waveform_fall"; : "driver_waveform_fall";
const std::string &name = port_group->findAttrString(attr_name); const std::string &name = port_group->findAttrString(attr_name);
if (!name.empty()) { if (!name.empty()) {
DriverWaveform *waveform = library_->findDriverWaveform(name.c_str()); DriverWaveform *waveform = library_->findDriverWaveform(name);
if (waveform) { if (waveform) {
for (LibertyPort *port : ports) for (LibertyPort *port : ports)
port->setDriverWaveform(waveform, rf); port->setDriverWaveform(waveform, rf);
@ -1830,9 +1828,9 @@ LibertyReader::readCellAttributes(LibertyCell *cell,
const std::string &clock_gate_type = const std::string &clock_gate_type =
cell_group->findAttrString("clock_gating_integrated_cell"); cell_group->findAttrString("clock_gating_integrated_cell");
if (!clock_gate_type.empty()) { if (!clock_gate_type.empty()) {
if (stringBeginEqual(clock_gate_type.c_str(), "latch_posedge")) if (stringBeginEqual(clock_gate_type, "latch_posedge"))
cell->setClockGateType(ClockGateType::latch_posedge); cell->setClockGateType(ClockGateType::latch_posedge);
else if (stringBeginEqual(clock_gate_type.c_str(), "latch_negedge")) else if (stringBeginEqual(clock_gate_type, "latch_negedge"))
cell->setClockGateType(ClockGateType::latch_negedge); cell->setClockGateType(ClockGateType::latch_negedge);
else else
cell->setClockGateType(ClockGateType::other); cell->setClockGateType(ClockGateType::other);
@ -1852,7 +1850,7 @@ LibertyReader::readScaleFactors(LibertyCell *cell,
cell_group->findAttrString("scaling_factors"); cell_group->findAttrString("scaling_factors");
if (!scale_factors_name.empty()) { if (!scale_factors_name.empty()) {
ScaleFactors *scale_factors = ScaleFactors *scale_factors =
library_->findScaleFactors(scale_factors_name.c_str()); library_->findScaleFactors(scale_factors_name);
if (scale_factors) if (scale_factors)
cell->setScaleFactors(scale_factors); cell->setScaleFactors(scale_factors);
else else
@ -1862,7 +1860,7 @@ LibertyReader::readScaleFactors(LibertyCell *cell,
void void
LibertyReader::readCellAttrString(std::string_view attr_name, LibertyReader::readCellAttrString(std::string_view attr_name,
void (LibertyCell::*set_func)(std::string value), void (LibertyCell::*set_func)(std::string_view value),
LibertyCell *cell, LibertyCell *cell,
const LibertyGroup *group) const LibertyGroup *group)
{ {
@ -2943,9 +2941,9 @@ LibertyReader::readCellOcvDerateGroup(LibertyCell *cell,
{ {
const std::string &derate_name = cell_group->findAttrString("ocv_derate_group"); const std::string &derate_name = cell_group->findAttrString("ocv_derate_group");
if (!derate_name.empty()) { if (!derate_name.empty()) {
OcvDerate *derate = cell->findOcvDerate(derate_name.c_str()); OcvDerate *derate = cell->findOcvDerate(derate_name);
if (derate == nullptr) if (derate == nullptr)
derate = library_->findOcvDerate(derate_name.c_str()); derate = library_->findOcvDerate(derate_name);
if (derate) if (derate)
cell->setOcvDerate(derate); cell->setOcvDerate(derate);
else else
@ -3453,7 +3451,7 @@ LibertyReader::readDefaultOcvDerateGroup(const LibertyGroup *library_group)
const std::string &derate_name = const std::string &derate_name =
library_group->findAttrString("default_ocv_derate_group"); library_group->findAttrString("default_ocv_derate_group");
if (!derate_name.empty()) { if (!derate_name.empty()) {
OcvDerate *derate = library_->findOcvDerate(derate_name.c_str()); OcvDerate *derate = library_->findOcvDerate(derate_name);
if (derate) if (derate)
library_->setDefaultOcvDerate(derate); library_->setDefaultOcvDerate(derate);
else else

View File

@ -375,7 +375,7 @@ protected:
void readScaleFactors(LibertyCell *cell, void readScaleFactors(LibertyCell *cell,
const LibertyGroup *cell_group); const LibertyGroup *cell_group);
void readCellAttrString(std::string_view attr_name, void readCellAttrString(std::string_view attr_name,
void (LibertyCell::*set_func)(std::string value), void (LibertyCell::*set_func)(std::string_view value),
LibertyCell *cell, LibertyCell *cell,
const LibertyGroup *group); const LibertyGroup *group);
void readCellAttrFloat(std::string_view attr_name, void readCellAttrFloat(std::string_view attr_name,

View File

@ -38,12 +38,12 @@ namespace sta {
static constexpr char escape_ = '\\'; static constexpr char escape_ = '\\';
ConcreteLibrary::ConcreteLibrary(std::string name, ConcreteLibrary::ConcreteLibrary(std::string_view name,
std::string filename, std::string_view filename,
bool is_liberty) : bool is_liberty) :
name_(std::move(name)), name_(name),
id_(ConcreteNetwork::nextObjectId()), id_(ConcreteNetwork::nextObjectId()),
filename_(std::move(filename)), filename_(filename),
is_liberty_(is_liberty), is_liberty_(is_liberty),
bus_brkt_left_('['), bus_brkt_left_('['),
bus_brkt_right_(']') bus_brkt_right_(']')

View File

@ -73,9 +73,9 @@ public:
FilterExpr(std::string_view expression, FilterExpr(std::string_view expression,
Report *report); Report *report);
std::vector<std::unique_ptr<Token>> postfix(bool bool_props_as_int); std::vector<std::unique_ptr<Token>> postfix();
private: private:
std::vector<std::unique_ptr<Token>> lex(bool bool_props_as_int); std::vector<std::unique_ptr<Token>> lex();
std::vector<std::unique_ptr<Token>> shuntingYard(std::vector<std::unique_ptr<Token>> &infix); std::vector<std::unique_ptr<Token>> shuntingYard(std::vector<std::unique_ptr<Token>> &infix);
std::string raw_; std::string raw_;
@ -106,20 +106,21 @@ FilterExpr::FilterExpr(std::string_view expression,
} }
std::vector<std::unique_ptr<FilterExpr::Token>> std::vector<std::unique_ptr<FilterExpr::Token>>
FilterExpr::postfix(bool bool_props_as_int) FilterExpr::postfix()
{ {
auto infix = lex(bool_props_as_int); auto infix = lex();
return shuntingYard(infix); return shuntingYard(infix);
} }
std::vector<std::unique_ptr<FilterExpr::Token>> std::vector<std::unique_ptr<FilterExpr::Token>>
FilterExpr::lex(bool bool_props_as_int) FilterExpr::lex()
{ {
std::vector<std::pair<std::regex, Token::Kind>> token_regexes = { std::vector<std::pair<std::regex, Token::Kind>> token_regexes = {
{std::regex("^\\s+"), Token::Kind::skip}, {std::regex("^\\s+"), Token::Kind::skip},
{std::regex("^defined\\(([a-zA-Z_]+)\\)"), Token::Kind::defined}, {std::regex("^defined\\(([a-zA-Z_]+)\\)"), Token::Kind::defined},
{std::regex("^undefined\\(([a-zA-Z_]+)\\)"), Token::Kind::undefined}, {std::regex("^undefined\\(([a-zA-Z_]+)\\)"), Token::Kind::undefined},
{std::regex("^@?([a-zA-Z_]+) *((==|!=|=~|!~) *([0-9a-zA-Z_\\/$\\[\\]*?.]+))?"), Token::Kind::predicate}, {std::regex("^@?([a-zA-Z_]+) *((==|!=|=~|!~) *([0-9a-zA-Z_\\/$\\[\\]*?.]+))?"),
Token::Kind::predicate},
{std::regex("^(&&)"), Token::Kind::op_and}, {std::regex("^(&&)"), Token::Kind::op_and},
{std::regex("^(\\|\\|)"), Token::Kind::op_or}, {std::regex("^(\\|\\|)"), Token::Kind::op_or},
{std::regex("^(!)"), Token::Kind::op_inv}, {std::regex("^(!)"), Token::Kind::op_inv},
@ -139,9 +140,9 @@ FilterExpr::lex(bool bool_props_as_int)
std::string property = token_match[1].str(); std::string property = token_match[1].str();
// The default operation on a predicate if an op and arg are // The default operation on a predicate if an op and arg are
// omitted is 'arg == 1' / 'arg == true'. // omitted is 'prop == 1 || true'.
std::string op = "=="; std::string op = "==";
std::string arg = (bool_props_as_int ? "1" : "true"); std::string arg = "1";
if (token_match[2].length() != 0) { if (token_match[2].length() != 0) {
op = token_match[3].str(); op = token_match[3].str();
@ -250,13 +251,18 @@ filterObjects(const char *property,
bool not_pattern_match = stringEq(op, "!~"); bool not_pattern_match = stringEq(op, "!~");
for (T *object : all) { for (T *object : all) {
PropertyValue value = properties.getProperty(object, property); PropertyValue value = properties.getProperty(object, property);
std::string prop_str = value.to_string(network); std::string prop = value.to_string(network);
const char *prop = prop_str.c_str(); if (value.type() == PropertyValue::Type::bool_) {
if (prop && // Canonicalize bool true/false to 1/0.
((exact_match && stringEq(prop, pattern)) if (stringEqual(pattern, "true"))
|| (not_match && !stringEq(prop, pattern)) pattern = "1";
|| (pattern_match && patternMatch(pattern, prop)) else if (stringEqual(pattern, "false"))
|| (not_pattern_match && !patternMatch(pattern, prop)))) pattern = "0";
}
if ((exact_match && stringEq(prop.c_str(), pattern))
|| (not_match && !stringEq(prop.c_str(), pattern))
|| (pattern_match && patternMatch(pattern, prop))
|| (not_pattern_match && !patternMatch(pattern, prop)))
filtered_objects.insert(object); filtered_objects.insert(object);
} }
return filtered_objects; return filtered_objects;
@ -265,7 +271,6 @@ filterObjects(const char *property,
template <typename T> std::vector<T*> template <typename T> std::vector<T*>
filterObjects(std::string_view filter_expression, filterObjects(std::string_view filter_expression,
std::vector<T*> *objects, std::vector<T*> *objects,
bool bool_props_as_int,
Sta *sta) Sta *sta)
{ {
Report *report = sta->report(); Report *report = sta->report();
@ -278,7 +283,7 @@ filterObjects(std::string_view filter_expression,
all.insert(object); all.insert(object);
FilterExpr filter(filter_expression, report); FilterExpr filter(filter_expression, report);
auto postfix = filter.postfix(bool_props_as_int); auto postfix = filter.postfix();
std::stack<std::set<T*>> eval_stack; std::stack<std::set<T*>> eval_stack;
for (auto &token : postfix) { for (auto &token : postfix) {
if (token->kind == FilterExpr::Token::Kind::op_or) { if (token->kind == FilterExpr::Token::Kind::op_or) {
@ -405,100 +410,89 @@ filterObjects(std::string_view filter_expression,
PortSeq PortSeq
filterPorts(std::string_view filter_expression, filterPorts(std::string_view filter_expression,
PortSeq *objects, PortSeq *objects,
bool bool_props_as_int,
Sta *sta) Sta *sta)
{ {
return filterObjects<const Port>(filter_expression, objects, bool_props_as_int, sta); return filterObjects<const Port>(filter_expression, objects, sta);
} }
InstanceSeq InstanceSeq
filterInstances(std::string_view filter_expression, filterInstances(std::string_view filter_expression,
InstanceSeq *objects, InstanceSeq *objects,
bool bool_props_as_int,
Sta *sta) Sta *sta)
{ {
return filterObjects<const Instance>(filter_expression, objects, bool_props_as_int, sta); return filterObjects<const Instance>(filter_expression, objects, sta);
} }
PinSeq PinSeq
filterPins(std::string_view filter_expression, filterPins(std::string_view filter_expression,
PinSeq *objects, PinSeq *objects,
bool bool_props_as_int,
Sta *sta) Sta *sta)
{ {
return filterObjects<const Pin>(filter_expression, objects, bool_props_as_int, sta); return filterObjects<const Pin>(filter_expression, objects, sta);
} }
NetSeq NetSeq
filterNets(std::string_view filter_expression, filterNets(std::string_view filter_expression,
NetSeq *objects, NetSeq *objects,
bool bool_props_as_int,
Sta *sta) Sta *sta)
{ {
return filterObjects<const Net>(filter_expression, objects, bool_props_as_int, sta); return filterObjects<const Net>(filter_expression, objects, sta);
} }
ClockSeq ClockSeq
filterClocks(std::string_view filter_expression, filterClocks(std::string_view filter_expression,
ClockSeq *objects, ClockSeq *objects,
bool bool_props_as_int,
Sta *sta) Sta *sta)
{ {
return filterObjects<Clock>(filter_expression, objects, bool_props_as_int, sta); return filterObjects<Clock>(filter_expression, objects, sta);
} }
LibertyCellSeq LibertyCellSeq
filterLibCells(std::string_view filter_expression, filterLibCells(std::string_view filter_expression,
LibertyCellSeq *objects, LibertyCellSeq *objects,
bool bool_props_as_int,
Sta *sta) Sta *sta)
{ {
return filterObjects<LibertyCell>(filter_expression, objects, bool_props_as_int, sta); return filterObjects<LibertyCell>(filter_expression, objects, sta);
} }
LibertyPortSeq LibertyPortSeq
filterLibPins(std::string_view filter_expression, filterLibPins(std::string_view filter_expression,
LibertyPortSeq *objects, LibertyPortSeq *objects,
bool bool_props_as_int,
Sta *sta) Sta *sta)
{ {
return filterObjects<LibertyPort>(filter_expression, objects, bool_props_as_int, sta); return filterObjects<LibertyPort>(filter_expression, objects, sta);
} }
LibertyLibrarySeq LibertyLibrarySeq
filterLibertyLibraries(std::string_view filter_expression, filterLibertyLibraries(std::string_view filter_expression,
LibertyLibrarySeq *objects, LibertyLibrarySeq *objects,
bool bool_props_as_int,
Sta *sta) Sta *sta)
{ {
return filterObjects<LibertyLibrary>(filter_expression, objects, bool_props_as_int, sta); return filterObjects<LibertyLibrary>(filter_expression, objects, sta);
} }
EdgeSeq EdgeSeq
filterTimingArcs(std::string_view filter_expression, filterTimingArcs(std::string_view filter_expression,
EdgeSeq *objects, EdgeSeq *objects,
bool bool_props_as_int,
Sta *sta) Sta *sta)
{ {
return filterObjects<Edge>(filter_expression, objects, bool_props_as_int, sta); return filterObjects<Edge>(filter_expression, objects, sta);
} }
PathEndSeq PathEndSeq
filterPathEnds(std::string_view filter_expression, filterPathEnds(std::string_view filter_expression,
PathEndSeq *objects, PathEndSeq *objects,
bool bool_props_as_int,
Sta *sta) Sta *sta)
{ {
return filterObjects<PathEnd>(filter_expression, objects, bool_props_as_int, sta); return filterObjects<PathEnd>(filter_expression, objects, sta);
} }
StringSeq StringSeq
filterExprToPostfix(std::string_view expr, filterExprToPostfix(std::string_view expr,
bool bool_props_as_int,
Report *report) Report *report)
{ {
FilterExpr filter(expr, report); FilterExpr filter(expr, report);
auto postfix = filter.postfix(bool_props_as_int); auto postfix = filter.postfix();
StringSeq result; StringSeq result;
for (auto &token : postfix) for (auto &token : postfix)
result.push_back(token->text); result.push_back(token->text);

View File

@ -1493,101 +1493,90 @@ find_register_output_pins(ClockSet *clks,
PortSeq PortSeq
filter_ports(const char *filter_expression, filter_ports(const char *filter_expression,
PortSeq *ports, PortSeq *ports)
bool bool_props_as_int)
{ {
sta::Sta *sta = Sta::sta(); sta::Sta *sta = Sta::sta();
return filterPorts(filter_expression, ports, bool_props_as_int, sta); return filterPorts(filter_expression, ports, sta);
} }
InstanceSeq InstanceSeq
filter_insts(const char *filter_expression, filter_insts(const char *filter_expression,
InstanceSeq *insts, InstanceSeq *insts)
bool bool_props_as_int)
{ {
sta::Sta *sta = Sta::sta(); sta::Sta *sta = Sta::sta();
return filterInstances(filter_expression, insts, bool_props_as_int, sta); return filterInstances(filter_expression, insts, sta);
} }
PinSeq PinSeq
filter_pins(const char *filter_expression, filter_pins(const char *filter_expression,
PinSeq *pins, PinSeq *pins)
bool bool_props_as_int)
{ {
sta::Sta *sta = Sta::sta(); sta::Sta *sta = Sta::sta();
return filterPins(filter_expression, pins, bool_props_as_int, sta); return filterPins(filter_expression, pins, sta);
} }
NetSeq NetSeq
filter_nets(const char *filter_expression, filter_nets(const char *filter_expression,
NetSeq *nets, NetSeq *nets)
bool bool_props_as_int)
{ {
sta::Sta *sta = Sta::sta(); sta::Sta *sta = Sta::sta();
return filterNets(filter_expression, nets, bool_props_as_int, sta); return filterNets(filter_expression, nets, sta);
} }
ClockSeq ClockSeq
filter_clocks(const char *filter_expression, filter_clocks(const char *filter_expression,
ClockSeq *clocks, ClockSeq *clocks)
bool bool_props_as_int)
{ {
sta::Sta *sta = Sta::sta(); sta::Sta *sta = Sta::sta();
return filterClocks(filter_expression, clocks, bool_props_as_int, sta); return filterClocks(filter_expression, clocks, sta);
} }
LibertyCellSeq LibertyCellSeq
filter_lib_cells(const char *filter_expression, filter_lib_cells(const char *filter_expression,
LibertyCellSeq *cells, LibertyCellSeq *cells)
bool bool_props_as_int)
{ {
sta::Sta *sta = Sta::sta(); sta::Sta *sta = Sta::sta();
return filterLibCells(filter_expression, cells, bool_props_as_int, sta); return filterLibCells(filter_expression, cells, sta);
} }
LibertyPortSeq LibertyPortSeq
filter_lib_pins(const char *filter_expression, filter_lib_pins(const char *filter_expression,
LibertyPortSeq *pins, LibertyPortSeq *pins)
bool bool_props_as_int)
{ {
sta::Sta *sta = Sta::sta(); sta::Sta *sta = Sta::sta();
return filterLibPins(filter_expression, pins, bool_props_as_int, sta); return filterLibPins(filter_expression, pins, sta);
} }
LibertyLibrarySeq LibertyLibrarySeq
filter_liberty_libraries(const char *filter_expression, filter_liberty_libraries(const char *filter_expression,
LibertyLibrarySeq *libs, LibertyLibrarySeq *libs)
bool bool_props_as_int)
{ {
sta::Sta *sta = Sta::sta(); sta::Sta *sta = Sta::sta();
return filterLibertyLibraries(filter_expression, libs, bool_props_as_int, sta); return filterLibertyLibraries(filter_expression, libs, sta);
} }
EdgeSeq EdgeSeq
filter_timing_arcs(const char *filter_expression, filter_timing_arcs(const char *filter_expression,
EdgeSeq *edges, EdgeSeq *edges)
bool bool_props_as_int)
{ {
sta::Sta *sta = Sta::sta(); sta::Sta *sta = Sta::sta();
return filterTimingArcs(filter_expression, edges, bool_props_as_int, sta); return filterTimingArcs(filter_expression, edges, sta);
} }
PathEndSeq PathEndSeq
filter_path_ends(const char *filter_expression, filter_path_ends(const char *filter_expression,
PathEndSeq *path_ends, PathEndSeq *path_ends)
bool bool_props_as_int)
{ {
sta::Sta *sta = Sta::sta(); sta::Sta *sta = Sta::sta();
return filterPathEnds(filter_expression, path_ends, bool_props_as_int, sta); return filterPathEnds(filter_expression, path_ends, sta);
} }
// For FilterExpr unit tests. // For FilterExpr unit tests.
StringSeq StringSeq
filter_expr_to_postfix(const char* expr, filter_expr_to_postfix(const char* expr)
bool bool_props_as_int)
{ {
Report *report = Sta::sta()->report(); Report *report = Sta::sta()->report();
return filterExprToPostfix(expr, bool_props_as_int, report); return filterExprToPostfix(expr, report);
} }
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////

View File

@ -393,7 +393,7 @@ proc get_cells { args } {
} }
} }
if [info exists keys(-filter)] { if [info exists keys(-filter)] {
set insts [filter_insts $keys(-filter) $insts 1] set insts [filter_insts $keys(-filter) $insts]
} }
return $insts return $insts
} }
@ -436,7 +436,7 @@ proc get_clocks { args } {
} }
} }
if [info exists keys(-filter)] { if [info exists keys(-filter)] {
set clocks [filter_clocks $keys(-filter) $clocks 1] set clocks [filter_clocks $keys(-filter) $clocks]
} }
return $clocks return $clocks
} }
@ -517,7 +517,7 @@ proc get_lib_cells { args } {
} }
} }
if [info exists keys(-filter)] { if [info exists keys(-filter)] {
set cells [filter_lib_cells $keys(-filter) $cells 1] set cells [filter_lib_cells $keys(-filter) $cells]
} }
return $cells return $cells
} }
@ -621,7 +621,7 @@ proc get_lib_pins { args } {
} }
} }
if [info exists keys(-filter)] { if [info exists keys(-filter)] {
set ports [filter_lib_pins $keys(-filter) $ports 1] set ports [filter_lib_pins $keys(-filter) $ports]
} }
return $ports return $ports
} }
@ -671,7 +671,7 @@ proc get_libs { args } {
} }
} }
if [info exists keys(-filter)] { if [info exists keys(-filter)] {
set libs [filter_liberty_libraries $keys(-filter) $libs 1] set libs [filter_liberty_libraries $keys(-filter) $libs]
} }
return $libs return $libs
} }
@ -772,7 +772,7 @@ proc get_nets { args } {
} }
} }
if [info exists keys(-filter)] { if [info exists keys(-filter)] {
set nets [filter_nets $keys(-filter) $nets 1] set nets [filter_nets $keys(-filter) $nets]
} }
return $nets return $nets
} }
@ -863,7 +863,7 @@ proc get_pins { args } {
} }
} }
if [info exists keys(-filter)] { if [info exists keys(-filter)] {
set pins [filter_pins $keys(-filter) $pins 1] set pins [filter_pins $keys(-filter) $pins]
} }
return $pins return $pins
} }
@ -919,7 +919,7 @@ proc get_ports { args } {
} }
} }
if [info exists keys(-filter)] { if [info exists keys(-filter)] {
set ports [filter_ports $keys(-filter) $ports 1] set ports [filter_ports $keys(-filter) $ports]
} }
return $ports return $ports
} }

View File

@ -564,7 +564,7 @@ PropertyValue::to_string(const Network *network) const
case Type::float_: case Type::float_:
return unit_->asString(float_, 6); return unit_->asString(float_, 6);
case Type::bool_: case Type::bool_:
// true/false would be better but these are TCL true/false values. // These are TCL true/false values.
if (bool_) if (bool_)
return "1"; return "1";
else else

View File

@ -300,7 +300,7 @@ proc get_timing_edges_cmd { cmd cmd_args } {
cmd_usage_error $cmd cmd_usage_error $cmd
} }
if [info exists keys(-filter)] { if [info exists keys(-filter)] {
set arcs [filter_timing_arcs $keys(-filter) $arcs 1] set arcs [filter_timing_arcs $keys(-filter) $arcs]
} }
return $arcs return $arcs
} }

View File

@ -280,7 +280,7 @@ using namespace sta;
} }
%typemap(in) std::string_view { %typemap(in) std::string_view {
int length; Tcl_Size length;
const char *str = Tcl_GetStringFromObj($input, &length); const char *str = Tcl_GetStringFromObj($input, &length);
$1 = std::string_view(str, length); $1 = std::string_view(str, length);
} }
@ -415,7 +415,7 @@ using namespace sta;
} }
%typemap(in) Transition* { %typemap(in) Transition* {
int length; Tcl_Size length;
const char *arg = Tcl_GetStringFromObj($input, &length); const char *arg = Tcl_GetStringFromObj($input, &length);
Transition *tr = Transition::find(std::string_view(arg, length)); Transition *tr = Transition::find(std::string_view(arg, length));
if (tr == nullptr) { if (tr == nullptr) {
@ -433,7 +433,7 @@ using namespace sta;
} }
%typemap(in) RiseFall* { %typemap(in) RiseFall* {
int length; Tcl_Size length;
const char *arg = Tcl_GetStringFromObj($input, &length); const char *arg = Tcl_GetStringFromObj($input, &length);
const RiseFall *rf = RiseFall::find(std::string_view(arg, length)); const RiseFall *rf = RiseFall::find(std::string_view(arg, length));
if (rf == nullptr) { if (rf == nullptr) {
@ -451,7 +451,7 @@ using namespace sta;
} }
%typemap(in) RiseFallBoth* { %typemap(in) RiseFallBoth* {
int length; Tcl_Size length;
const char *arg = Tcl_GetStringFromObj($input, &length); const char *arg = Tcl_GetStringFromObj($input, &length);
const RiseFallBoth *rf = RiseFallBoth::find(std::string_view(arg, length)); const RiseFallBoth *rf = RiseFallBoth::find(std::string_view(arg, length));
if (rf == nullptr) { if (rf == nullptr) {
@ -469,7 +469,7 @@ using namespace sta;
} }
%typemap(in) PortDirection* { %typemap(in) PortDirection* {
int length; Tcl_Size length;
const char *arg = Tcl_GetStringFromObj($input, &length); const char *arg = Tcl_GetStringFromObj($input, &length);
PortDirection *dir = PortDirection::find(arg); PortDirection *dir = PortDirection::find(arg);
if (dir == nullptr) { if (dir == nullptr) {
@ -481,7 +481,7 @@ using namespace sta;
} }
%typemap(in) TimingRole* { %typemap(in) TimingRole* {
int length; Tcl_Size length;
const char *arg = Tcl_GetStringFromObj($input, &length); const char *arg = Tcl_GetStringFromObj($input, &length);
const TimingRole *role = TimingRole::find(arg); const TimingRole *role = TimingRole::find(arg);
if (role) if (role)
@ -498,7 +498,7 @@ using namespace sta;
} }
%typemap(in) LogicValue { %typemap(in) LogicValue {
int length; Tcl_Size length;
std::string arg = Tcl_GetStringFromObj($input, &length); std::string arg = Tcl_GetStringFromObj($input, &length);
if (arg == "0" || stringEqual(arg, "zero")) if (arg == "0" || stringEqual(arg, "zero"))
$1 = LogicValue::zero; $1 = LogicValue::zero;
@ -517,7 +517,7 @@ using namespace sta;
} }
%typemap(in) AnalysisType { %typemap(in) AnalysisType {
int length; Tcl_Size length;
const char *arg = Tcl_GetStringFromObj($input, &length); const char *arg = Tcl_GetStringFromObj($input, &length);
if (stringEqual(arg, "single")) if (stringEqual(arg, "single"))
$1 = AnalysisType::single; $1 = AnalysisType::single;
@ -831,7 +831,7 @@ using namespace sta;
} }
%typemap(in) MinMax* { %typemap(in) MinMax* {
int length; Tcl_Size length;
char *arg = Tcl_GetStringFromObj($input, &length); char *arg = Tcl_GetStringFromObj($input, &length);
// Swig is retarded and drops const on args. // Swig is retarded and drops const on args.
MinMax *min_max = const_cast<MinMax*>(MinMax::find(arg)); MinMax *min_max = const_cast<MinMax*>(MinMax::find(arg));
@ -852,7 +852,7 @@ using namespace sta;
} }
%typemap(in) MinMaxAll* { %typemap(in) MinMaxAll* {
int length; Tcl_Size length;
char *arg = Tcl_GetStringFromObj($input, &length); char *arg = Tcl_GetStringFromObj($input, &length);
// Swig is retarded and drops const on args. // Swig is retarded and drops const on args.
MinMaxAll *min_max = const_cast<MinMaxAll*>(MinMaxAll::find(arg)); MinMaxAll *min_max = const_cast<MinMaxAll*>(MinMaxAll::find(arg));
@ -865,7 +865,7 @@ using namespace sta;
} }
%typemap(in) MinMaxAllNull* { %typemap(in) MinMaxAllNull* {
int length; Tcl_Size length;
char *arg = Tcl_GetStringFromObj($input, &length); char *arg = Tcl_GetStringFromObj($input, &length);
if (stringEqual(arg, "NULL")) if (stringEqual(arg, "NULL"))
$1 = nullptr; $1 = nullptr;
@ -887,7 +887,7 @@ using namespace sta;
// SetupHold is typedef'd to MinMax. // SetupHold is typedef'd to MinMax.
%typemap(in) const SetupHold* { %typemap(in) const SetupHold* {
int length; Tcl_Size length;
char *arg = Tcl_GetStringFromObj($input, &length); char *arg = Tcl_GetStringFromObj($input, &length);
// Swig is retarded and drops const on args. // Swig is retarded and drops const on args.
if (stringEqual(arg, "hold") if (stringEqual(arg, "hold")
@ -904,7 +904,7 @@ using namespace sta;
// SetupHoldAll is typedef'd to MinMaxAll. // SetupHoldAll is typedef'd to MinMaxAll.
%typemap(in) const SetupHoldAll* { %typemap(in) const SetupHoldAll* {
int length; Tcl_Size length;
char *arg = Tcl_GetStringFromObj($input, &length); char *arg = Tcl_GetStringFromObj($input, &length);
// Swig is retarded and drops const on args. // Swig is retarded and drops const on args.
if (stringEqual(arg, "hold") if (stringEqual(arg, "hold")
@ -925,7 +925,7 @@ using namespace sta;
// EarlyLate is typedef'd to MinMax. // EarlyLate is typedef'd to MinMax.
%typemap(in) const EarlyLate* { %typemap(in) const EarlyLate* {
int length; Tcl_Size length;
char *arg = Tcl_GetStringFromObj($input, &length); char *arg = Tcl_GetStringFromObj($input, &length);
// Swig is retarded and drops const on args. // Swig is retarded and drops const on args.
EarlyLate *early_late = const_cast<EarlyLate*>(EarlyLate::find(arg)); EarlyLate *early_late = const_cast<EarlyLate*>(EarlyLate::find(arg));
@ -939,7 +939,7 @@ using namespace sta;
// EarlyLateAll is typedef'd to MinMaxAll. // EarlyLateAll is typedef'd to MinMaxAll.
%typemap(in) const EarlyLateAll* { %typemap(in) const EarlyLateAll* {
int length; Tcl_Size length;
char *arg = Tcl_GetStringFromObj($input, &length); char *arg = Tcl_GetStringFromObj($input, &length);
// Swig is retarded and drops const on args. // Swig is retarded and drops const on args.
EarlyLateAll *early_late = const_cast<EarlyLateAll*>(EarlyLateAll::find(arg)); EarlyLateAll *early_late = const_cast<EarlyLateAll*>(EarlyLateAll::find(arg));
@ -952,7 +952,7 @@ using namespace sta;
} }
%typemap(in) TimingDerateType { %typemap(in) TimingDerateType {
int length; Tcl_Size length;
char *arg = Tcl_GetStringFromObj($input, &length); char *arg = Tcl_GetStringFromObj($input, &length);
if (stringEqual(arg, "net_delay")) if (stringEqual(arg, "net_delay"))
$1 = TimingDerateType::net_delay; $1 = TimingDerateType::net_delay;
@ -967,7 +967,7 @@ using namespace sta;
} }
%typemap(in) TimingDerateCellType { %typemap(in) TimingDerateCellType {
int length; Tcl_Size length;
char *arg = Tcl_GetStringFromObj($input, &length); char *arg = Tcl_GetStringFromObj($input, &length);
if (stringEqual(arg, "cell_delay")) if (stringEqual(arg, "cell_delay"))
$1 = TimingDerateCellType::cell_delay; $1 = TimingDerateCellType::cell_delay;
@ -980,7 +980,7 @@ using namespace sta;
} }
%typemap(in) PathClkOrData { %typemap(in) PathClkOrData {
int length; Tcl_Size length;
std::string arg = Tcl_GetStringFromObj($input, &length); std::string arg = Tcl_GetStringFromObj($input, &length);
if (stringEqual(arg, "clk")) if (stringEqual(arg, "clk"))
$1 = PathClkOrData::clk; $1 = PathClkOrData::clk;
@ -993,7 +993,7 @@ using namespace sta;
} }
%typemap(in) ReportSortBy { %typemap(in) ReportSortBy {
int length; Tcl_Size length;
std::string arg = Tcl_GetStringFromObj($input, &length); std::string arg = Tcl_GetStringFromObj($input, &length);
if (stringEqual(arg, "group")) if (stringEqual(arg, "group"))
$1 = sort_by_group; $1 = sort_by_group;
@ -1006,7 +1006,7 @@ using namespace sta;
} }
%typemap(in) ReportPathFormat { %typemap(in) ReportPathFormat {
int length; Tcl_Size length;
std::string arg = Tcl_GetStringFromObj($input, &length); std::string arg = Tcl_GetStringFromObj($input, &length);
if (stringEqual(arg, "full")) if (stringEqual(arg, "full"))
$1 = ReportPathFormat::full; $1 = ReportPathFormat::full;
@ -1188,7 +1188,7 @@ using namespace sta;
if (Tcl_ListObjGetElements(interp, $input, &argc, &argv) == TCL_OK if (Tcl_ListObjGetElements(interp, $input, &argc, &argv) == TCL_OK
&& argc > 0) { && argc > 0) {
for (int i = 0; i < argc; i++) { for (int i = 0; i < argc; i++) {
int length; Tcl_Size length;
const char *mode_name = Tcl_GetStringFromObj(argv[i], &length); const char *mode_name = Tcl_GetStringFromObj(argv[i], &length);
Mode *mode = sta->findMode(mode_name); Mode *mode = sta->findMode(mode_name);
if (mode) if (mode)
@ -1215,7 +1215,7 @@ using namespace sta;
%typemap(in) Scene* { %typemap(in) Scene* {
sta::Sta *sta = Sta::sta(); sta::Sta *sta = Sta::sta();
int length; Tcl_Size length;
std::string scene_name = Tcl_GetStringFromObj($input, &length); std::string scene_name = Tcl_GetStringFromObj($input, &length);
// parse_scene_or_all support depreated 11/21/2025 // parse_scene_or_all support depreated 11/21/2025
if (scene_name == "NULL") if (scene_name == "NULL")
@ -1248,7 +1248,7 @@ using namespace sta;
if (Tcl_ListObjGetElements(interp, $input, &argc, &argv) == TCL_OK if (Tcl_ListObjGetElements(interp, $input, &argc, &argv) == TCL_OK
&& argc > 0) { && argc > 0) {
for (int i = 0; i < argc; i++) { for (int i = 0; i < argc; i++) {
int length; Tcl_Size length;
const char *scene_name = Tcl_GetStringFromObj(argv[i], &length); const char *scene_name = Tcl_GetStringFromObj(argv[i], &length);
Scene *scene = sta->findScene(scene_name); Scene *scene = sta->findScene(scene_name);
if (scene) if (scene)
@ -1274,7 +1274,7 @@ using namespace sta;
} }
%typemap(in) PropertyValue { %typemap(in) PropertyValue {
int length; Tcl_Size length;
const char *arg = Tcl_GetStringFromObj($input, &length); const char *arg = Tcl_GetStringFromObj($input, &length);
$1 = PropertyValue(arg); $1 = PropertyValue(arg);
} }
@ -1411,7 +1411,7 @@ using namespace sta;
} }
%typemap(in) CircuitSim { %typemap(in) CircuitSim {
int length; Tcl_Size length;
std::string arg = Tcl_GetStringFromObj($input, &length); std::string arg = Tcl_GetStringFromObj($input, &length);
if (stringEqual(arg, "hspice")) if (stringEqual(arg, "hspice"))
$1 = CircuitSim::hspice; $1 = CircuitSim::hspice;

View File

@ -40,7 +40,7 @@ tclListStringSeq(Tcl_Obj *const source,
StringSeq seq; StringSeq seq;
if (Tcl_ListObjGetElements(interp, source, &argc, &argv) == TCL_OK) { if (Tcl_ListObjGetElements(interp, source, &argc, &argv) == TCL_OK) {
for (int i = 0; i < argc; i++) { for (int i = 0; i < argc; i++) {
int length; Tcl_Size length;
const char *str = Tcl_GetStringFromObj(argv[i], &length); const char *str = Tcl_GetStringFromObj(argv[i], &length);
seq.push_back(str); seq.push_back(str);
} }
@ -58,7 +58,7 @@ tclListStringSeqPtr(Tcl_Obj *const source,
if (Tcl_ListObjGetElements(interp, source, &argc, &argv) == TCL_OK) { if (Tcl_ListObjGetElements(interp, source, &argc, &argv) == TCL_OK) {
StringSeq *seq = new StringSeq; StringSeq *seq = new StringSeq;
for (int i = 0; i < argc; i++) { for (int i = 0; i < argc; i++) {
int length; Tcl_Size length;
const char *str = Tcl_GetStringFromObj(argv[i], &length); const char *str = Tcl_GetStringFromObj(argv[i], &length);
seq->push_back(str); seq->push_back(str);
} }
@ -78,7 +78,7 @@ tclListStringSet(Tcl_Obj *const source,
if (Tcl_ListObjGetElements(interp, source, &argc, &argv) == TCL_OK) { if (Tcl_ListObjGetElements(interp, source, &argc, &argv) == TCL_OK) {
StringSet *set = new StringSet; StringSet *set = new StringSet;
for (int i = 0; i < argc; i++) { for (int i = 0; i < argc; i++) {
int length; Tcl_Size length;
const char *str = Tcl_GetStringFromObj(argv[i], &length); const char *str = Tcl_GetStringFromObj(argv[i], &length);
set->insert(str); set->insert(str);
} }
@ -183,11 +183,11 @@ arcDcalcArgTcl(Tcl_Obj *obj,
{ {
Sta *sta = Sta::sta(); Sta *sta = Sta::sta();
sta->ensureGraph(); sta->ensureGraph();
int list_argc; Tcl_Size list_argc;
Tcl_Obj **list_argv; Tcl_Obj **list_argv;
if (Tcl_ListObjGetElements(interp, obj, &list_argc, &list_argv) == TCL_OK) { if (Tcl_ListObjGetElements(interp, obj, &list_argc, &list_argv) == TCL_OK) {
const char *input_delay = "0.0"; const char *input_delay = "0.0";
int length; Tcl_Size length;
if (list_argc == 6) if (list_argc == 6)
input_delay = Tcl_GetStringFromObj(list_argv[5], &length); input_delay = Tcl_GetStringFromObj(list_argv[5], &length);
if (list_argc == 5 || list_argc == 6) { if (list_argc == 5 || list_argc == 6) {

View File

@ -33,13 +33,13 @@ namespace eval sta {
# Default digits to print after decimal point for reporting commands. # Default digits to print after decimal point for reporting commands.
set ::sta_report_default_digits 2 set ::sta_report_default_digits 2
trace variable ::sta_report_default_digits "rw" \ trace add variable ::sta_report_default_digits {read write} \
sta::trace_report_default_digits sta::trace_report_default_digits
proc trace_report_default_digits { name1 name2 op } { proc trace_report_default_digits { name1 name2 op } {
global sta_report_default_digits global sta_report_default_digits
if { $op == "w" } { if { $op == "write" } {
if { !([string is integer $sta_report_default_digits] \ if { !([string is integer $sta_report_default_digits] \
&& $sta_report_default_digits >= 0) } { && $sta_report_default_digits >= 0) } {
sta_error 590 "sta_report_default_digits must be a positive integer." sta_error 590 "sta_report_default_digits must be a positive integer."
@ -47,7 +47,7 @@ proc trace_report_default_digits { name1 name2 op } {
} }
} }
trace variable ::sta_crpr_enabled "rw" \ trace add variable ::sta_crpr_enabled {read write} \
sta::trace_crpr_enabled sta::trace_crpr_enabled
proc trace_crpr_enabled { name1 name2 op } { proc trace_crpr_enabled { name1 name2 op } {
@ -55,15 +55,15 @@ proc trace_crpr_enabled { name1 name2 op } {
crpr_enabled set_crpr_enabled crpr_enabled set_crpr_enabled
} }
trace variable ::sta_crpr_mode "rw" \ trace add variable ::sta_crpr_mode {read write} \
sta::trace_crpr_mode sta::trace_crpr_mode
proc trace_crpr_mode { name1 name2 op } { proc trace_crpr_mode { name1 name2 op } {
global sta_crpr_mode global sta_crpr_mode
if { $op == "r" } { if { $op == "read" } {
set sta_crpr_mode [crpr_mode] set sta_crpr_mode [crpr_mode]
} elseif { $op == "w" } { } elseif { $op == "write" } {
if { $sta_crpr_mode == "same_pin" || $sta_crpr_mode == "same_transition" } { if { $sta_crpr_mode == "same_pin" || $sta_crpr_mode == "same_transition" } {
set_crpr_mode $sta_crpr_mode set_crpr_mode $sta_crpr_mode
} else { } else {
@ -72,7 +72,7 @@ proc trace_crpr_mode { name1 name2 op } {
} }
} }
trace variable ::sta_cond_default_arcs_enabled "rw" \ trace add variable ::sta_cond_default_arcs_enabled {read write} \
sta::trace_cond_default_arcs_enabled sta::trace_cond_default_arcs_enabled
proc trace_cond_default_arcs_enabled { name1 name2 op } { proc trace_cond_default_arcs_enabled { name1 name2 op } {
@ -80,7 +80,7 @@ proc trace_cond_default_arcs_enabled { name1 name2 op } {
cond_default_arcs_enabled set_cond_default_arcs_enabled cond_default_arcs_enabled set_cond_default_arcs_enabled
} }
trace variable ::sta_gated_clock_checks_enabled "rw" \ trace add variable ::sta_gated_clock_checks_enabled {read write} \
sta::trace_gated_clk_checks_enabled sta::trace_gated_clk_checks_enabled
proc trace_gated_clk_checks_enabled { name1 name2 op } { proc trace_gated_clk_checks_enabled { name1 name2 op } {
@ -88,7 +88,7 @@ proc trace_gated_clk_checks_enabled { name1 name2 op } {
gated_clk_checks_enabled set_gated_clk_checks_enabled gated_clk_checks_enabled set_gated_clk_checks_enabled
} }
trace variable ::sta_internal_bidirect_instance_paths_enabled "rw" \ trace add variable ::sta_internal_bidirect_instance_paths_enabled {read write} \
sta::trace_internal_bidirect_instance_paths_enabled sta::trace_internal_bidirect_instance_paths_enabled
proc trace_internal_bidirect_instance_paths_enabled { name1 name2 op } { proc trace_internal_bidirect_instance_paths_enabled { name1 name2 op } {
@ -96,7 +96,7 @@ proc trace_internal_bidirect_instance_paths_enabled { name1 name2 op } {
bidirect_inst_paths_enabled set_bidirect_inst_paths_enabled bidirect_inst_paths_enabled set_bidirect_inst_paths_enabled
} }
trace variable ::sta_clock_through_tristate_enabled "rw" \ trace add variable ::sta_clock_through_tristate_enabled {read write} \
sta::trace_clock_through_tristate_enabled sta::trace_clock_through_tristate_enabled
proc trace_clock_through_tristate_enabled { name1 name2 op } { proc trace_clock_through_tristate_enabled { name1 name2 op } {
@ -104,7 +104,7 @@ proc trace_clock_through_tristate_enabled { name1 name2 op } {
clk_thru_tristate_enabled set_clk_thru_tristate_enabled clk_thru_tristate_enabled set_clk_thru_tristate_enabled
} }
trace variable ::sta_preset_clear_arcs_enabled "rw" \ trace add variable ::sta_preset_clear_arcs_enabled {read write} \
sta::trace_preset_clr_arcs_enabled sta::trace_preset_clr_arcs_enabled
proc trace_preset_clr_arcs_enabled { name1 name2 op } { proc trace_preset_clr_arcs_enabled { name1 name2 op } {
@ -112,7 +112,7 @@ proc trace_preset_clr_arcs_enabled { name1 name2 op } {
preset_clr_arcs_enabled set_preset_clr_arcs_enabled preset_clr_arcs_enabled set_preset_clr_arcs_enabled
} }
trace variable ::sta_recovery_removal_checks_enabled "rw" \ trace add variable ::sta_recovery_removal_checks_enabled {read write} \
sta::trace_recovery_removal_checks_enabled sta::trace_recovery_removal_checks_enabled
proc trace_recovery_removal_checks_enabled { name1 name2 op } { proc trace_recovery_removal_checks_enabled { name1 name2 op } {
@ -120,7 +120,7 @@ proc trace_recovery_removal_checks_enabled { name1 name2 op } {
recovery_removal_checks_enabled set_recovery_removal_checks_enabled recovery_removal_checks_enabled set_recovery_removal_checks_enabled
} }
trace variable ::sta_dynamic_loop_breaking "rw" \ trace add variable ::sta_dynamic_loop_breaking {read write} \
sta::trace_dynamic_loop_breaking sta::trace_dynamic_loop_breaking
proc trace_dynamic_loop_breaking { name1 name2 op } { proc trace_dynamic_loop_breaking { name1 name2 op } {
@ -128,7 +128,7 @@ proc trace_dynamic_loop_breaking { name1 name2 op } {
dynamic_loop_breaking set_dynamic_loop_breaking dynamic_loop_breaking set_dynamic_loop_breaking
} }
trace variable ::sta_input_port_default_clock "rw" \ trace add variable ::sta_input_port_default_clock {read write} \
sta::trace_input_port_default_clock sta::trace_input_port_default_clock
proc trace_input_port_default_clock { name1 name2 op } { proc trace_input_port_default_clock { name1 name2 op } {
@ -136,7 +136,7 @@ proc trace_input_port_default_clock { name1 name2 op } {
use_default_arrival_clock set_use_default_arrival_clock use_default_arrival_clock set_use_default_arrival_clock
} }
trace variable ::sta_propagate_all_clocks "rw" \ trace add variable ::sta_propagate_all_clocks {read write} \
sta::trace_propagate_all_clocks sta::trace_propagate_all_clocks
proc trace_propagate_all_clocks { name1 name2 op } { proc trace_propagate_all_clocks { name1 name2 op } {
@ -144,7 +144,7 @@ proc trace_propagate_all_clocks { name1 name2 op } {
propagate_all_clocks set_propagate_all_clocks propagate_all_clocks set_propagate_all_clocks
} }
trace variable ::sta_propagate_gated_clock_enable "rw" \ trace add variable ::sta_propagate_gated_clock_enable {read write} \
sta::trace_propagate_gated_clock_enable sta::trace_propagate_gated_clock_enable
proc trace_propagate_gated_clock_enable { name1 name2 op } { proc trace_propagate_gated_clock_enable { name1 name2 op } {
@ -152,15 +152,15 @@ proc trace_propagate_gated_clock_enable { name1 name2 op } {
propagate_gated_clock_enable set_propagate_gated_clock_enable propagate_gated_clock_enable set_propagate_gated_clock_enable
} }
trace variable ::sta_pocv_mode "rw" \ trace add variable ::sta_pocv_mode {read write} \
sta::trace_pocv_mode sta::trace_pocv_mode
proc trace_pocv_mode { name1 name2 op } { proc trace_pocv_mode { name1 name2 op } {
global sta_pocv_mode global sta_pocv_mode
if { $op == "r" } { if { $op == "read" } {
set sta_pocv_mode [pocv_mode] set sta_pocv_mode [pocv_mode]
} elseif { $op == "w" } { } elseif { $op == "write" } {
if { $sta_pocv_mode == "scalar" \ if { $sta_pocv_mode == "scalar" \
|| $sta_pocv_mode == "normal" \ || $sta_pocv_mode == "normal" \
|| $sta_pocv_mode == "skew_normal" } { || $sta_pocv_mode == "skew_normal" } {
@ -171,15 +171,15 @@ proc trace_pocv_mode { name1 name2 op } {
} }
} }
trace variable ::sta_pocv_quantile "rw" \ trace add variable ::sta_pocv_quantile {read write} \
sta::trace_pocv_quantile sta::trace_pocv_quantile
proc trace_pocv_quantile { name1 name2 op } { proc trace_pocv_quantile { name1 name2 op } {
global sta_pocv_quantile global sta_pocv_quantile
if { $op == "r" } { if { $op == "read" } {
set sta_pocv_quantile [pocv_quantile] set sta_pocv_quantile [pocv_quantile]
} elseif { $op == "w" } { } elseif { $op == "write" } {
if { [string is double $sta_pocv_quantile] \ if { [string is double $sta_pocv_quantile] \
&& $sta_pocv_quantile >= 0.0 } { && $sta_pocv_quantile >= 0.0 } {
set_pocv_quantile $sta_pocv_quantile set_pocv_quantile $sta_pocv_quantile
@ -194,9 +194,9 @@ proc trace_pocv_quantile { name1 name2 op } {
proc trace_boolean_var { op var_name get_proc set_proc } { proc trace_boolean_var { op var_name get_proc set_proc } {
upvar 1 $var_name var upvar 1 $var_name var
if { $op == "r" } { if { $op == "read" } {
set var [$get_proc] set var [$get_proc]
} elseif { $op == "w" } { } elseif { $op == "write" } {
if { $var == 0 } { if { $var == 0 } {
$set_proc 0 $set_proc 0
} elseif { $var == 1 } { } elseif { $var == 1 } {

Binary file not shown.

View File

@ -1,24 +1,11 @@
[get_cells -filter liberty_cell==BUFx2_ASAP7_75t_R *] [get_cells -filter liberty_cell==BUFx2_ASAP7_75t_R *]
u1 u1
[get_clocks -filter is_virtual==0 *]
clk
[get_clocks -filter is_virtual==1 *]
vclk
[get_clocks -filter is_virtual *] [get_clocks -filter is_virtual *]
vclk vclk
[get_clocks -filter is_virtual&&is_generated *] [get_lib_cells -filter is_buffer *]
[get_clocks -filter is_virtual&&is_generated==0 *]
vclk
[get_clocks -filter is_virtual||is_generated *]
vclk
[get_clocks -filter is_virtual==0||is_generated *]
clk
[get_lib_cells -filter is_buffer==1 *]
asap7_small/BUFx2_ASAP7_75t_R asap7_small/BUFx2_ASAP7_75t_R
[get_lib_cells -filter is_inverter==0 *] [get_lib_cells -filter is_inverter *]
asap7_small/AND2x2_ASAP7_75t_R asap7_small/INVx2_ASAP7_75t_R
asap7_small/BUFx2_ASAP7_75t_R
asap7_small/DFFHQx4_ASAP7_75t_R
[get_lib_pins -filter direction==input BUFx2_ASAP7_75t_R/*] [get_lib_pins -filter direction==input BUFx2_ASAP7_75t_R/*]
A A
[get_lib_pins -filter direction==output BUFx2_ASAP7_75t_R/*] [get_lib_pins -filter direction==output BUFx2_ASAP7_75t_R/*]
@ -54,9 +41,22 @@ in2
out out
[get_cells -filter {name ~= *r1*} *] [get_cells -filter {name ~= *r1*} *]
Error: 2600 -filter parsing failed at '~= *r1*'. Error: 2600 -filter parsing failed at '~= *r1*'.
direction == input && name =~ clk*
clk1 clk1
clk2 clk2
clk3 clk3
(direction == input) && (name =~ clk*)"
clk1 clk1
clk2 clk2
clk3 clk3
[get_clocks -filter is_virtual||is_generated *]
vclk
[get_clocks -filter is_virtual==0 *]
clk
[get_clocks -filter is_virtual==false *]
clk
[get_clocks -filter is_virtual==1 *]
vclk
[get_clocks -filter is_virtual==true *]
vclk
{direction == input} {name =~ clk*} {is_clock == 1} && &&

View File

@ -5,29 +5,16 @@ link_design top
create_clock -name clk -period 500 {clk1 clk2 clk3} create_clock -name clk -period 500 {clk1 clk2 clk3}
create_clock -name vclk -period 1000 create_clock -name vclk -period 1000
# Test filters for each SDC get_* command.
puts {[get_cells -filter liberty_cell==BUFx2_ASAP7_75t_R *]} puts {[get_cells -filter liberty_cell==BUFx2_ASAP7_75t_R *]}
report_object_full_names [get_cells -filter liberty_cell==BUFx2_ASAP7_75t_R *] report_object_full_names [get_cells -filter liberty_cell==BUFx2_ASAP7_75t_R *]
puts {[get_clocks -filter is_virtual==0 *]}
report_object_full_names [get_clocks -filter is_virtual==0 *]
puts {[get_clocks -filter is_virtual==1 *]}
report_object_full_names [get_clocks -filter is_virtual==1 *]
puts {[get_clocks -filter is_virtual *]} puts {[get_clocks -filter is_virtual *]}
report_object_full_names [get_clocks -filter is_virtual *] report_object_full_names [get_clocks -filter is_virtual *]
puts {[get_clocks -filter is_virtual&&is_generated *]}
report_object_full_names [get_clocks -filter is_virtual&&is_generated *]
puts {[get_clocks -filter is_virtual&&is_generated==0 *]}
report_object_full_names [get_clocks -filter is_virtual&&is_generated==0 *]
puts {[get_clocks -filter is_virtual||is_generated *]}
report_object_full_names [get_clocks -filter is_virtual||is_generated *]
puts {[get_clocks -filter is_virtual==0||is_generated *]}
report_object_full_names [get_clocks -filter is_virtual==0||is_generated *]
puts {[get_lib_cells -filter is_buffer==1 *]} puts {[get_lib_cells -filter is_buffer *]}
report_object_full_names [get_lib_cells -filter is_buffer==1 *] report_object_full_names [get_lib_cells -filter is_buffer *]
puts {[get_lib_cells -filter is_inverter==0 *]} puts {[get_lib_cells -filter is_inverter *]}
report_object_full_names [get_lib_cells -filter is_inverter==0 *] report_object_full_names [get_lib_cells -filter is_inverter *]
puts {[get_lib_pins -filter direction==input BUFx2_ASAP7_75t_R/*]} puts {[get_lib_pins -filter direction==input BUFx2_ASAP7_75t_R/*]}
report_object_full_names [get_lib_pins -filter direction==input BUFx2_ASAP7_75t_R/*] report_object_full_names [get_lib_pins -filter direction==input BUFx2_ASAP7_75t_R/*]
@ -55,9 +42,32 @@ puts {[get_cells -filter {name ~= *r1*} *]}
catch {get_cells -filter {name ~= *r1*} *} result catch {get_cells -filter {name ~= *r1*} *} result
puts $result puts $result
# AND pattern match expr # AND expr
puts {direction == input && name =~ clk*}
report_object_names [get_ports -filter "direction == input && name =~ clk*" *] report_object_names [get_ports -filter "direction == input && name =~ clk*" *]
# parens around sub-exprs # parens around sub-exprs
puts {(direction == input) && (name =~ clk*)"}
report_object_names [get_ports -filter "(direction == input) && (name =~ clk*)" *] report_object_names [get_ports -filter "(direction == input) && (name =~ clk*)" *]
sta::filter_expr_to_postfix "direction == input && name =~ clk* && is_clock" 1 # OR expr
puts {[get_clocks -filter is_virtual||is_generated *]}
report_object_full_names [get_clocks -filter is_virtual||is_generated *]
# unary==0 / unary==false
puts {[get_clocks -filter is_virtual==0 *]}
report_object_full_names [get_clocks -filter is_virtual==0 *]
puts {[get_clocks -filter is_virtual==false *]}
report_object_full_names [get_clocks -filter is_virtual==false *]
# unary==1 / unary==true
puts {[get_clocks -filter is_virtual==1 *]}
report_object_full_names [get_clocks -filter is_virtual==1 *]
puts {[get_clocks -filter is_virtual==true *]}
report_object_full_names [get_clocks -filter is_virtual==true *]
# glob pattern with . (literal dot, no match symantics)
report_object_full_names [get_cells -filter {name =~ .1} *]
puts [sta::filter_expr_to_postfix "direction == input && name =~ clk* && is_clock"]

View File

@ -5,6 +5,7 @@ Y
[get_lib_pins -of_objects [get_lib_cells *]] [get_lib_pins -of_objects [get_lib_cells *]]
A A
A A
A
B B
CLK CLK
D D
@ -13,3 +14,4 @@ IQN
Q Q
Y Y
Y Y
Y

View File

@ -11,9 +11,11 @@ vclk
asap7_small/AND2x2_ASAP7_75t_R asap7_small/AND2x2_ASAP7_75t_R
asap7_small/BUFx2_ASAP7_75t_R asap7_small/BUFx2_ASAP7_75t_R
asap7_small/DFFHQx4_ASAP7_75t_R asap7_small/DFFHQx4_ASAP7_75t_R
asap7_small/INVx2_ASAP7_75t_R
[get_lib_pins] [get_lib_pins]
A A
A A
A
B B
CLK CLK
D D
@ -22,6 +24,7 @@ IQN
Q Q
Y Y
Y Y
Y
[get_libs] [get_libs]
asap7_small asap7_small
[get_nets] [get_nets]

View File

@ -9,9 +9,11 @@ vclk
asap7_small/AND2x2_ASAP7_75t_R asap7_small/AND2x2_ASAP7_75t_R
asap7_small/BUFx2_ASAP7_75t_R asap7_small/BUFx2_ASAP7_75t_R
asap7_small/DFFHQx4_ASAP7_75t_R asap7_small/DFFHQx4_ASAP7_75t_R
asap7_small/INVx2_ASAP7_75t_R
[get_lib_pins [get_lib_pins]] [get_lib_pins [get_lib_pins]]
A A
A A
A
B B
CLK CLK
D D
@ -20,6 +22,7 @@ IQN
Q Q
Y Y
Y Y
Y
[get_libs [get_libs]] [get_libs [get_libs]]
asap7_small asap7_small
[get_nets [get_nets]] [get_nets [get_nets]]

View File

@ -176,11 +176,10 @@ proc run_tests {} {
run_test $test run_test $test
} }
} }
write_failure_file
} }
proc run_test { test } { proc run_test { test } {
global result_dir diff_file errors diff_options global result_dir diff_file errors diff_options failed_tests
puts -nonewline $test puts -nonewline $test
flush stdout flush stdout
@ -267,8 +266,6 @@ proc run_tests_parallel {} {
vwait reg_parallel_job_done vwait reg_parallel_job_done
} }
} }
# update results/failures and results/diffs
write_failure_file
} }
} }
@ -432,26 +429,21 @@ proc test_failed { test reason } {
} }
lappend failed_tests $test lappend failed_tests $test
incr errors($reason) incr errors($reason)
append_diff_file $test
} }
proc write_failure_file {} { proc append_diff_file { test } {
global failure_file failed_tests failed_tests_summery global failure_file
global diff_file diff_options global diff_file diff_options
set fail_ch [open $failure_file "a"] set fail_ch [open $failure_file "a"]
foreach test $failed_tests { puts $fail_ch $test
if { ![info exists failed_tests_summery($test)] } {
puts $fail_ch $test
# Append diff to results/diffs
set log_file [test_log_file $test]
set ok_file [test_ok_file $test]
catch [concat exec diff $diff_options $ok_file $log_file >> $diff_file]
set failed_tests_summery($test) 1
}
}
close $fail_ch close $fail_ch
# Append diff to results/diffs
set log_file [test_log_file $test]
set ok_file [test_ok_file $test]
catch [concat exec diff $diff_options $ok_file $log_file >> $diff_file]
} }
# Error messages can be found in "valgrind/memcheck/mc_errcontext.c". # Error messages can be found in "valgrind/memcheck/mc_errcontext.c".
@ -530,6 +522,10 @@ proc show_summary {} {
global app_path app global app_path app
puts "------------------------------------------------------" puts "------------------------------------------------------"
if { $valgrind_shared_lib_failure } {
puts "WARNING: valgrind failed because the executable is not statically linked."
}
puts "See $result_dir for log files"
set test_count [llength $tests] set test_count [llength $tests]
if { [found_errors] } { if { [found_errors] } {
if { $errors(error) != 0 } { if { $errors(error) != 0 } {
@ -556,10 +552,6 @@ proc show_summary {} {
} else { } else {
puts "Passed $test_count" puts "Passed $test_count"
} }
if { $valgrind_shared_lib_failure } {
puts "WARNING: valgrind failed because the executable is not statically linked."
}
puts "See $result_dir for log files"
} }
proc found_errors {} { proc found_errors {} {
@ -590,22 +582,27 @@ proc save_ok_main {} {
} }
} else { } else {
foreach test $argv { foreach test $argv {
save_ok $test if { [lsearch [group_tests "all"] $test] == -1 } {
puts "Error: test $test not found."
} else {
save_ok $test
}
} }
} }
} }
# hook for pvt/public sync.
proc save_ok { test } { proc save_ok { test } {
if { [lsearch [group_tests "all"] $test] == -1 } { save_ok_file $test
puts "Error: test $test not found." }
proc save_ok_file { test } {
set ok_file [test_ok_file $test]
set log_file [test_log_file $test]
if { ! [file exists $log_file] } {
puts "Error: log file $log_file not found."
} else { } else {
set ok_file [test_ok_file $test] file copy -force $log_file $ok_file
set log_file [test_log_file $test]
if { ! [file exists $log_file] } {
puts "Error: log file $log_file not found."
} else {
file copy -force $log_file $ok_file
}
} }
} }

View File

@ -72,6 +72,11 @@ encapGetHandleProc(ClientData instanceData,
static int static int
encapBlockModeProc(ClientData instanceData, int mode); encapBlockModeProc(ClientData instanceData, int mode);
static int
encapClose2Proc(ClientData instanceData,
Tcl_Interp *interp,
int flags);
#if TCL_MAJOR_VERSION < 9 #if TCL_MAJOR_VERSION < 9
static int static int
encapCloseProc(ClientData instanceData, Tcl_Interp *interp); encapCloseProc(ClientData instanceData, Tcl_Interp *interp);
@ -97,13 +102,13 @@ Tcl_ChannelType tcl_encap_type_stdout = {
#if TCL_MAJOR_VERSION < 9 #if TCL_MAJOR_VERSION < 9
encapSeekProc, encapSeekProc,
#else #else
nullptr, // close2Proc nullptr, // seekProc unused
#endif #endif
encapSetOptionProc, encapSetOptionProc,
encapGetOptionProc, encapGetOptionProc,
encapWatchProc, encapWatchProc,
encapGetHandleProc, encapGetHandleProc,
nullptr, // close2Proc encapClose2Proc,
encapBlockModeProc, encapBlockModeProc,
nullptr, // flushProc nullptr, // flushProc
nullptr, // handlerProc nullptr, // handlerProc
@ -290,17 +295,31 @@ encapBlockModeProc(ClientData,
return 0; return 0;
} }
// Close channel implementing CloseProc() or Close2Proc()
static int
closeChannel(ReportTcl *report)
{
report->logEnd();
report->redirectFileEnd();
report->redirectStringEnd();
return 0;
}
static int
encapClose2Proc(ClientData instanceData,
Tcl_Interp *,
int)
{
return closeChannel(reinterpret_cast<ReportTcl *>(instanceData));
}
#if TCL_MAJOR_VERSION < 9 #if TCL_MAJOR_VERSION < 9
static int static int
encapCloseProc(ClientData instanceData, encapCloseProc(ClientData instanceData,
Tcl_Interp *) Tcl_Interp *)
{ {
ReportTcl *report = reinterpret_cast<ReportTcl *>(instanceData); return closeChannel(reinterpret_cast<ReportTcl *>(instanceData));
report->logEnd();
report->redirectFileEnd();
report->redirectStringEnd();
return 0;
} }
static int static int

View File

@ -28,6 +28,7 @@
#include <cctype> #include <cctype>
#include <charconv> #include <charconv>
#include <system_error> #include <system_error>
#include <version>
namespace sta { namespace sta {
@ -56,12 +57,22 @@ std::pair<float, bool>
stringFloat(const std::string &str) stringFloat(const std::string &str)
{ {
float value; float value;
// OsX 15.xx and earlier clang do not support std::from_chars.
#if defined(__cpp_lib_to_chars) && __cpp_lib_to_chars >= 201611L
auto [ptr, ec] = std::from_chars(str.data(), str.data() + str.size(), value); auto [ptr, ec] = std::from_chars(str.data(), str.data() + str.size(), value);
if (ec == std::errc() if (ec == std::errc()
&& *ptr == '\0') && *ptr == '\0')
return {value, true}; return {value, true};
else else
return {0.0, false}; return {0.0, false};
#else
char *ptr;
value = strtof(str.data(), &ptr);
if (!errno || *ptr != '\0')
return {0.0, false};
else
return {value, true};
#endif
} }
void void