liberty default_max_slew only applies to outputs

This commit is contained in:
James Cherry 2020-05-12 17:57:04 -07:00
parent d562879a27
commit fdb9ad44ab
4 changed files with 33 additions and 49 deletions

View File

@ -620,6 +620,7 @@ class LibertyPort : public ConcretePort
{ {
public: public:
LibertyCell *libertyCell() const { return liberty_cell_; } LibertyCell *libertyCell() const { return liberty_cell_; }
LibertyLibrary *libertyLibrary() const { return liberty_cell_->libertyLibrary(); }
LibertyPort *findLibertyMember(int index) const; LibertyPort *findLibertyMember(int index) const;
LibertyPort *findLibertyBusBit(int index) const; LibertyPort *findLibertyBusBit(int index) const;
float capacitance(const RiseFall *rf, float capacitance(const RiseFall *rf,

View File

@ -2496,7 +2496,6 @@ LibertyReader::beginPin(LibertyGroup *group)
while (port_iter.hasNext()) { while (port_iter.hasNext()) {
LibertyPort *port = port_iter.next(); LibertyPort *port = port_iter.next();
ports_->push_back(port); ports_->push_back(port);
setPortDefaults(port);
} }
} }
else else
@ -2517,7 +2516,6 @@ LibertyReader::beginPin(LibertyGroup *group)
if (port == nullptr) if (port == nullptr)
port = builder_->makePort(cell_, name); port = builder_->makePort(cell_, name);
ports_->push_back(port); ports_->push_back(port);
setPortDefaults(port);
} }
else else
libWarn(group, "pin name is not a string.\n"); libWarn(group, "pin name is not a string.\n");
@ -2540,7 +2538,6 @@ LibertyReader::beginPin(LibertyGroup *group)
name = escapeChars(name, brkt_left, brkt_right, escape_); name = escapeChars(name, brkt_left, brkt_right, escape_);
LibertyPort *port = builder_->makePort(cell_, name); LibertyPort *port = builder_->makePort(cell_, name);
ports_->push_back(port); ports_->push_back(port);
setPortDefaults(port);
} }
else else
libWarn(group, "pin name is not a string.\n"); libWarn(group, "pin name is not a string.\n");
@ -2556,24 +2553,6 @@ LibertyReader::beginPin(LibertyGroup *group)
} }
} }
void
LibertyReader::setPortDefaults(LibertyPort *port)
{
float fanout;
bool exists;
library_->defaultMaxFanout(fanout, exists);
if (exists)
port->setFanoutLimit(fanout, MinMax::max());
float slew;
library_->defaultMaxSlew(slew, exists);
if (exists)
port->setSlewLimit(slew, MinMax::max());
float max_cap;
library_->defaultMaxCapacitance(max_cap, exists);
if (exists)
port->setCapacitanceLimit(slew, MinMax::max());
}
void void
LibertyReader::endPin(LibertyGroup *) LibertyReader::endPin(LibertyGroup *)
{ {

View File

@ -196,7 +196,6 @@ public:
virtual void endBusOrBundle(); virtual void endBusOrBundle();
virtual void endPorts(); virtual void endPorts();
virtual void setPortCapDefault(LibertyPort *port); virtual void setPortCapDefault(LibertyPort *port);
virtual void setPortDefaults(LibertyPort *port);
virtual void visitMembers(LibertyAttr *attr); virtual void visitMembers(LibertyAttr *attr);
virtual void visitDirection(LibertyAttr *attr); virtual void visitDirection(LibertyAttr *attr);
virtual void visitFunction(LibertyAttr *attr); virtual void visitFunction(LibertyAttr *attr);

View File

@ -26,6 +26,7 @@
#include "StaState.hh" #include "StaState.hh"
#include "Corner.hh" #include "Corner.hh"
#include "PathVertex.hh" #include "PathVertex.hh"
#include "PortDirection.hh"
#include "Search.hh" #include "Search.hh"
namespace sta { namespace sta {
@ -183,6 +184,8 @@ CheckSlewLimits::findLimit(const Pin *pin,
const Network *network = sta_->network(); const Network *network = sta_->network();
Sdc *sdc = sta_->sdc(); Sdc *sdc = sta_->sdc();
bool is_clk = sta_->search()->isClock(vertex); bool is_clk = sta_->search()->isClock(vertex);
float limit1;
bool exists1;
// Look for clock slew limits. // Look for clock slew limits.
ClockSet clks; ClockSet clks;
clockDomains(vertex, clks); clockDomains(vertex, clks);
@ -190,15 +193,13 @@ CheckSlewLimits::findLimit(const Pin *pin,
while (clk_iter.hasNext()) { while (clk_iter.hasNext()) {
Clock *clk = clk_iter.next(); Clock *clk = clk_iter.next();
PathClkOrData clk_data = is_clk ? PathClkOrData::clk : PathClkOrData::data; PathClkOrData clk_data = is_clk ? PathClkOrData::clk : PathClkOrData::data;
float clk_limit;
bool clk_limit_exists;
sdc->slewLimit(clk, rf, clk_data, min_max, sdc->slewLimit(clk, rf, clk_data, min_max,
clk_limit, clk_limit_exists); limit1, exists1);
if (clk_limit_exists if (exists1
&& (!exists && (!exists
|| min_max->compare(limit, clk_limit))) { || min_max->compare(limit, limit1))) {
// Use the tightest clock limit. // Use the tightest clock limit.
limit = clk_limit; limit = limit1;
exists = true; exists = true;
} }
} }
@ -208,43 +209,47 @@ CheckSlewLimits::findLimit(const Pin *pin,
limit = top_limit_; limit = top_limit_;
if (network->isTopLevelPort(pin)) { if (network->isTopLevelPort(pin)) {
Port *port = network->port(pin); Port *port = network->port(pin);
float port_limit; sdc->slewLimit(port, min_max, limit1, exists1);
bool port_limit_exists;
sdc->slewLimit(port, min_max, port_limit, port_limit_exists);
// Use the tightest limit. // Use the tightest limit.
if (port_limit_exists if (exists1
&& (!exists && (!exists
|| min_max->compare(limit, port_limit))) { || min_max->compare(limit, limit1))) {
limit = port_limit; limit = limit1;
exists = true; exists = true;
} }
} }
else { else {
float pin_limit;
bool pin_limit_exists;
sdc->slewLimit(pin, min_max, sdc->slewLimit(pin, min_max,
pin_limit, pin_limit_exists); limit1, exists1);
// Use the tightest limit. // Use the tightest limit.
if (pin_limit_exists if (exists1
&& (!exists && (!exists
|| min_max->compare(limit, pin_limit))) { || min_max->compare(limit, limit1))) {
limit = pin_limit; limit = limit1;
exists = true; exists = true;
} }
float port_limit;
bool port_limit_exists;
LibertyPort *port = network->libertyPort(pin); LibertyPort *port = network->libertyPort(pin);
if (port) { if (port) {
port->slewLimit(min_max, port_limit, port_limit_exists); port->slewLimit(min_max, limit1, exists1);
// Use the tightest limit. // Use the tightest limit.
if (port_limit_exists if (exists1) {
&& (!exists if (!exists
|| min_max->compare(limit, port_limit))) { || min_max->compare(limit, limit1)) {
limit = port_limit; limit = limit1;
exists = true; exists = true;
} }
} }
else if (port->direction()->isAnyOutput()
&& min_max == MinMax::max()) {
port->libertyLibrary()->defaultMaxSlew(limit1, exists1);
if (exists1
&& (!exists
|| min_max->compare(limit, limit1))) {
limit = limit1;
exists = true;
}
}
}
} }
} }
} }