report_power NaN
This commit is contained in:
parent
1a84830895
commit
1def4110c0
122
search/Power.cc
122
search/Power.cc
|
|
@ -1,18 +1,10 @@
|
||||||
// OpenSTA, Static Timing Analyzer
|
// Parallax Static Timing Analyzer
|
||||||
// Copyright (c) 2019, Parallax Software, Inc.
|
// Copyright (c) 2019, Parallax Software, Inc.
|
||||||
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// No part of this document may be copied, transmitted or
|
||||||
// it under the terms of the GNU General Public License as published by
|
// disclosed in any form or fashion without the express
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
// written consent of Parallax Software, Inc.
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#include <algorithm> // max
|
#include <algorithm> // max
|
||||||
#include "Machine.hh"
|
#include "Machine.hh"
|
||||||
|
|
@ -335,6 +327,8 @@ Power::evalActivity(FuncExpr *expr,
|
||||||
Pin *pin = network_->findPin(inst, expr->port()->name());
|
Pin *pin = network_->findPin(inst, expr->port()->name());
|
||||||
if (pin)
|
if (pin)
|
||||||
return findActivity(pin);
|
return findActivity(pin);
|
||||||
|
else
|
||||||
|
return PwrActivity(0.0, 0.0, PwrActivityOrigin::constant);
|
||||||
}
|
}
|
||||||
case FuncExpr::op_not: {
|
case FuncExpr::op_not: {
|
||||||
PwrActivity activity1 = evalActivity(expr->left(), inst);
|
PwrActivity activity1 = evalActivity(expr->left(), inst);
|
||||||
|
|
@ -528,6 +522,13 @@ Power::findInstClk(const Instance *inst)
|
||||||
return inst_clk;
|
return inst_clk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
check(float x)
|
||||||
|
{
|
||||||
|
if (std::isnan(x))
|
||||||
|
printf("luse\n");
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Power::findInternalPower(const Pin *to_pin,
|
Power::findInternalPower(const Pin *to_pin,
|
||||||
const LibertyPort *to_port,
|
const LibertyPort *to_port,
|
||||||
|
|
@ -569,49 +570,62 @@ Power::findInternalPower(const Pin *to_pin,
|
||||||
if ((when && internalPowerMissingWhen(cell, to_port, related_pg_pin))
|
if ((when && internalPowerMissingWhen(cell, to_port, related_pg_pin))
|
||||||
|| pgNameVoltage(cell, related_pg_pin, dcalc_ap) != 0.0) {
|
|| pgNameVoltage(cell, related_pg_pin, dcalc_ap) != 0.0) {
|
||||||
const Pin *from_pin = network_->findPin(inst, from_port);
|
const Pin *from_pin = network_->findPin(inst, from_port);
|
||||||
Vertex *from_vertex = graph_->pinLoadVertex(from_pin);
|
if (from_pin) {
|
||||||
float duty;
|
Vertex *from_vertex = graph_->pinLoadVertex(from_pin);
|
||||||
if (infered_when) {
|
float duty;
|
||||||
PwrActivity from_activity = findActivity(from_pin);
|
if (infered_when) {
|
||||||
PwrActivity to_activity = findActivity(to_pin);
|
PwrActivity from_activity = findActivity(from_pin);
|
||||||
float duty1 = evalActivity(infered_when, inst).duty();
|
PwrActivity to_activity = findActivity(to_pin);
|
||||||
duty = from_activity.activity() / to_activity.activity() * duty1;
|
float duty1 = evalActivity(infered_when, inst).duty();
|
||||||
}
|
check(from_activity.activity());
|
||||||
else if (when)
|
check(to_activity.activity());
|
||||||
duty = evalActivity(when, inst).duty();
|
check(duty1);
|
||||||
else if (search_->isClock(from_vertex))
|
if (to_activity.activity() == 0.0)
|
||||||
duty = 1.0;
|
duty = 0.0;
|
||||||
else
|
else
|
||||||
duty = 0.5;
|
duty = from_activity.activity() / to_activity.activity() * duty1;
|
||||||
float port_energy = 0.0;
|
check(duty);
|
||||||
TransRiseFallIterator tr_iter;
|
}
|
||||||
while (tr_iter.hasNext()) {
|
else if (when)
|
||||||
TransRiseFall *to_tr = tr_iter.next();
|
duty = evalActivity(when, inst).duty();
|
||||||
// Should use unateness to find from_tr.
|
else if (search_->isClock(from_vertex))
|
||||||
TransRiseFall *from_tr = to_tr;
|
duty = 1.0;
|
||||||
float slew = delayAsFloat(graph_->slew(from_vertex,
|
else
|
||||||
from_tr,
|
duty = 0.5;
|
||||||
dcalc_ap->index()));
|
check(duty);
|
||||||
float table_energy = pwr->power(to_tr, pvt, slew, load_cap);
|
float port_energy = 0.0;
|
||||||
float tr_energy = table_energy * duty;
|
TransRiseFallIterator tr_iter;
|
||||||
debugPrint4(debug_, "power", 3, " %s energy = %9.2e * %.2f = %9.2e\n",
|
while (tr_iter.hasNext()) {
|
||||||
to_tr->shortName(),
|
TransRiseFall *to_tr = tr_iter.next();
|
||||||
table_energy,
|
// Should use unateness to find from_tr.
|
||||||
|
TransRiseFall *from_tr = to_tr;
|
||||||
|
float slew = delayAsFloat(graph_->slew(from_vertex,
|
||||||
|
from_tr,
|
||||||
|
dcalc_ap->index()));
|
||||||
|
float table_energy = pwr->power(to_tr, pvt, slew, load_cap);
|
||||||
|
float tr_energy = table_energy * duty;
|
||||||
|
debugPrint4(debug_, "power", 3, " %s energy = %9.2e * %.2f = %9.2e\n",
|
||||||
|
to_tr->shortName(),
|
||||||
|
table_energy,
|
||||||
|
duty,
|
||||||
|
tr_energy);
|
||||||
|
check(slew);
|
||||||
|
check(table_energy);
|
||||||
|
check(tr_energy);
|
||||||
|
port_energy += tr_energy;
|
||||||
|
}
|
||||||
|
float port_internal = port_energy * to_activity.activity();
|
||||||
|
debugPrint8(debug_, "power", 2, " %s -> %s %s %.2f %.2f %9.2e %9.2e %s\n",
|
||||||
|
from_port->name(),
|
||||||
|
to_port->name(),
|
||||||
|
when ? when->asString() : (infered_when ? infered_when->asString() : " "),
|
||||||
|
to_activity.activity() * 1e-9,
|
||||||
duty,
|
duty,
|
||||||
tr_energy);
|
port_energy,
|
||||||
port_energy += tr_energy;
|
port_internal,
|
||||||
|
related_pg_pin ? related_pg_pin : "no pg_pin");
|
||||||
|
internal += port_internal;
|
||||||
}
|
}
|
||||||
float port_internal = port_energy * to_activity.activity();
|
|
||||||
debugPrint8(debug_, "power", 2, " %s -> %s %s %.2f %.2f %9.2e %9.2e %s\n",
|
|
||||||
from_port->name(),
|
|
||||||
to_port->name(),
|
|
||||||
when ? when->asString() : (infered_when ? infered_when->asString() : " "),
|
|
||||||
to_activity.activity() * 1e-9,
|
|
||||||
duty,
|
|
||||||
port_energy,
|
|
||||||
port_internal,
|
|
||||||
related_pg_pin ? related_pg_pin : "no pg_pin");
|
|
||||||
internal += port_internal;
|
|
||||||
}
|
}
|
||||||
if (infered_when)
|
if (infered_when)
|
||||||
infered_when->deleteSubexprs();
|
infered_when->deleteSubexprs();
|
||||||
|
|
|
||||||
|
|
@ -640,7 +640,7 @@ portSlackProperty(const Port *port,
|
||||||
PropertyValue
|
PropertyValue
|
||||||
getProperty(const LibertyPort *port,
|
getProperty(const LibertyPort *port,
|
||||||
const char *property,
|
const char *property,
|
||||||
Sta *)
|
Sta *sta)
|
||||||
{
|
{
|
||||||
if (stringEqual(property, "name"))
|
if (stringEqual(property, "name"))
|
||||||
return PropertyValue(port->name());
|
return PropertyValue(port->name());
|
||||||
|
|
@ -648,6 +648,10 @@ getProperty(const LibertyPort *port,
|
||||||
return PropertyValue(port->name());
|
return PropertyValue(port->name());
|
||||||
else if (stringEqual(property, "direction"))
|
else if (stringEqual(property, "direction"))
|
||||||
return PropertyValue(port->direction()->name());
|
return PropertyValue(port->direction()->name());
|
||||||
|
else if (stringEqual(property, "capacitance")) {
|
||||||
|
float cap = port->capacitance(TransRiseFall::rise(), MinMax::max());
|
||||||
|
return PropertyValue(sta->units()->capacitanceUnit()->asString(cap, 6));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
throw PropertyUnknown("liberty port", property);
|
throw PropertyUnknown("liberty port", property);
|
||||||
}
|
}
|
||||||
|
|
@ -863,7 +867,7 @@ getProperty(Clock *clk,
|
||||||
|| stringEqual(property, "full_name"))
|
|| stringEqual(property, "full_name"))
|
||||||
return PropertyValue(clk->name());
|
return PropertyValue(clk->name());
|
||||||
else if (stringEqual(property, "period"))
|
else if (stringEqual(property, "period"))
|
||||||
return PropertyValue(sta->units()->timeUnit()->asString(clk->period(), 8));
|
return PropertyValue(sta->units()->timeUnit()->asString(clk->period(), 6));
|
||||||
else if (stringEqual(property, "sources"))
|
else if (stringEqual(property, "sources"))
|
||||||
return PropertyValue(clk->pins());
|
return PropertyValue(clk->pins());
|
||||||
else if (stringEqual(property, "propagated"))
|
else if (stringEqual(property, "propagated"))
|
||||||
|
|
|
||||||
|
|
@ -1533,7 +1533,7 @@ using namespace sta;
|
||||||
Tcl_SetResult(interp, const_cast<char*>(value.stringValue()), TCL_VOLATILE);
|
Tcl_SetResult(interp, const_cast<char*>(value.stringValue()), TCL_VOLATILE);
|
||||||
break;
|
break;
|
||||||
case PropertyValue::Type::type_float: {
|
case PropertyValue::Type::type_float: {
|
||||||
char *float_string = stringPrint("%.5f", value.floatValue());
|
char *float_string = stringPrint("%.6e", value.floatValue());
|
||||||
Tcl_SetResult(interp, float_string, TCL_VOLATILE);
|
Tcl_SetResult(interp, float_string, TCL_VOLATILE);
|
||||||
stringDelete(float_string);
|
stringDelete(float_string);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue