Skip to content

Commit

Permalink
default_operating_condition allow forward ref
Browse files Browse the repository at this point in the history
  • Loading branch information
jjcherry56 committed Jan 19, 2021
1 parent d00937f commit ed7d2dc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
25 changes: 16 additions & 9 deletions liberty/LibertyReader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
}

Expand Down
1 change: 1 addition & 0 deletions liberty/LibertyReaderPvt.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit ed7d2dc

Please sign in to comment.