wire_load fanout_length values in quotes ucsd20190808

This commit is contained in:
James Cherry 2019-08-08 14:12:07 -07:00
parent 73fef1117e
commit e16696c347
3 changed files with 81 additions and 87 deletions

View File

@ -1700,30 +1700,13 @@ void
LibertyReader::visitFanoutLength(LibertyAttr *attr)
{
if (wireload_) {
if (attr->isComplex()) {
LibertyAttrValueIterator value_iter(attr->values());
if (value_iter.hasNext()) {
LibertyAttrValue *value = value_iter.next();
if (value->isFloat()) {
float fanout = value->floatValue();
if (value_iter.hasNext()) {
value = value_iter.next();
if (value->isFloat())
wireload_->addFanoutLength(fanout, value->floatValue());
float fanout, length;
bool exists;
getAttrFloat2(attr, fanout, length, exists);
if (exists)
wireload_->addFanoutLength(fanout, length);
else
libWarn(attr, "fanout_length fanout not a float.\n");
}
else
libWarn(attr, "fanout_length is missing length.\n");
}
else
libWarn(attr, "fanout_length fanout not an integer.\n");
}
else
libWarn(attr, "fanout_length is missing fanout and length.\n");
}
else
libWarn(attr, "fanout_length is missing fanout and length.\n");
libWarn(attr, "fanout_length is missing length and fanout.\n");
}
}
@ -4155,14 +4138,25 @@ LibertyReader::getAttrFloat(LibertyAttr *attr,
bool &valid)
{
valid = false;
if (attr->isSimple()) {
LibertyAttrValue *first = attr->firstValue();
if (first->isFloat()) {
valid = true;
value = first->floatValue();
if (attr->isSimple())
getAttrFloat(attr, attr->firstValue(), value, valid);
else
libWarn(attr, "%s is not a simple attribute.\n", attr->name());
}
else if (first->isString()) {
const char *string = first->stringValue();
void
LibertyReader::getAttrFloat(LibertyAttr *attr,
LibertyAttrValue *attr_value,
// Return values.
float &value,
bool &valid)
{
if (attr_value->isFloat()) {
valid = true;
value = attr_value->floatValue();
}
else if (attr_value->isString()) {
const char *string = attr_value->stringValue();
// See if attribute string is a variable.
variableValue(string, value, valid);
if (!valid) {
@ -4178,9 +4172,6 @@ LibertyReader::getAttrFloat(LibertyAttr *attr,
}
}
}
else
libWarn(attr, "%s is not a simple attribute.\n", attr->name());
}
// Get two floats in a complex attribute.
// attr(float1, float2);
@ -4196,25 +4187,18 @@ LibertyReader::getAttrFloat2(LibertyAttr *attr,
LibertyAttrValueIterator value_iter(attr->values());
if (value_iter.hasNext()) {
LibertyAttrValue *value = value_iter.next();
if (value->isFloat()) {
value1 = value->floatValue();
getAttrFloat(attr, value, value1, exists);
if (exists) {
if (value_iter.hasNext()) {
value = value_iter.next();
if (value->isFloat()) {
value2 = value->floatValue();
exists = true;
getAttrFloat(attr, value, value2, exists);
}
else
libWarn(attr, "%s value is not a float.\n", attr->name());
libWarn(attr, "%s missing values.\n", attr->name());
}
}
else
libWarn(attr, "%s range missing second value.\n", attr->name());
}
else
libWarn(attr, "%s value is not a float.\n", attr->name());
}
else
libWarn(attr, "%s range missing values.\n", attr->name());
libWarn(attr, "%s missing values.\n", attr->name());
}
else
libWarn(attr, "%s is not a complex attribute.\n", attr->name());

View File

@ -454,6 +454,11 @@ protected:
// Return values.
float &value,
bool &valid);
void getAttrFloat(LibertyAttr *attr,
LibertyAttrValue *attr_value,
// Return values.
float &value,
bool &valid);
void getAttrFloat2(LibertyAttr *attr,
// Return values.
float &value1,

View File

@ -106,25 +106,29 @@ Wireload::findWireload(float fanout,
float &cap,
float &res) const
{
int max = static_cast<int>(fanout_lengths_.size()) - 1;
size_t size = fanout_lengths_.size();
float length;
if (size == 0)
length = 0;
else {
size_t max = size - 1;
float fanout0 = fanout_lengths_[0]->first;
float fanout_max = fanout_lengths_[max]->first;
float length;
if (fanout == fanout0)
length = fanout_lengths_[0]->second;
else if (fanout <= fanout0) {
if (fanout < fanout0) {
// Extrapolate from lowest fanout entry.
length = fanout_lengths_[0]->second - (fanout0 - fanout) * slope_;
if (length < 0)
length = 0;
}
else if (fanout == fanout0)
length = fanout_lengths_[0]->second;
else if (fanout >= fanout_max)
// Extrapolate from max fanout entry.
length = fanout_lengths_[max]->second + (fanout - fanout_max) * slope_;
else {
// Bisection search.
int lower = -1;
int upper = max + 1;
int upper = size;
while (upper - lower > 1) {
int mid = (upper + lower) >> 1;
if (fanout >= fanout_lengths_[mid]->first)
@ -139,6 +143,7 @@ Wireload::findWireload(float fanout,
float l2 = fanout_lengths_[lower+1]->second;
length = l1 + (l2 - l1) * (fanout - fanout1) / (fanout2 - fanout1);
}
}
// Scale resistance and capacitance.
cap = length * capacitance_
* library_->scaleFactor(ScaleFactorType::wire_cap, op_cond);