Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/sta/Liberty.hh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <mutex>
#include <atomic>
#include <optional>

#include "MinMax.hh"
#include "RiseFallMinMax.hh"
Expand Down Expand Up @@ -474,6 +475,7 @@ public:
void leakagePower(// Return values.
float &leakage,
bool &exists) const;
std::optional<float> leakagePower() const;
bool leakagePowerExists() const { return leakage_power_exists_; }

// Register, Latch or Statetable.
Expand Down
10 changes: 10 additions & 0 deletions liberty/Liberty.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,16 @@ LibertyCell::leakagePower(// Return values.
exists = leakage_power_exists_;
}

std::optional<float>
LibertyCell::leakagePower() const
{
std::optional<float> leakage;
if (leakage_power_exists_) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't necessarily need the leakage value to assign stuff to and simplify that a bit by directly returning the value:

{
  if (leakage_power_exists_) {
     return leakgage_power_;
  }
  return std::nullopt;
}

leakage = leakage_power_;
}
return leakage;
}

void
LibertyCell::finish(bool infer_latches,
Report *report,
Expand Down