internal power
This commit is contained in:
parent
77d507d0a5
commit
8b65b522fb
|
|
@ -117,6 +117,16 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class StringLessIf
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
bool operator()(const char *string1,
|
||||||
|
const char *string2) const
|
||||||
|
{
|
||||||
|
return stringLessIf(string1, string2);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// strdup using new instead of malloc so delete can be used on the strings.
|
// strdup using new instead of malloc so delete can be used on the strings.
|
||||||
char *
|
char *
|
||||||
stringCopy(const char *str);
|
stringCopy(const char *str);
|
||||||
|
|
|
||||||
|
|
@ -622,6 +622,7 @@ Power::findOutputInternalPower(const Pin *to_pin,
|
||||||
debugPrint0(debug_, "power", 2, " when act/ns duty wgt energy power\n");
|
debugPrint0(debug_, "power", 2, " when act/ns duty wgt energy power\n");
|
||||||
|
|
||||||
float duty_sum = 0.0;
|
float duty_sum = 0.0;
|
||||||
|
map<const char*, float, StringLessIf> pg_duty_sum;
|
||||||
for (InternalPower *pwr : *cell->internalPowers(to_port)) {
|
for (InternalPower *pwr : *cell->internalPowers(to_port)) {
|
||||||
const char *related_pg_pin = pwr->relatedPgPin();
|
const char *related_pg_pin = pwr->relatedPgPin();
|
||||||
const LibertyPort *from_port = pwr->relatedPort();
|
const LibertyPort *from_port = pwr->relatedPort();
|
||||||
|
|
@ -634,9 +635,6 @@ Power::findOutputInternalPower(const Pin *to_pin,
|
||||||
}
|
}
|
||||||
// If all the "when" clauses exist VSS internal power is ignored.
|
// If all the "when" clauses exist VSS internal power is ignored.
|
||||||
const Pin *from_pin = network_->findPin(inst, from_port);
|
const Pin *from_pin = network_->findPin(inst, from_port);
|
||||||
if (from_pin
|
|
||||||
&& ((when && internalPowerMissingWhen(cell, to_port, related_pg_pin))
|
|
||||||
|| pgNameVoltage(cell, related_pg_pin, dcalc_ap) != 0.0)) {
|
|
||||||
Vertex *from_vertex = graph_->pinLoadVertex(from_pin);
|
Vertex *from_vertex = graph_->pinLoadVertex(from_pin);
|
||||||
float duty;
|
float duty;
|
||||||
if (infered_when) {
|
if (infered_when) {
|
||||||
|
|
@ -654,8 +652,7 @@ Power::findOutputInternalPower(const Pin *to_pin,
|
||||||
duty = 1.0;
|
duty = 1.0;
|
||||||
else
|
else
|
||||||
duty = 0.5;
|
duty = 0.5;
|
||||||
duty_sum += duty;
|
pg_duty_sum[related_pg_pin] += duty;
|
||||||
}
|
|
||||||
if (infered_when)
|
if (infered_when)
|
||||||
infered_when->deleteSubexprs();
|
infered_when->deleteSubexprs();
|
||||||
}
|
}
|
||||||
|
|
@ -673,9 +670,6 @@ Power::findOutputInternalPower(const Pin *to_pin,
|
||||||
}
|
}
|
||||||
// If all the "when" clauses exist VSS internal power is ignored.
|
// If all the "when" clauses exist VSS internal power is ignored.
|
||||||
const Pin *from_pin = network_->findPin(inst, from_port);
|
const Pin *from_pin = network_->findPin(inst, from_port);
|
||||||
if (from_pin
|
|
||||||
&& ((when && internalPowerMissingWhen(cell, to_port, related_pg_pin))
|
|
||||||
|| pgNameVoltage(cell, related_pg_pin, dcalc_ap) != 0.0)) {
|
|
||||||
Vertex *from_vertex = graph_->pinLoadVertex(from_pin);
|
Vertex *from_vertex = graph_->pinLoadVertex(from_pin);
|
||||||
float duty;
|
float duty;
|
||||||
if (infered_when) {
|
if (infered_when) {
|
||||||
|
|
@ -709,7 +703,7 @@ Power::findOutputInternalPower(const Pin *to_pin,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
energy /= tr_count; // average non-inf energies
|
energy /= tr_count; // average non-inf energies
|
||||||
float weight = duty / duty_sum;
|
float weight = duty / pg_duty_sum[related_pg_pin];
|
||||||
float port_internal = weight * energy * to_activity.activity();
|
float port_internal = weight * energy * to_activity.activity();
|
||||||
debugPrint9(debug_, "power", 2, " %s -> %s %6s %.2f %.2f %.2f %9.2e %9.2e %s\n",
|
debugPrint9(debug_, "power", 2, " %s -> %s %6s %.2f %.2f %.2f %9.2e %9.2e %s\n",
|
||||||
from_port->name(),
|
from_port->name(),
|
||||||
|
|
@ -722,7 +716,6 @@ Power::findOutputInternalPower(const Pin *to_pin,
|
||||||
port_internal,
|
port_internal,
|
||||||
related_pg_pin ? related_pg_pin : "no pg_pin");
|
related_pg_pin ? related_pg_pin : "no pg_pin");
|
||||||
internal += port_internal;
|
internal += port_internal;
|
||||||
}
|
|
||||||
if (infered_when)
|
if (infered_when)
|
||||||
infered_when->deleteSubexprs();
|
infered_when->deleteSubexprs();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue