power use cofactor activity for internal power

This commit is contained in:
James Cherry 2020-05-02 16:15:06 -07:00
parent bb4ceacd4d
commit 37ac4684a3
1 changed files with 3 additions and 1 deletions

View File

@ -664,14 +664,16 @@ Power::findExprOutPort(FuncExpr *expr)
}
}
// Eval activity of differenc(expr) wrt cofactor port.
PwrActivity
Power::evalActivityDifference(FuncExpr *expr,
const Instance *inst,
const LibertyPort *cofactor_port)
{
// Activity of positive/negative cofactors.
PwrActivity pos = evalActivity(expr, inst, cofactor_port, true);
PwrActivity neg = evalActivity(expr, inst, cofactor_port, false);
// difference(expr) wrt cofactor port = xor(pos, neg).
// difference = xor(pos, neg).
float p1 = pos.duty() * (1.0 - neg.duty());
float p2 = neg.duty() * (1.0 - pos.duty());
return PwrActivity(pos.activity() * p1 + neg.activity() * p2,