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.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (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/>.
|
||||
// No part of this document may be copied, transmitted or
|
||||
// disclosed in any form or fashion without the express
|
||||
// written consent of Parallax Software, Inc.
|
||||
|
||||
#include <algorithm> // max
|
||||
#include "Machine.hh"
|
||||
|
|
@ -335,6 +327,8 @@ Power::evalActivity(FuncExpr *expr,
|
|||
Pin *pin = network_->findPin(inst, expr->port()->name());
|
||||
if (pin)
|
||||
return findActivity(pin);
|
||||
else
|
||||
return PwrActivity(0.0, 0.0, PwrActivityOrigin::constant);
|
||||
}
|
||||
case FuncExpr::op_not: {
|
||||
PwrActivity activity1 = evalActivity(expr->left(), inst);
|
||||
|
|
@ -528,6 +522,13 @@ Power::findInstClk(const Instance *inst)
|
|||
return inst_clk;
|
||||
}
|
||||
|
||||
void
|
||||
check(float x)
|
||||
{
|
||||
if (std::isnan(x))
|
||||
printf("luse\n");
|
||||
}
|
||||
|
||||
void
|
||||
Power::findInternalPower(const Pin *to_pin,
|
||||
const LibertyPort *to_port,
|
||||
|
|
@ -569,13 +570,21 @@ Power::findInternalPower(const Pin *to_pin,
|
|||
if ((when && internalPowerMissingWhen(cell, to_port, related_pg_pin))
|
||||
|| pgNameVoltage(cell, related_pg_pin, dcalc_ap) != 0.0) {
|
||||
const Pin *from_pin = network_->findPin(inst, from_port);
|
||||
if (from_pin) {
|
||||
Vertex *from_vertex = graph_->pinLoadVertex(from_pin);
|
||||
float duty;
|
||||
if (infered_when) {
|
||||
PwrActivity from_activity = findActivity(from_pin);
|
||||
PwrActivity to_activity = findActivity(to_pin);
|
||||
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;
|
||||
check(duty);
|
||||
}
|
||||
else if (when)
|
||||
duty = evalActivity(when, inst).duty();
|
||||
|
|
@ -583,6 +592,7 @@ Power::findInternalPower(const Pin *to_pin,
|
|||
duty = 1.0;
|
||||
else
|
||||
duty = 0.5;
|
||||
check(duty);
|
||||
float port_energy = 0.0;
|
||||
TransRiseFallIterator tr_iter;
|
||||
while (tr_iter.hasNext()) {
|
||||
|
|
@ -599,6 +609,9 @@ Power::findInternalPower(const Pin *to_pin,
|
|||
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();
|
||||
|
|
@ -613,6 +626,7 @@ Power::findInternalPower(const Pin *to_pin,
|
|||
related_pg_pin ? related_pg_pin : "no pg_pin");
|
||||
internal += port_internal;
|
||||
}
|
||||
}
|
||||
if (infered_when)
|
||||
infered_when->deleteSubexprs();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -640,7 +640,7 @@ portSlackProperty(const Port *port,
|
|||
PropertyValue
|
||||
getProperty(const LibertyPort *port,
|
||||
const char *property,
|
||||
Sta *)
|
||||
Sta *sta)
|
||||
{
|
||||
if (stringEqual(property, "name"))
|
||||
return PropertyValue(port->name());
|
||||
|
|
@ -648,6 +648,10 @@ getProperty(const LibertyPort *port,
|
|||
return PropertyValue(port->name());
|
||||
else if (stringEqual(property, "direction"))
|
||||
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
|
||||
throw PropertyUnknown("liberty port", property);
|
||||
}
|
||||
|
|
@ -863,7 +867,7 @@ getProperty(Clock *clk,
|
|||
|| stringEqual(property, "full_name"))
|
||||
return PropertyValue(clk->name());
|
||||
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"))
|
||||
return PropertyValue(clk->pins());
|
||||
else if (stringEqual(property, "propagated"))
|
||||
|
|
|
|||
|
|
@ -1533,7 +1533,7 @@ using namespace sta;
|
|||
Tcl_SetResult(interp, const_cast<char*>(value.stringValue()), TCL_VOLATILE);
|
||||
break;
|
||||
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);
|
||||
stringDelete(float_string);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue