Skip to content

Commit

Permalink
Liberty::internalPowers() return ref
Browse files Browse the repository at this point in the history
Signed-off-by: James Cherry <[email protected]>
  • Loading branch information
jjcherry56 committed Jun 12, 2022
1 parent 58a34f1 commit 937efdd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
4 changes: 2 additions & 2 deletions include/sta/Liberty.hh
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,8 @@ public:
TimingArcSet *findTimingArcSet(unsigned arc_set_index) const;
bool hasTimingArcs(LibertyPort *port) const;

InternalPowerSeq *internalPowers();
InternalPowerSeq *internalPowers(const LibertyPort *port);
const InternalPowerSeq &internalPowers() const { return internal_powers_; }
const InternalPowerSeq &internalPowers(const LibertyPort *port);
LeakagePowerSeq *leakagePowers() { return &leakage_powers_; }
void leakagePower(// Return values.
float &leakage,
Expand Down
10 changes: 2 additions & 8 deletions liberty/Liberty.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1181,16 +1181,10 @@ LibertyCell::addInternalPower(InternalPower *power)
port_internal_powers_[power->port()].push_back(power);
}

InternalPowerSeq *
LibertyCell::internalPowers()
{
return &internal_powers_;
}

InternalPowerSeq *
const InternalPowerSeq &
LibertyCell::internalPowers(const LibertyPort *port)
{
return &port_internal_powers_[port];
return port_internal_powers_[port];
}

void
Expand Down
10 changes: 5 additions & 5 deletions search/Power.cc
Original file line number Diff line number Diff line change
Expand Up @@ -637,8 +637,8 @@ Power::findInputInternalPower(const Pin *pin,
LibertyCell *corner_cell = cell->cornerCell(lib_ap_index);
const LibertyPort *corner_port = port->cornerPort(lib_ap_index);
if (corner_cell && corner_port) {
InternalPowerSeq *internal_pwrs = corner_cell->internalPowers(corner_port);
if (!internal_pwrs->empty()) {
const InternalPowerSeq &internal_pwrs = corner_cell->internalPowers(corner_port);
if (!internal_pwrs.empty()) {
debugPrint(debug_, "power", 2, "internal input %s/%s (%s)",
network_->pathName(inst),
port->name(),
Expand All @@ -650,7 +650,7 @@ Power::findInputInternalPower(const Pin *pin,
units_->capacitanceUnit()->asString(load_cap));
debugPrint(debug_, "power", 2, " when act/ns duty energy power");
float internal = 0.0;
for (InternalPower *pwr : *internal_pwrs) {
for (InternalPower *pwr : internal_pwrs) {
const char *related_pg_pin = pwr->relatedPgPin();
float energy = 0.0;
int rf_count = 0;
Expand Down Expand Up @@ -784,15 +784,15 @@ Power::findOutputInternalPower(const Pin *to_pin,
FuncExpr *func = to_port->function();

map<const char*, float, StringLessIf> pg_duty_sum;
for (InternalPower *pwr : *corner_cell->internalPowers(to_corner_port)) {
for (InternalPower *pwr : corner_cell->internalPowers(to_corner_port)) {
float duty = findInputDuty(to_pin, inst, func, pwr);
const char *related_pg_pin = pwr->relatedPgPin();
// Note related_pg_pin may be null.
pg_duty_sum[related_pg_pin] += duty;
}

float internal = 0.0;
for (InternalPower *pwr : *corner_cell->internalPowers(to_corner_port)) {
for (InternalPower *pwr : corner_cell->internalPowers(to_corner_port)) {
FuncExpr *when = pwr->when();
const char *related_pg_pin = pwr->relatedPgPin();
float duty = findInputDuty(to_pin, inst, func, pwr);
Expand Down

0 comments on commit 937efdd

Please sign in to comment.