liberty bus port slew/cap/fanout limits

This commit is contained in:
James Cherry 2020-05-11 07:14:36 -07:00
parent 4ef072645a
commit d562879a27
4 changed files with 32 additions and 18 deletions

View File

@ -2018,7 +2018,8 @@ LibertyPort::slewLimit(const MinMax *min_max,
} }
void void
LibertyPort::setSlewLimit(float slew, const MinMax *min_max) LibertyPort::setSlewLimit(float slew,
const MinMax *min_max)
{ {
slew_limit_.setValue(min_max, slew); slew_limit_.setValue(min_max, slew);
} }

View File

@ -2799,9 +2799,9 @@ LibertyReader::visitDirection(LibertyAttr *attr)
LibertyPortSeq::Iterator port_iter(ports_); LibertyPortSeq::Iterator port_iter(ports_);
while (port_iter.hasNext()) { while (port_iter.hasNext()) {
LibertyPort *port = port_iter.next(); LibertyPort *port = port_iter.next();
if (!port->direction()->isTristate())
// Tristate enable function sets direction to tristate; don't // Tristate enable function sets direction to tristate; don't
// clobber it. // clobber it.
if (!port->direction()->isTristate())
port->setDirection(port_dir); port->setDirection(port_dir);
} }
} }
@ -2839,6 +2839,21 @@ LibertyReader::visitThreeState(LibertyAttr *attr)
} }
} }
void
LibertyReader::visitPorts(std::function<void (LibertyPort *port)> func)
{
LibertyPortSeq::Iterator port_iter(ports_);
while (port_iter.hasNext()) {
LibertyPort *port = port_iter.next();
func(port);
LibertyPortMemberIterator member_iter(port);
while (member_iter.hasNext()) {
LibertyPort *member = member_iter.next();
func(member);
}
}
}
void void
LibertyReader::visitClock(LibertyAttr *attr) LibertyReader::visitClock(LibertyAttr *attr)
{ {
@ -2994,11 +3009,9 @@ LibertyReader::visitFanout(LibertyAttr *attr,
bool exists; bool exists;
getAttrFloat(attr, fanout, exists); getAttrFloat(attr, fanout, exists);
if (exists) { if (exists) {
LibertyPortSeq::Iterator port_iter(ports_); visitPorts([&] (LibertyPort *port) {
while (port_iter.hasNext()) {
LibertyPort *port = port_iter.next();
port->setFanoutLimit(fanout, min_max); port->setFanoutLimit(fanout, min_max);
} });
} }
} }
} }
@ -3024,11 +3037,9 @@ LibertyReader::visitMinMaxTransition(LibertyAttr *attr, MinMax *min_max)
getAttrFloat(attr, value, exists); getAttrFloat(attr, value, exists);
if (exists) { if (exists) {
value *= time_scale_; value *= time_scale_;
LibertyPortSeq::Iterator port_iter(ports_); visitPorts([&] (LibertyPort *port) {
while (port_iter.hasNext()) {
LibertyPort *port = port_iter.next();
port->setSlewLimit(value, min_max); port->setSlewLimit(value, min_max);
} });
} }
} }
} }
@ -3056,10 +3067,9 @@ LibertyReader::visitMinMaxCapacitance(LibertyAttr *attr,
if (exists) { if (exists) {
value *= cap_scale_; value *= cap_scale_;
LibertyPortSeq::Iterator port_iter(ports_); LibertyPortSeq::Iterator port_iter(ports_);
while (port_iter.hasNext()) { visitPorts([&] (LibertyPort *port) {
LibertyPort *port = port_iter.next();
port->setCapacitanceLimit(value, min_max); port->setCapacitanceLimit(value, min_max);
} });
} }
} }
} }

View File

@ -16,6 +16,8 @@
#pragma once #pragma once
#include <functional>
#include "DisallowCopyAssign.hh" #include "DisallowCopyAssign.hh"
#include "Vector.hh" #include "Vector.hh"
#include "Map.hh" #include "Map.hh"
@ -444,6 +446,7 @@ protected:
const char *port_name); const char *port_name);
float defaultCap(LibertyPort *port); float defaultCap(LibertyPort *port);
virtual void visitVariable(LibertyVariable *var); virtual void visitVariable(LibertyVariable *var);
void visitPorts(std::function<void (LibertyPort *port)> func);
const char *getAttrString(LibertyAttr *attr); const char *getAttrString(LibertyAttr *attr);
void getAttrInt(LibertyAttr *attr, void getAttrInt(LibertyAttr *attr,
// Return values. // Return values.