Liberty:cornerCell, cornerPort use corner/min_max arg

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2022-10-03 11:02:28 -07:00
parent eb705fab1a
commit 9d6bad01cc
7 changed files with 58 additions and 36 deletions

View File

@ -46,6 +46,7 @@ class TimingArcAttrs;
class InternalPowerAttrs;
class LibertyPgPort;
class StaState;
class Corner;
typedef Set<Library*> LibrarySet;
typedef Map<const char*, TableTemplate*, CharPtrLess> TableTemplateMap;
@ -443,7 +444,10 @@ public:
RiseFall *&enable_rf) const;
RiseFall *latchCheckEnableEdge(TimingArcSet *check_set);
bool isDisabledConstraint() const { return is_disabled_constraint_; }
LibertyCell *cornerCell(int ap_index);
LibertyCell *cornerCell(const Corner *corner,
const MinMax *min_max);
const LibertyCell *cornerCell(const Corner *corner,
const MinMax *min_max) const;
// AOCV
float ocvArcDepth() const;
@ -712,8 +716,10 @@ public:
RiseFall *sense);
bool isDisabledConstraint() const { return is_disabled_constraint_; }
void setIsDisabledConstraint(bool is_disabled);
LibertyPort *cornerPort(int ap_index);
const LibertyPort *cornerPort(int ap_index) const;
LibertyPort *cornerPort(const Corner *corner,
const MinMax *min_max);
const LibertyPort *cornerPort(const Corner *corner,
const MinMax *min_max) const;
void setCornerPort(LibertyPort *corner_port,
int ap_index);
const char *relatedGroundPin() const { return related_ground_pin_; }

View File

@ -36,6 +36,7 @@
#include "EquivCells.hh"
#include "Network.hh"
#include "PortDirection.hh"
#include "Corner.hh"
namespace sta {
@ -1498,12 +1499,28 @@ LibertyCell::setIsDisabledConstraint(bool is_disabled)
}
LibertyCell *
LibertyCell::cornerCell(int ap_index)
LibertyCell::cornerCell(const Corner *corner,
const MinMax *min_max)
{
if (ap_index < static_cast<int>(corner_cells_.size()))
if (corner_cells_.empty())
return this;
else {
int ap_index = corner->libertyIndex(min_max);
return corner_cells_[ap_index];
else
return nullptr;
}
}
const LibertyCell *
LibertyCell::cornerCell(const Corner *corner,
const MinMax *min_max) const
{
if (corner_cells_.empty())
return this;
else {
int ap_index = corner->libertyIndex(min_max);
return corner_cells_[ap_index];
}
}
void
@ -2324,25 +2341,27 @@ LibertyPort::setIsDisabledConstraint(bool is_disabled)
}
LibertyPort *
LibertyPort::cornerPort(int ap_index)
LibertyPort::cornerPort(const Corner *corner,
const MinMax *min_max)
{
if (ap_index < static_cast<int>(corner_ports_.size())) {
LibertyPort *corner_port = corner_ports_[ap_index];
if (corner_port)
return corner_port;
}
if (corner_ports_.empty())
return this;
else {
int ap_index = corner->libertyIndex(min_max);
return corner_ports_[ap_index];
}
}
const LibertyPort *
LibertyPort::cornerPort(int ap_index) const
LibertyPort::cornerPort(const Corner *corner,
const MinMax *min_max) const
{
if (ap_index < static_cast<int>(corner_ports_.size())) {
LibertyPort *corner_port = corner_ports_[ap_index];
if (corner_port)
return corner_port;
}
if (corner_ports_.empty())
return this;
else {
int ap_index = corner->libertyIndex(min_max);
return corner_ports_[ap_index];
}
}
void

View File

@ -3296,7 +3296,7 @@ Sdc::portCapacitance(Instance *inst,
Pvt *inst_pvt = nullptr;
if (inst)
inst_pvt = pvt(inst, min_max);
LibertyPort *corner_port = port->cornerPort(corner->libertyIndex(min_max));
LibertyPort *corner_port = port->cornerPort(corner, min_max);
return corner_port->capacitance(rf, min_max, op_cond, inst_pvt);
}

View File

@ -174,7 +174,7 @@ CheckCapacitanceLimits::findLimit(const Pin *pin,
LibertyPort *to_port;
drive->driveCell(rf, min_max, cell, from_port, from_slews, to_port);
if (to_port) {
LibertyPort *corner_port = to_port->cornerPort(corner->libertyIndex(min_max));
LibertyPort *corner_port = to_port->cornerPort(corner, min_max);
corner_port->capacitanceLimit(min_max, limit1, exists1);
if (!exists1
&& corner_port->direction()->isAnyOutput()
@ -202,7 +202,7 @@ CheckCapacitanceLimits::findLimit(const Pin *pin,
}
LibertyPort *port = network->libertyPort(pin);
if (port) {
LibertyPort *corner_port = port->cornerPort(corner->libertyIndex(min_max));
LibertyPort *corner_port = port->cornerPort(corner, min_max);
corner_port->capacitanceLimit(min_max, limit1, exists1);
if (!exists1
&& port->direction()->isAnyOutput())

View File

@ -224,7 +224,7 @@ CheckSlewLimits::findLimit(const Pin *pin,
LibertyPort *to_port;
drive->driveCell(rf, min_max, cell, from_port, from_slews, to_port);
if (to_port) {
LibertyPort *corner_port = to_port->cornerPort(corner->libertyIndex(min_max));
LibertyPort *corner_port = to_port->cornerPort(corner, min_max);
corner_port->slewLimit(min_max, limit1, exists1);
if (!exists1
&& corner_port->direction()->isAnyOutput()
@ -268,7 +268,7 @@ CheckSlewLimits::findLimit(const LibertyPort *port,
}
if (port) {
const LibertyPort *corner_port = port->cornerPort(corner->libertyIndex(min_max));
const LibertyPort *corner_port = port->cornerPort(corner, min_max);
corner_port->slewLimit(min_max, limit1, exists1);
if (!exists1
// default_max_transition only applies to outputs.

View File

@ -641,9 +641,9 @@ Power::findInputInternalPower(const Pin *pin,
// Return values.
PowerResult &result)
{
int lib_ap_index = corner->libertyIndex(MinMax::max());
LibertyCell *corner_cell = cell->cornerCell(lib_ap_index);
const LibertyPort *corner_port = port->cornerPort(lib_ap_index);
const MinMax *min_max = MinMax::max();
LibertyCell *corner_cell = cell->cornerCell(corner, min_max);
const LibertyPort *corner_port = port->cornerPort(corner, min_max);
if (corner_cell && corner_port) {
const InternalPowerSeq &internal_pwrs = corner_cell->internalPowers(corner_port);
if (!internal_pwrs.empty()) {
@ -784,9 +784,9 @@ Power::findOutputInternalPower(const Pin *to_pin,
cell->name());
const DcalcAnalysisPt *dcalc_ap = corner->findDcalcAnalysisPt(MinMax::max());
const Pvt *pvt = dcalc_ap->operatingConditions();
int lib_ap_index = corner->libertyIndex(MinMax::max());
LibertyCell *corner_cell = cell->cornerCell(lib_ap_index);
const LibertyPort *to_corner_port = to_port->cornerPort(lib_ap_index);
const MinMax *min_max = MinMax::max();
LibertyCell *corner_cell = cell->cornerCell(corner, min_max);
const LibertyPort *to_corner_port = to_port->cornerPort(corner, min_max);
debugPrint(debug_, "power", 2, " cap = %s",
units_->capacitanceUnit()->asString(load_cap));
FuncExpr *func = to_port->function();
@ -936,8 +936,7 @@ Power::findLeakagePower(const Instance *,
// Return values.
PowerResult &result)
{
int lib_ap_index = corner->libertyIndex(MinMax::max());
LibertyCell *corner_cell = cell->cornerCell(lib_ap_index);
LibertyCell *corner_cell = cell->cornerCell(corner, MinMax::max());
float cond_leakage = 0.0;
bool found_cond = false;
float default_leakage = 0.0;
@ -1000,8 +999,7 @@ Power::findSwitchingPower(LibertyCell *cell,
{
MinMax *mm = MinMax::max();
const DcalcAnalysisPt *dcalc_ap = corner->findDcalcAnalysisPt(mm);
int lib_ap_index = corner->libertyIndex(MinMax::max());
LibertyCell *corner_cell = cell->cornerCell(lib_ap_index);
LibertyCell *corner_cell = cell->cornerCell(corner, MinMax::max());
float volt = portVoltage(corner_cell, to_port, dcalc_ap);
float switching = .5 * load_cap * volt * volt * activity.activity();
debugPrint(debug_, "power", 2, "switching %s/%s activity = %.2e volt = %.2f %.3e",

View File

@ -3775,8 +3775,7 @@ Sta::capacitance(const LibertyPort *port,
OperatingConditions *op_cond = operatingConditions(min_max);
float cap = min_max->initValue();
for (const Corner *corner : makeCornerSeq(corner)) {
int lib_ap = corner->libertyIndex(min_max);
const LibertyPort *corner_port = port->cornerPort(lib_ap);
const LibertyPort *corner_port = port->cornerPort(corner, min_max);
for (RiseFall *rf : RiseFall::range())
cap = min_max->minMax(cap, corner_port->capacitance(rf, min_max, op_cond, op_cond));
}