diff --git a/doc/OpenSTA.odt b/doc/OpenSTA.odt index cf2d1fa6..2079b261 100644 Binary files a/doc/OpenSTA.odt and b/doc/OpenSTA.odt differ diff --git a/liberty/LibertyExpr.cc b/liberty/LibertyExpr.cc index 645d2b22..fb69c6e9 100644 --- a/liberty/LibertyExpr.cc +++ b/liberty/LibertyExpr.cc @@ -29,7 +29,9 @@ namespace sta { LibExprParser *libexpr_parser; FuncExpr * -parseFuncExpr(const char *func, LibertyCell *cell, const char *error_msg, +parseFuncExpr(const char *func, + LibertyCell *cell, + const char *error_msg, Report *report) { if (func != nullptr && func[0] != '\0') { @@ -42,8 +44,10 @@ parseFuncExpr(const char *func, LibertyCell *cell, const char *error_msg, return nullptr; } -LibExprParser::LibExprParser(const char *func, LibertyCell *cell, - const char *error_msg, Report *report) : +LibExprParser::LibExprParser(const char *func, + LibertyCell *cell, + const char *error_msg, + Report *report) : func_(func), cell_(cell), error_msg_(error_msg), @@ -84,7 +88,8 @@ LibExprParser::makeFuncExprNot(FuncExpr *arg) } FuncExpr * -LibExprParser::makeFuncExprXor(FuncExpr *arg1, FuncExpr *arg2) +LibExprParser::makeFuncExprXor(FuncExpr *arg1, + FuncExpr *arg2) { if (arg1 && arg2) return FuncExpr::makeXor(arg1, arg2); @@ -93,7 +98,8 @@ LibExprParser::makeFuncExprXor(FuncExpr *arg1, FuncExpr *arg2) } FuncExpr * -LibExprParser::makeFuncExprAnd(FuncExpr *arg1, FuncExpr *arg2) +LibExprParser::makeFuncExprAnd(FuncExpr *arg1, + FuncExpr *arg2) { if (arg1 && arg2) return FuncExpr::makeAnd(arg1, arg2); @@ -102,7 +108,8 @@ LibExprParser::makeFuncExprAnd(FuncExpr *arg1, FuncExpr *arg2) } FuncExpr * -LibExprParser::makeFuncExprOr(FuncExpr *arg1, FuncExpr *arg2) +LibExprParser::makeFuncExprOr(FuncExpr *arg1, + FuncExpr *arg2) { if (arg1 && arg2) return FuncExpr::makeOr(arg1, arg2); @@ -117,7 +124,8 @@ LibExprParser::setResult(FuncExpr *result) } size_t -LibExprParser::copyInput(char *buf, size_t max_size) +LibExprParser::copyInput(char *buf, + size_t max_size) { size_t length = strlen(func_); if (length == 0) diff --git a/liberty/LibertyExpr.hh b/liberty/LibertyExpr.hh index e4faf497..7a2ae1dc 100644 --- a/liberty/LibertyExpr.hh +++ b/liberty/LibertyExpr.hh @@ -26,7 +26,9 @@ class LibertyCell; class FuncExpr; FuncExpr * -parseFuncExpr(const char *func, LibertyCell *cell, const char *error_msg, +parseFuncExpr(const char *func, + LibertyCell *cell, + const char *error_msg, Report *report); } // namespace diff --git a/search/Power.cc b/search/Power.cc index 335caa72..eec79f9f 100644 --- a/search/Power.cc +++ b/search/Power.cc @@ -505,8 +505,8 @@ Power::power(const Instance *inst, if (to_port->direction()->isAnyOutput()) findSwitchingPower(cell, to_port, activity, load_cap, dcalc_ap, result); - findInternalPower(to_port, inst, cell, activity, - inst_clk, load_cap, dcalc_ap, result); + findInternalPower(to_pin, to_port, inst, cell, activity, + load_cap, dcalc_ap, result); } delete pin_iter; findLeakagePower(inst, cell, result); @@ -528,11 +528,11 @@ Power::findInstClk(const Instance *inst) } void -Power::findInternalPower(const LibertyPort *to_port, +Power::findInternalPower(const Pin *to_pin, + const LibertyPort *to_port, const Instance *inst, LibertyCell *cell, PwrActivity &to_activity, - const Clock *inst_clk, float load_cap, const DcalcAnalysisPt *dcalc_ap, // Return values. @@ -554,10 +554,9 @@ Power::findInternalPower(const LibertyPort *to_port, if (pwr->port() == to_port) { const char *related_pg_pin = pwr->relatedPgPin(); const LibertyPort *from_port = pwr->relatedPort(); - if (from_port == nullptr) { + if (from_port == nullptr) // Input port internal power. from_port = to_port; - } FuncExpr *when = pwr->when(); // If all the "when" clauses exist VSS internal power is ignored. if ((when && internalPowerMissingWhen(cell, to_port, related_pg_pin)) @@ -570,9 +569,10 @@ Power::findInternalPower(const LibertyPort *to_port, else if (search_->isClock(from_vertex)) duty = 1.0; else { - PwrActivity from_activity = findClkedActivity(from_pin, inst_clk); - float duty1 = 1.0 - (input_duty_sum - from_activity.duty()); - duty = from_activity.activity() * duty1 / to_activity.activity(); + PwrActivity from_activity = findActivity(from_pin); + PwrActivity to_activity = findActivity(to_pin); + float duty1 = input_duty_sum - from_activity.duty(); + duty = from_activity.activity() * (1.0 - duty1) / to_activity.activity(); } float port_energy = 0.0; TransRiseFallIterator tr_iter; @@ -624,7 +624,7 @@ Power::internalPowerMissingWhen(LibertyCell *cell, auto when = pwr->when(); if (pwr->port() == to_port && pwr->relatedPort() == nullptr - && stringEq(pwr->relatedPgPin(), related_pg_pin) + && stringEqIf(pwr->relatedPgPin(), related_pg_pin) && when) { when_count++; when_input_count = funcExprPortCount(when); diff --git a/search/Power.hh b/search/Power.hh index 6c1513fe..8321ceb5 100644 --- a/search/Power.hh +++ b/search/Power.hh @@ -107,11 +107,11 @@ protected: const Corner *corner, // Return values. PowerResult &result); - void findInternalPower(const LibertyPort *to_port, + void findInternalPower(const Pin *to_pin, + const LibertyPort *to_port, const Instance *inst, LibertyCell *cell, PwrActivity &to_activity, - const Clock *inst_clk, float load_cap, const DcalcAnalysisPt *dcalc_ap, // Return values.