Table use make_shared
Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
parent
6b8ab8aa9c
commit
0b4018e45d
|
|
@ -179,7 +179,7 @@ public:
|
||||||
float wire_delay) const;
|
float wire_delay) const;
|
||||||
// Check for supported axis variables.
|
// Check for supported axis variables.
|
||||||
// Return true if axes are supported.
|
// Return true if axes are supported.
|
||||||
static bool checkSlewDegradationAxes(Table *table);
|
static bool checkSlewDegradationAxes(TablePtr table);
|
||||||
|
|
||||||
float defaultInputPinCap() const { return default_input_pin_cap_; }
|
float defaultInputPinCap() const { return default_input_pin_cap_; }
|
||||||
void setDefaultInputPinCap(float cap);
|
void setDefaultInputPinCap(float cap);
|
||||||
|
|
@ -1050,18 +1050,18 @@ public:
|
||||||
OcvDerate(const char *name);
|
OcvDerate(const char *name);
|
||||||
~OcvDerate();
|
~OcvDerate();
|
||||||
const char *name() const { return name_; }
|
const char *name() const { return name_; }
|
||||||
Table *derateTable(const RiseFall *rf,
|
TablePtr derateTable(const RiseFall *rf,
|
||||||
const EarlyLate *early_late,
|
const EarlyLate *early_late,
|
||||||
PathType path_type);
|
PathType path_type);
|
||||||
void setDerateTable(const RiseFall *rf,
|
void setDerateTable(const RiseFall *rf,
|
||||||
const EarlyLate *early_late,
|
const EarlyLate *early_late,
|
||||||
PathType path_type,
|
PathType path_type,
|
||||||
Table *derate);
|
TablePtr derate);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char *name_;
|
const char *name_;
|
||||||
// [rf_type][derate_type][path_type]
|
// [rf_type][derate_type][path_type]
|
||||||
Table *derate_[RiseFall::index_count][EarlyLate::index_count][path_type_count];
|
TablePtr derate_[RiseFall::index_count][EarlyLate::index_count][path_type_count];
|
||||||
};
|
};
|
||||||
|
|
||||||
// Power/ground port.
|
// Power/ground port.
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,7 @@ typedef std::pair<const LibertyPort*,const LibertyPort*> LibertyPortPair;
|
||||||
typedef Set<LibertyCell*> LibertyCellSet;
|
typedef Set<LibertyCell*> LibertyCellSet;
|
||||||
typedef Vector<float> FloatSeq;
|
typedef Vector<float> FloatSeq;
|
||||||
typedef Vector<FloatSeq*> FloatTable;
|
typedef Vector<FloatSeq*> FloatTable;
|
||||||
|
typedef std::shared_ptr<Table> TablePtr;
|
||||||
typedef std::shared_ptr<TimingArcAttrs> TimingArcAttrsPtr;
|
typedef std::shared_ptr<TimingArcAttrs> TimingArcAttrsPtr;
|
||||||
typedef std::shared_ptr<TableAxis> TableAxisPtr;
|
typedef std::shared_ptr<TableAxis> TableAxisPtr;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ public:
|
||||||
const TableModel *slewModel() const { return slew_model_; }
|
const TableModel *slewModel() const { return slew_model_; }
|
||||||
// Check the axes before making the model.
|
// Check the axes before making the model.
|
||||||
// Return true if the model axes are supported.
|
// Return true if the model axes are supported.
|
||||||
static bool checkAxes(const Table *table);
|
static bool checkAxes(const TablePtr table);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void maxCapSlew(const LibertyCell *cell,
|
void maxCapSlew(const LibertyCell *cell,
|
||||||
|
|
@ -147,7 +147,7 @@ public:
|
||||||
|
|
||||||
// Check the axes before making the model.
|
// Check the axes before making the model.
|
||||||
// Return true if the model axes are supported.
|
// Return true if the model axes are supported.
|
||||||
static bool checkAxes(const Table *table);
|
static bool checkAxes(const TablePtr table);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void setIsScaled(bool is_scaled);
|
virtual void setIsScaled(bool is_scaled);
|
||||||
|
|
@ -190,11 +190,10 @@ protected:
|
||||||
class TableModel
|
class TableModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TableModel(Table *table,
|
TableModel(TablePtr table,
|
||||||
TableTemplate *tbl_template,
|
TableTemplate *tbl_template,
|
||||||
ScaleFactorType scale_factor_type,
|
ScaleFactorType scale_factor_type,
|
||||||
RiseFall *rf);
|
RiseFall *rf);
|
||||||
~TableModel();
|
|
||||||
void setScaleFactorType(ScaleFactorType type);
|
void setScaleFactorType(ScaleFactorType type);
|
||||||
int order() const;
|
int order() const;
|
||||||
TableTemplate *tblTemplate() const { return tbl_template_; }
|
TableTemplate *tblTemplate() const { return tbl_template_; }
|
||||||
|
|
@ -239,7 +238,7 @@ protected:
|
||||||
int digits,
|
int digits,
|
||||||
string *result) const;
|
string *result) const;
|
||||||
|
|
||||||
Table *table_;
|
TablePtr table_;
|
||||||
TableTemplate *tbl_template_;
|
TableTemplate *tbl_template_;
|
||||||
// ScaleFactorType gcc barfs if this is dcl'd.
|
// ScaleFactorType gcc barfs if this is dcl'd.
|
||||||
unsigned scale_factor_type_:scale_factor_bits;
|
unsigned scale_factor_type_:scale_factor_bits;
|
||||||
|
|
|
||||||
|
|
@ -373,7 +373,7 @@ LibertyLibrary::degradeWireSlew(const LibertyCell *cell,
|
||||||
// Check for supported axis variables.
|
// Check for supported axis variables.
|
||||||
// Return true if axes are supported.
|
// Return true if axes are supported.
|
||||||
bool
|
bool
|
||||||
LibertyLibrary::checkSlewDegradationAxes(Table *table)
|
LibertyLibrary::checkSlewDegradationAxes(TablePtr table)
|
||||||
{
|
{
|
||||||
switch (table->order()) {
|
switch (table->order()) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
@ -2964,28 +2964,9 @@ OcvDerate::OcvDerate(const char *name) :
|
||||||
OcvDerate::~OcvDerate()
|
OcvDerate::~OcvDerate()
|
||||||
{
|
{
|
||||||
stringDelete(name_);
|
stringDelete(name_);
|
||||||
// Derating table models can be shared in multiple places in derate_;
|
|
||||||
// Collect them in a set to avoid duplicate deletes.
|
|
||||||
Set<Table*> models;
|
|
||||||
for (auto el_index : EarlyLate::rangeIndex()) {
|
|
||||||
for (auto tr_index : RiseFall::rangeIndex()) {
|
|
||||||
Table *derate;
|
|
||||||
derate = derate_[tr_index][el_index][int(PathType::clk)];
|
|
||||||
if (derate)
|
|
||||||
models.insert(derate);
|
|
||||||
derate = derate_[tr_index][el_index][int(PathType::data)];
|
|
||||||
if (derate)
|
|
||||||
models.insert(derate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Set<Table*>::Iterator model_iter(models);
|
|
||||||
while (model_iter.hasNext()) {
|
|
||||||
Table *model = model_iter.next();
|
|
||||||
delete model;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Table *
|
TablePtr
|
||||||
OcvDerate::derateTable(const RiseFall *rf,
|
OcvDerate::derateTable(const RiseFall *rf,
|
||||||
const EarlyLate *early_late,
|
const EarlyLate *early_late,
|
||||||
PathType path_type)
|
PathType path_type)
|
||||||
|
|
@ -2997,7 +2978,7 @@ void
|
||||||
OcvDerate::setDerateTable(const RiseFall *rf,
|
OcvDerate::setDerateTable(const RiseFall *rf,
|
||||||
const EarlyLate *early_late,
|
const EarlyLate *early_late,
|
||||||
const PathType path_type,
|
const PathType path_type,
|
||||||
Table *derate)
|
TablePtr derate)
|
||||||
{
|
{
|
||||||
derate_[rf->index()][early_late->index()][int(path_type)] = derate;
|
derate_[rf->index()][early_late->index()][int(path_type)] = derate;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,8 @@ extern int LibertyParse_debug;
|
||||||
|
|
||||||
namespace sta {
|
namespace sta {
|
||||||
|
|
||||||
|
using std::make_shared;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
scaleFloats(FloatSeq *floats,
|
scaleFloats(FloatSeq *floats,
|
||||||
float scale);
|
float scale);
|
||||||
|
|
@ -3803,10 +3805,8 @@ LibertyReader::endCellRiseFall(LibertyGroup *group)
|
||||||
scale_factor_type_, rf_);
|
scale_factor_type_, rf_);
|
||||||
timing_->setCell(rf_, table_model);
|
timing_->setCell(rf_, table_model);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
libWarn(118, group, "unsupported model axis.");
|
libWarn(118, group, "unsupported model axis.");
|
||||||
delete table_;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
endTableModel();
|
endTableModel();
|
||||||
}
|
}
|
||||||
|
|
@ -3832,10 +3832,8 @@ LibertyReader::endRiseFallTransition(LibertyGroup *group)
|
||||||
scale_factor_type_, rf_);
|
scale_factor_type_, rf_);
|
||||||
timing_->setTransition(rf_, table_model);
|
timing_->setTransition(rf_, table_model);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
libWarn(119, group, "unsupported model axis.");
|
libWarn(119, group, "unsupported model axis.");
|
||||||
delete table_;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
endTableModel();
|
endTableModel();
|
||||||
}
|
}
|
||||||
|
|
@ -3863,10 +3861,8 @@ LibertyReader::endRiseFallConstraint(LibertyGroup *group)
|
||||||
scale_factor_type_, rf_);
|
scale_factor_type_, rf_);
|
||||||
timing_->setConstraint(rf_, table_model);
|
timing_->setConstraint(rf_, table_model);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
libWarn(120, group, "unsupported model axis.");
|
libWarn(120, group, "unsupported model axis.");
|
||||||
delete table_;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
endTableModel();
|
endTableModel();
|
||||||
}
|
}
|
||||||
|
|
@ -3900,10 +3896,8 @@ LibertyReader::endRiseFallTransitionDegredation(LibertyGroup *group)
|
||||||
scale_factor_type_, rf_);
|
scale_factor_type_, rf_);
|
||||||
library_->setWireSlewDegradationTable(table_model, rf_);
|
library_->setWireSlewDegradationTable(table_model, rf_);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
libWarn(121, group, "unsupported model axis.");
|
libWarn(121, group, "unsupported model axis.");
|
||||||
delete table_;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
endTableModel();
|
endTableModel();
|
||||||
}
|
}
|
||||||
|
|
@ -4004,27 +3998,27 @@ LibertyReader::makeTable(LibertyAttr *attr,
|
||||||
FloatTable *table = makeFloatTable(attr,
|
FloatTable *table = makeFloatTable(attr,
|
||||||
axis_[0]->size()*axis_[1]->size(),
|
axis_[0]->size()*axis_[1]->size(),
|
||||||
axis_[2]->size(), scale);
|
axis_[2]->size(), scale);
|
||||||
table_ = new Table3(table, axis_[0], axis_[1], axis_[2]);
|
table_ = make_shared<Table3>(table, axis_[0], axis_[1], axis_[2]);
|
||||||
}
|
}
|
||||||
else if (axis_[0] && axis_[1]) {
|
else if (axis_[0] && axis_[1]) {
|
||||||
// Row variable1/axis[0]
|
// Row variable1/axis[0]
|
||||||
// Column variable2/axis[1]
|
// Column variable2/axis[1]
|
||||||
FloatTable *table = makeFloatTable(attr, axis_[0]->size(),
|
FloatTable *table = makeFloatTable(attr, axis_[0]->size(),
|
||||||
axis_[1]->size(), scale);
|
axis_[1]->size(), scale);
|
||||||
table_ = new Table2(table, axis_[0], axis_[1]);
|
table_ = make_shared<Table2>(table, axis_[0], axis_[1]);
|
||||||
}
|
}
|
||||||
else if (axis_[0]) {
|
else if (axis_[0]) {
|
||||||
FloatTable *table = makeFloatTable(attr, 1, axis_[0]->size(), scale);
|
FloatTable *table = makeFloatTable(attr, 1, axis_[0]->size(), scale);
|
||||||
FloatSeq *values = (*table)[0];
|
FloatSeq *values = (*table)[0];
|
||||||
delete table;
|
delete table;
|
||||||
table_ = new Table1(values, axis_[0]);
|
table_ = make_shared<Table1>(values, axis_[0]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
FloatTable *table = makeFloatTable(attr, 1, 1, scale);
|
FloatTable *table = makeFloatTable(attr, 1, 1, scale);
|
||||||
float value = (*(*table)[0])[0];
|
float value = (*(*table)[0])[0];
|
||||||
delete (*table)[0];
|
delete (*table)[0];
|
||||||
delete table;
|
delete table;
|
||||||
table_ = new Table0(value);
|
table_ = make_shared<Table0>(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -4819,10 +4813,8 @@ LibertyReader::endOcvSigmaCell(LibertyGroup *group)
|
||||||
else
|
else
|
||||||
timing_->setDelaySigma(rf_, sigma_type_->asMinMax(), table_model);
|
timing_->setDelaySigma(rf_, sigma_type_->asMinMax(), table_model);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
libWarn(152, group, "unsupported model axis.");
|
libWarn(152, group, "unsupported model axis.");
|
||||||
delete table_;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
endTableModel();
|
endTableModel();
|
||||||
}
|
}
|
||||||
|
|
@ -4853,10 +4845,8 @@ LibertyReader::endOcvSigmaTransition(LibertyGroup *group)
|
||||||
else
|
else
|
||||||
timing_->setSlewSigma(rf_, sigma_type_->asMinMax(), table_model);
|
timing_->setSlewSigma(rf_, sigma_type_->asMinMax(), table_model);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
libWarn(153, group, "unsupported model axis.");
|
libWarn(153, group, "unsupported model axis.");
|
||||||
delete table_;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
endTableModel();
|
endTableModel();
|
||||||
}
|
}
|
||||||
|
|
@ -4887,10 +4877,8 @@ LibertyReader::endOcvSigmaConstraint(LibertyGroup *group)
|
||||||
else
|
else
|
||||||
timing_->setConstraintSigma(rf_, sigma_type_->asMinMax(), table_model);
|
timing_->setConstraintSigma(rf_, sigma_type_->asMinMax(), table_model);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
libWarn(154, group, "unsupported model axis.");
|
libWarn(154, group, "unsupported model axis.");
|
||||||
delete table_;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
endTableModel();
|
endTableModel();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -575,7 +575,7 @@ protected:
|
||||||
LibertyPgPort *pg_port_;
|
LibertyPgPort *pg_port_;
|
||||||
ScaleFactorType scale_factor_type_;
|
ScaleFactorType scale_factor_type_;
|
||||||
TableAxisPtr axis_[3];
|
TableAxisPtr axis_[3];
|
||||||
Table *table_;
|
TablePtr table_;
|
||||||
float table_model_scale_;
|
float table_model_scale_;
|
||||||
ModeDef *mode_def_;
|
ModeDef *mode_def_;
|
||||||
ModeValueDef *mode_value_;
|
ModeValueDef *mode_value_;
|
||||||
|
|
|
||||||
|
|
@ -320,7 +320,7 @@ GateTableModel::axisValue(TableAxisPtr axis,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
GateTableModel::checkAxes(const Table *table)
|
GateTableModel::checkAxes(const TablePtr table)
|
||||||
{
|
{
|
||||||
TableAxisPtr axis1 = table->axis1();
|
TableAxisPtr axis1 = table->axis1();
|
||||||
TableAxisPtr axis2 = table->axis2();
|
TableAxisPtr axis2 = table->axis2();
|
||||||
|
|
@ -529,7 +529,7 @@ CheckTableModel::axisValue(TableAxisPtr axis,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CheckTableModel::checkAxes(const Table *table)
|
CheckTableModel::checkAxes(const TablePtr table)
|
||||||
{
|
{
|
||||||
TableAxisPtr axis1 = table->axis1();
|
TableAxisPtr axis1 = table->axis1();
|
||||||
TableAxisPtr axis2 = table->axis2();
|
TableAxisPtr axis2 = table->axis2();
|
||||||
|
|
@ -555,7 +555,7 @@ CheckTableModel::checkAxis(TableAxisPtr axis)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TableModel::TableModel(Table *table,
|
TableModel::TableModel(TablePtr table,
|
||||||
TableTemplate *tbl_template,
|
TableTemplate *tbl_template,
|
||||||
ScaleFactorType scale_factor_type,
|
ScaleFactorType scale_factor_type,
|
||||||
RiseFall *rf) :
|
RiseFall *rf) :
|
||||||
|
|
@ -567,11 +567,6 @@ TableModel::TableModel(Table *table,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
TableModel::~TableModel()
|
|
||||||
{
|
|
||||||
delete table_;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
TableModel::order() const
|
TableModel::order() const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@
|
||||||
namespace sta {
|
namespace sta {
|
||||||
|
|
||||||
using std::max;
|
using std::max;
|
||||||
|
using std::make_shared;
|
||||||
|
|
||||||
MakeTimingModel::MakeTimingModel(const Corner *corner,
|
MakeTimingModel::MakeTimingModel(const Corner *corner,
|
||||||
Sta *sta) :
|
Sta *sta) :
|
||||||
|
|
@ -500,7 +501,7 @@ MakeTimingModel::makeScalarCheckModel(float value,
|
||||||
ScaleFactorType scale_factor_type,
|
ScaleFactorType scale_factor_type,
|
||||||
RiseFall *rf)
|
RiseFall *rf)
|
||||||
{
|
{
|
||||||
Table *table = new Table0(value);
|
TablePtr table = make_shared<Table0>(value);
|
||||||
TableTemplate *tbl_template =
|
TableTemplate *tbl_template =
|
||||||
library_->findTableTemplate("scalar", TableTemplateType::delay);
|
library_->findTableTemplate("scalar", TableTemplateType::delay);
|
||||||
TableModel *table_model = new TableModel(table, tbl_template,
|
TableModel *table_model = new TableModel(table, tbl_template,
|
||||||
|
|
@ -514,8 +515,8 @@ MakeTimingModel::makeGateModelScalar(Delay delay,
|
||||||
Slew slew,
|
Slew slew,
|
||||||
RiseFall *rf)
|
RiseFall *rf)
|
||||||
{
|
{
|
||||||
Table *delay_table = new Table0(delayAsFloat(delay));
|
TablePtr delay_table = make_shared<Table0>(delayAsFloat(delay));
|
||||||
Table *slew_table = new Table0(delayAsFloat(slew));
|
TablePtr slew_table = make_shared<Table0>(delayAsFloat(slew));
|
||||||
TableTemplate *tbl_template =
|
TableTemplate *tbl_template =
|
||||||
library_->findTableTemplate("scalar", TableTemplateType::delay);
|
library_->findTableTemplate("scalar", TableTemplateType::delay);
|
||||||
TableModel *delay_model = new TableModel(delay_table, tbl_template,
|
TableModel *delay_model = new TableModel(delay_table, tbl_template,
|
||||||
|
|
@ -590,8 +591,8 @@ MakeTimingModel::makeGateModelTable(const Pin *output_pin,
|
||||||
std::make_shared<TableAxis>(TableAxisVariable::total_output_net_capacitance,
|
std::make_shared<TableAxis>(TableAxisVariable::total_output_net_capacitance,
|
||||||
axis_values);
|
axis_values);
|
||||||
|
|
||||||
Table *delay_table = new Table1(load_values, load_axis);
|
TablePtr delay_table = make_shared<Table1>(load_values, load_axis);
|
||||||
Table *slew_table = new Table1(slew_values, load_axis);
|
TablePtr slew_table = make_shared<Table1>(slew_values, load_axis);
|
||||||
|
|
||||||
string template_name = "template_";
|
string template_name = "template_";
|
||||||
template_name += std::to_string(tbl_template_index_++);
|
template_name += std::to_string(tbl_template_index_++);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue