power: Add a voltage variable to power expressions

There is currently no good way of extracting the current operating
voltage in MathExprPowerModels. This change adds a magic variable,
'voltage', that can be referenced from such expressions to get the
current operating voltage.

Change-Id: Ice3c9a4a221921a542de5da52f83f3f88862d246
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-by: Sascha Bischoff <sascha.bischoff@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/2662
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
This commit is contained in:
Andreas Sandberg
2017-04-05 16:40:08 +01:00
parent 0b223f4001
commit 9ff8a2be92

View File

@@ -115,8 +115,11 @@ MathExprPowerModel::getStatValue(const std::string &name) const
using namespace Stats;
// Automatic variables:
if (name == "temp")
if (name == "temp") {
return _temp;
} else if (name == "voltage") {
return clocked_object->voltage();
}
// Try to cast the stat, only these are supported right now
const auto it = stats_map.find(name);