default_operating_condition allow forward ref

This commit is contained in:
James Cherry 2021-01-19 15:40:09 -07:00
parent d00937f981
commit ed7d2dcc36
2 changed files with 17 additions and 9 deletions

View File

@ -129,7 +129,8 @@ LibertyReader::readLibertyFile(const char *filename,
ocv_derate_ = nullptr;
pg_port_ = nullptr;
have_resistance_unit_ = false;
default_operating_condition_ = nullptr;
for (auto rf_index : RiseFall::rangeIndex()) {
have_input_threshold_[rf_index] = false;
have_output_threshold_[rf_index] = false;
@ -611,6 +612,17 @@ LibertyReader::endLibraryAttrs(LibertyGroup *group)
stringDelete(default_wireload_selection_);
}
if (default_operating_condition_) {
OperatingConditions *op_cond =
library_->findOperatingConditions(default_operating_condition_);
if (op_cond)
library_->setDefaultOperatingConditions(op_cond);
else
libWarn(60, group, "default_operating_condition %s not found.",
default_operating_condition_);
stringDelete(default_operating_condition_);
}
bool missing_threshold = false;
for (auto tr : RiseFall::range()) {
int tr_index = tr->index();
@ -1096,14 +1108,9 @@ void
LibertyReader::visitDefaultOperatingConditions(LibertyAttr *attr)
{
if (library_) {
const char *op_cond_name = getAttrString(attr);
OperatingConditions *op_cond =
library_->findOperatingConditions(op_cond_name);
if (op_cond)
library_->setDefaultOperatingConditions(op_cond);
else
libWarn(60, attr, "default_operating_condition %s not found.",
op_cond_name);
const char *value = getAttrString(attr);
if (value)
default_operating_condition_ = stringCopy(value);
}
}

View File

@ -580,6 +580,7 @@ protected:
float energy_scale_;
float distance_scale_;
bool have_resistance_unit_;
const char *default_operating_condition_;
static constexpr char escape_ = '\\';
private: