From 9ff8a2be92084e6be11b9ebb8cda9a20c4256398 Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Wed, 5 Apr 2017 16:40:08 +0100 Subject: 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 Reviewed-by: Nikos Nikoleris Reviewed-by: Sascha Bischoff Reviewed-on: https://gem5-review.googlesource.com/2662 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power --- src/sim/power/mathexpr_powermodel.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3