report_power NaN
This commit is contained in:
parent
1a84830895
commit
1def4110c0
|
|
@ -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,13 +570,21 @@ 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);
|
||||||
|
if (from_pin) {
|
||||||
Vertex *from_vertex = graph_->pinLoadVertex(from_pin);
|
Vertex *from_vertex = graph_->pinLoadVertex(from_pin);
|
||||||
float duty;
|
float duty;
|
||||||
if (infered_when) {
|
if (infered_when) {
|
||||||
PwrActivity from_activity = findActivity(from_pin);
|
PwrActivity from_activity = findActivity(from_pin);
|
||||||
PwrActivity to_activity = findActivity(to_pin);
|
PwrActivity to_activity = findActivity(to_pin);
|
||||||
float duty1 = evalActivity(infered_when, inst).duty();
|
float duty1 = evalActivity(infered_when, inst).duty();
|
||||||
|
check(from_activity.activity());
|
||||||
|
check(to_activity.activity());
|
||||||
|
check(duty1);
|
||||||
|
if (to_activity.activity() == 0.0)
|
||||||
|
duty = 0.0;
|
||||||
|
else
|
||||||
duty = from_activity.activity() / to_activity.activity() * duty1;
|
duty = from_activity.activity() / to_activity.activity() * duty1;
|
||||||
|
check(duty);
|
||||||
}
|
}
|
||||||
else if (when)
|
else if (when)
|
||||||
duty = evalActivity(when, inst).duty();
|
duty = evalActivity(when, inst).duty();
|
||||||
|
|
@ -583,6 +592,7 @@ Power::findInternalPower(const Pin *to_pin,
|
||||||
duty = 1.0;
|
duty = 1.0;
|
||||||
else
|
else
|
||||||
duty = 0.5;
|
duty = 0.5;
|
||||||
|
check(duty);
|
||||||
float port_energy = 0.0;
|
float port_energy = 0.0;
|
||||||
TransRiseFallIterator tr_iter;
|
TransRiseFallIterator tr_iter;
|
||||||
while (tr_iter.hasNext()) {
|
while (tr_iter.hasNext()) {
|
||||||
|
|
@ -599,6 +609,9 @@ Power::findInternalPower(const Pin *to_pin,
|
||||||
table_energy,
|
table_energy,
|
||||||
duty,
|
duty,
|
||||||
tr_energy);
|
tr_energy);
|
||||||
|
check(slew);
|
||||||
|
check(table_energy);
|
||||||
|
check(tr_energy);
|
||||||
port_energy += tr_energy;
|
port_energy += tr_energy;
|
||||||
}
|
}
|
||||||
float port_internal = port_energy * to_activity.activity();
|
float port_internal = port_energy * to_activity.activity();
|
||||||
|
|
@ -613,6 +626,7 @@ Power::findInternalPower(const Pin *to_pin,
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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