diff --git a/include/sta/Liberty.hh b/include/sta/Liberty.hh index 630aa158..205cb4ec 100644 --- a/include/sta/Liberty.hh +++ b/include/sta/Liberty.hh @@ -620,6 +620,7 @@ class LibertyPort : public ConcretePort { public: LibertyCell *libertyCell() const { return liberty_cell_; } + LibertyLibrary *libertyLibrary() const { return liberty_cell_->libertyLibrary(); } LibertyPort *findLibertyMember(int index) const; LibertyPort *findLibertyBusBit(int index) const; float capacitance(const RiseFall *rf, diff --git a/liberty/LibertyReader.cc b/liberty/LibertyReader.cc index ec28b3ca..f64950c7 100644 --- a/liberty/LibertyReader.cc +++ b/liberty/LibertyReader.cc @@ -2496,7 +2496,6 @@ LibertyReader::beginPin(LibertyGroup *group) while (port_iter.hasNext()) { LibertyPort *port = port_iter.next(); ports_->push_back(port); - setPortDefaults(port); } } else @@ -2517,7 +2516,6 @@ LibertyReader::beginPin(LibertyGroup *group) if (port == nullptr) port = builder_->makePort(cell_, name); ports_->push_back(port); - setPortDefaults(port); } else 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_); LibertyPort *port = builder_->makePort(cell_, name); ports_->push_back(port); - setPortDefaults(port); } else 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 LibertyReader::endPin(LibertyGroup *) { diff --git a/liberty/LibertyReaderPvt.hh b/liberty/LibertyReaderPvt.hh index b9575d7b..a29862d4 100644 --- a/liberty/LibertyReaderPvt.hh +++ b/liberty/LibertyReaderPvt.hh @@ -196,7 +196,6 @@ public: virtual void endBusOrBundle(); virtual void endPorts(); virtual void setPortCapDefault(LibertyPort *port); - virtual void setPortDefaults(LibertyPort *port); virtual void visitMembers(LibertyAttr *attr); virtual void visitDirection(LibertyAttr *attr); virtual void visitFunction(LibertyAttr *attr); diff --git a/search/CheckSlewLimits.cc b/search/CheckSlewLimits.cc index 2d96be62..346320fa 100644 --- a/search/CheckSlewLimits.cc +++ b/search/CheckSlewLimits.cc @@ -26,6 +26,7 @@ #include "StaState.hh" #include "Corner.hh" #include "PathVertex.hh" +#include "PortDirection.hh" #include "Search.hh" namespace sta { @@ -183,6 +184,8 @@ CheckSlewLimits::findLimit(const Pin *pin, const Network *network = sta_->network(); Sdc *sdc = sta_->sdc(); bool is_clk = sta_->search()->isClock(vertex); + float limit1; + bool exists1; // Look for clock slew limits. ClockSet clks; clockDomains(vertex, clks); @@ -190,15 +193,13 @@ CheckSlewLimits::findLimit(const Pin *pin, while (clk_iter.hasNext()) { Clock *clk = clk_iter.next(); PathClkOrData clk_data = is_clk ? PathClkOrData::clk : PathClkOrData::data; - float clk_limit; - bool clk_limit_exists; sdc->slewLimit(clk, rf, clk_data, min_max, - clk_limit, clk_limit_exists); - if (clk_limit_exists + limit1, exists1); + if (exists1 && (!exists - || min_max->compare(limit, clk_limit))) { + || min_max->compare(limit, limit1))) { // Use the tightest clock limit. - limit = clk_limit; + limit = limit1; exists = true; } } @@ -208,41 +209,45 @@ CheckSlewLimits::findLimit(const Pin *pin, limit = top_limit_; if (network->isTopLevelPort(pin)) { Port *port = network->port(pin); - float port_limit; - bool port_limit_exists; - sdc->slewLimit(port, min_max, port_limit, port_limit_exists); + sdc->slewLimit(port, min_max, limit1, exists1); // Use the tightest limit. - if (port_limit_exists + if (exists1 && (!exists - || min_max->compare(limit, port_limit))) { - limit = port_limit; + || min_max->compare(limit, limit1))) { + limit = limit1; exists = true; } } else { - float pin_limit; - bool pin_limit_exists; sdc->slewLimit(pin, min_max, - pin_limit, pin_limit_exists); + limit1, exists1); // Use the tightest limit. - if (pin_limit_exists + if (exists1 && (!exists - || min_max->compare(limit, pin_limit))) { - limit = pin_limit; + || min_max->compare(limit, limit1))) { + limit = limit1; exists = true; } - - float port_limit; - bool port_limit_exists; LibertyPort *port = network->libertyPort(pin); if (port) { - port->slewLimit(min_max, port_limit, port_limit_exists); + port->slewLimit(min_max, limit1, exists1); // Use the tightest limit. - if (port_limit_exists - && (!exists - || min_max->compare(limit, port_limit))) { - limit = port_limit; - exists = true; + if (exists1) { + if (!exists + || min_max->compare(limit, limit1)) { + limit = limit1; + 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; + } } } }