Skip to content

Commit

Permalink
report_power -instance hierarchical
Browse files Browse the repository at this point in the history
Signed-off-by: James Cherry <[email protected]>
  • Loading branch information
jjcherry56 committed Jan 20, 2023
1 parent 695b0be commit 4b009e5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
Binary file modified doc/OpenSTA.odt
Binary file not shown.
Binary file modified doc/OpenSTA.pdf
Binary file not shown.
26 changes: 26 additions & 0 deletions power/Power.cc
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,11 @@ PowerResult
Power::power(const Instance *inst,
const Corner *corner)
{
if (network_->isHierarchical(inst)) {
PowerResult result;
powerInside(inst, corner, result);
return result;
}
LibertyCell *cell = network_->libertyCell(inst);
if (cell) {
ensureActivities();
Expand All @@ -244,6 +249,27 @@ Power::power(const Instance *inst,
return PowerResult();
}

void
Power::powerInside(const Instance *hinst,
const Corner *corner,
PowerResult &result)
{
InstanceChildIterator *child_iter = network_->childIterator(hinst);
while (child_iter->hasNext()) {
Instance *child = child_iter->next();
if (network_->isHierarchical(child))
powerInside(child, corner, result);
else {
LibertyCell *cell = network_->libertyCell(child);
if (cell) {
PowerResult inst_power = power(child, cell, corner);
result.incr(inst_power);
}
}
}
delete child_iter;
}

////////////////////////////////////////////////////////////////

class ActivitySrchPred : public SearchPredNonLatch2
Expand Down
3 changes: 3 additions & 0 deletions power/Power.hh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ public:
PwrActivity findClkedActivity(const Pin *pin);

protected:
void powerInside(const Instance *hinst,
const Corner *corner,
PowerResult &result);
void ensureActivities();
bool hasUserActivity(const Pin *pin);
PwrActivity &userActivity(const Pin *pin);
Expand Down

0 comments on commit 4b009e5

Please sign in to comment.