Skip to content

Commit

Permalink
Merge branch 'parallaxsw:master' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
akashlevy authored Nov 14, 2024
2 parents 3a2429b + 3f52687 commit 315a409
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 42 deletions.
8 changes: 4 additions & 4 deletions dcalc/CcsCeffDelayCalc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ CcsCeffDelayCalc::makeResult(const LibertyLibrary *drvr_library,
dcalc_result.setGateDelay(gate_delay);
dcalc_result.setDrvrSlew(drvr_slew);

for (const auto [load_pin, load_idx] : load_pin_index_map) {
for (const auto &[load_pin, load_idx] : load_pin_index_map) {
ArcDelay wire_delay;
Slew load_slew;
loadDelaySlew(load_pin, drvr_library, rf, drvr_slew, wire_delay, load_slew);
Expand Down Expand Up @@ -452,9 +452,9 @@ CcsCeffDelayCalc::findVlTime(double v,
double t_init = region_ramp_times_[0];
double t_final = region_ramp_times_[region_count_];
bool root_fail = false;
double time = findRoot([=] (double t,
double &y,
double &dy) {
double time = findRoot([&] (double t,
double &y,
double &dy) {
vl(t, elmore, y, dy);
y -= v;
}, t_init, t_final + elmore * 3.0, .001, 20, root_fail);
Expand Down
6 changes: 3 additions & 3 deletions dcalc/DmpCeff.cc
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ DmpAlg::findDriverParams(double ceff)
x_[DmpParam::dt] = dt;
x_[DmpParam::t0] = t0;
newtonRaphson(100, x_, nr_order_, driver_param_tol,
[=] () { evalDmpEqns(); },
[this] () { evalDmpEqns(); },
fvec_, fjac_, index_, p_, scale_);
t0_ = x_[DmpParam::t0];
dt_ = x_[DmpParam::dt];
Expand Down Expand Up @@ -494,7 +494,7 @@ DmpAlg::findVoCrossing(double vth,
double t_lower,
double t_upper)
{
FindRootFunc vo_func = [=] (double t,
FindRootFunc vo_func = [&] (double t,
double &y,
double &dy) {
double vo, vo_dt;
Expand Down Expand Up @@ -612,7 +612,7 @@ DmpAlg::findVlCrossing(double vth,
double t_lower,
double t_upper)
{
FindRootFunc vl_func = [=] (double t,
FindRootFunc vl_func = [&] (double t,
double &y,
double &dy) {
double vl, vl_dt;
Expand Down
2 changes: 1 addition & 1 deletion dcalc/ParallelDelayCalc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ ParallelDelayCalc::gateDelaysParallel(ArcDcalcArgSeq &dcalc_args,
slew_sum += 1.0 / drvr_slew;

dcalc_result.setLoadCount(load_pin_index_map.size());
for (const auto [load_pin, load_idx] : load_pin_index_map) {
for (const auto &[load_pin, load_idx] : load_pin_index_map) {
dcalc_result.setWireDelay(load_idx, gate_result.wireDelay(load_idx));
dcalc_result.setLoadSlew(load_idx, gate_result.loadSlew(load_idx));
}
Expand Down
2 changes: 1 addition & 1 deletion include/sta/ConcreteLibrary.hh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class LibertyCell;
class LibertyPort;

typedef Map<const char*, ConcreteCell*, CharPtrLess> ConcreteCellMap;
typedef Map<string, string> AttributeMap;
typedef std::map<string, string> AttributeMap;
typedef Vector<ConcretePort*> ConcretePortSeq;
typedef Map<const char*, ConcretePort*, CharPtrLess> ConcretePortMap;
typedef ConcreteCellMap::ConstIterator ConcreteLibraryCellIterator;
Expand Down
2 changes: 1 addition & 1 deletion include/sta/ConcreteNetwork.hh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ConcreteBindingTbl;
class ConcreteLibertyLibraryIterator;

typedef Vector<ConcreteLibrary*> ConcreteLibrarySeq;
typedef Map<string, string> AttributeMap;
typedef std::map<string, string> AttributeMap;
typedef Map<const char*, ConcreteLibrary*, CharPtrLess> ConcreteLibraryMap;
typedef ConcreteLibrarySeq::ConstIterator ConcreteLibraryIterator;
typedef Map<const char *, ConcreteInstance*,
Expand Down
13 changes: 8 additions & 5 deletions include/sta/Units.hh
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@

#pragma once

#include <string>

namespace sta {

using std::string;

class Unit
{
public:
Unit(const char *suffix);
~Unit();
Unit(float scale,
const char *suffix,
int digits);
Expand All @@ -34,9 +37,9 @@ public:
float scale() const { return scale_; }
void setScale(float scale);
const char *scaleAbbreviation() const;
const char *suffix() const { return suffix_; }
const char *suffix() const { return suffix_.c_str(); }
// scale abbreviation + suffix
const char *scaledSuffix() const { return scaled_suffix_; }
const char *scaledSuffix() const { return scaled_suffix_.c_str(); }
void setSuffix(const char *suffix);
int digits() const { return digits_; }
void setDigits(int digits);
Expand All @@ -51,8 +54,8 @@ private:
void setScaledSuffix();

float scale_; // multiplier from user units to internal units
const char *suffix_; // print suffix
const char *scaled_suffix_;
string suffix_; // print suffix
string scaled_suffix_;
int digits_; // print digits (after decimal pt)
};

Expand Down
24 changes: 6 additions & 18 deletions liberty/Units.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ using std::abs;

Unit::Unit(const char *suffix) :
scale_(1.0),
suffix_(stringCopy(suffix)),
scaled_suffix_(nullptr),
suffix_(suffix),
digits_(3)
{
setScaledSuffix();
Expand All @@ -40,8 +39,7 @@ Unit::Unit(float scale,
const char *suffix,
int digits) :
scale_(scale),
suffix_(stringCopy(suffix)),
scaled_suffix_(nullptr),
suffix_(suffix),
digits_(digits)
{
setScaledSuffix();
Expand All @@ -50,24 +48,15 @@ Unit::Unit(float scale,
void
Unit::setScaledSuffix()
{
stringDelete(scaled_suffix_);
scaled_suffix_ = stringPrint("%s%s", scaleAbbreviation(), suffix_);
}

Unit::~Unit()
{
stringDelete(suffix_);
stringDelete(scaled_suffix_);
scaled_suffix_ = scaleAbbreviation() + suffix_;
}

void
Unit::operator=(const Unit &unit)
{
scale_ = unit.scale_;
stringDelete(suffix_);
suffix_ = stringCopy(unit.suffix_);
stringDelete(scaled_suffix_);
scaled_suffix_ = stringCopy(unit.scaled_suffix_);
suffix_ = unit.suffix_;
scaled_suffix_ = unit.scaled_suffix_;
digits_ = unit.digits_;
}

Expand Down Expand Up @@ -116,8 +105,7 @@ Unit::scaleAbbreviation() const
void
Unit::setSuffix(const char *suffix)
{
stringDelete(suffix_);
suffix_ = stringCopy(suffix);
suffix_ = suffix;
setScaledSuffix();
}

Expand Down
8 changes: 4 additions & 4 deletions network/ConcreteLibrary.cc
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,15 @@ void
ConcreteCell::setAttribute(const string &key,
const string &value)
{
attribute_map_.insert(key, value);
attribute_map_[key] = value;
}

string
ConcreteCell::getAttribute(const string &key) const
{
if (attribute_map_.hasKey(key)) {
return attribute_map_.findKey(key);
}
const auto &itr = attribute_map_.find(key);
if (itr != attribute_map_.end())
return itr->second;
return "";
}

Expand Down
8 changes: 4 additions & 4 deletions network/ConcreteNetwork.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1686,15 +1686,15 @@ void
ConcreteInstance::setAttribute(const string &key,
const string &value)
{
attribute_map_.insert(key, value);
attribute_map_[key] = value;
}

string
ConcreteInstance::getAttribute(const string &key) const
{
if (attribute_map_.hasKey(key)) {
return attribute_map_.findKey(key);
}
const auto &itr = attribute_map_.find(key);
if (itr != attribute_map_.end())
return itr->second;
return "";
}

Expand Down
2 changes: 1 addition & 1 deletion search/Bfs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ BfsIterator::visitParallel(Level to_level,
for (size_t k = 0; k < thread_count; k++) {
// Last thread gets the left overs.
size_t to = (k == thread_count - 1) ? vertex_count : from + chunk_size;
dispatch_queue_->dispatch( [=](int) {
dispatch_queue_->dispatch( [&](int) {
for (size_t i = from; i < to; i++) {
Vertex *vertex = level_vertices[i];
if (vertex) {
Expand Down

0 comments on commit 315a409

Please sign in to comment.