-
Notifications
You must be signed in to change notification settings - Fork 52
Support Input/output internal power #344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1011,6 +1011,7 @@ Power::findInputInternalPower(const Pin *pin, | |
| internal += port_internal; | ||
| } | ||
| result.incrInternal(internal); | ||
| result.incrInputInternal(internal); | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -1102,7 +1103,9 @@ Power::findOutputInternalPower(const LibertyPort *to_port, | |
| FuncExpr *func = to_port->function(); | ||
|
|
||
| map<const char*, float, StringLessIf> pg_duty_sum; | ||
| int numArcs = 0; | ||
| for (InternalPower *pwr : corner_cell->internalPowers(to_corner_port)) { | ||
| numArcs += 1; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the variable does not follow the coding guidelines. |
||
| const LibertyPort *from_corner_port = pwr->relatedPort(); | ||
| if (from_corner_port) { | ||
| const Pin *from_pin = findLinkPin(inst, from_corner_port); | ||
|
|
@@ -1113,10 +1116,13 @@ Power::findOutputInternalPower(const LibertyPort *to_port, | |
| pg_duty_sum[related_pg_pin] += from_density * duty; | ||
| } | ||
| } | ||
| // The number of pins that consume internal power in total | ||
| float numInternalPowerPins = numArcs / (float) pg_duty_sum.size(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no nums |
||
|
|
||
| debugPrint(debug_, "power", 2, | ||
| " when act/ns duty wgt energy power"); | ||
| float internal = 0.0; | ||
| float out_internal = 0.0; | ||
| for (InternalPower *pwr : corner_cell->internalPowers(to_corner_port)) { | ||
| FuncExpr *when = pwr->when(); | ||
| const char *related_pg_pin = pwr->relatedPgPin(); | ||
|
|
@@ -1157,6 +1163,7 @@ Power::findOutputInternalPower(const LibertyPort *to_port, | |
| } | ||
| } | ||
| float port_internal = weight * energy * to_activity.density(); | ||
| float avg_arc_internal = energy * to_activity.density(); | ||
| debugPrint(debug_, "power", 2, "%3s -> %-3s %6s %.3f %.3f %.3f %9.2e %9.2e %s", | ||
| from_corner_port ? from_corner_port->name() : "-" , | ||
| to_port->name(), | ||
|
|
@@ -1168,8 +1175,13 @@ Power::findOutputInternalPower(const LibertyPort *to_port, | |
| port_internal, | ||
| related_pg_pin ? related_pg_pin : "no pg_pin"); | ||
| internal += port_internal; | ||
| out_internal += avg_arc_internal; | ||
| } | ||
| result.incrInternal(internal); | ||
| if (numInternalPowerPins) | ||
| result.incrOutputInternal(out_internal / numInternalPowerPins); | ||
| else | ||
| result.incrOutputInternal(0.0); | ||
| } | ||
|
|
||
| float | ||
|
|
@@ -1603,6 +1615,8 @@ Power::deletePinBefore(const Pin *) | |
|
|
||
| PowerResult::PowerResult() : | ||
| internal_(0.0), | ||
| inputinternal_(0.0), | ||
| outputinternal_(0.0), | ||
| switching_(0.0), | ||
| leakage_(0.0) | ||
| { | ||
|
|
@@ -1612,6 +1626,8 @@ void | |
| PowerResult::clear() | ||
| { | ||
| internal_ = 0.0; | ||
| inputinternal_ = 0.0; | ||
| outputinternal_ = 0.0; | ||
| switching_ = 0.0; | ||
| leakage_ = 0.0; | ||
| } | ||
|
|
@@ -1627,6 +1643,17 @@ PowerResult::incrInternal(float pwr) | |
| { | ||
| internal_ += pwr; | ||
| } | ||
| void | ||
| PowerResult::incrInputInternal(float pwr) | ||
| { | ||
| inputinternal_ += pwr; | ||
| } | ||
|
|
||
| void | ||
| PowerResult::incrOutputInternal(float pwr) | ||
| { | ||
| outputinternal_ += pwr; | ||
| } | ||
|
|
||
| void | ||
| PowerResult::incrSwitching(float pwr) | ||
|
|
@@ -1644,6 +1671,8 @@ void | |
| PowerResult::incr(PowerResult &result) | ||
| { | ||
| internal_ += result.internal_; | ||
| inputinternal_ += result.inputinternal_; | ||
| outputinternal_ += result.outputinternal_; | ||
| switching_ += result.switching_; | ||
| leakage_ += result.leakage_; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,6 +69,19 @@ proc_redirect report_power { | |
| } | ||
| } | ||
|
|
||
| define_cmd_args "report_internal_power_components" { [> filename] [>> filename] } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why does this require a reporting function? none of the other power types have unique reporting functions. |
||
| proc_redirect report_internal_power_components { | ||
| global sta_report_default_digits | ||
| # Set the default corner | ||
| set corner [cmd_corner] | ||
| if { ![liberty_libraries_exist] } { | ||
| sta_error 304 "No liberty libraries have been read." | ||
| } | ||
| set power_result [internal_power_components $corner] | ||
| report_line $power_result | ||
| } | ||
|
|
||
|
|
||
| proc liberty_libraries_exist {} { | ||
| set lib_iter [liberty_library_iterator] | ||
| set have_liberty 0 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the function and variable names do not follow the naming conventions.
see doc/CodiingGuidelines.txt