summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2017-04-05 16:40:08 +0100
committerAndreas Sandberg <andreas.sandberg@arm.com>2017-04-06 13:35:17 +0000
commit9ff8a2be92084e6be11b9ebb8cda9a20c4256398 (patch)
treef141e9752f8496a346ba4c45b5bf6ea0f7f24993
parent0b223f4001fce26cad3b3c7e03501e7222d85ee0 (diff)
downloadgem5-9ff8a2be92084e6be11b9ebb8cda9a20c4256398.tar.xz
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>
-rw-r--r--src/sim/power/mathexpr_powermodel.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/sim/power/mathexpr_powermodel.cc b/src/sim/power/mathexpr_powermodel.cc
index 13d225ee3..a77e14a08 100644
--- a/src/sim/power/mathexpr_powermodel.cc
+++ b/src/sim/power/mathexpr_powermodel.cc
@@ -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);