summaryrefslogtreecommitdiff
path: root/src/sim/clocked_object.cc
diff options
context:
space:
mode:
authorDavid Guillen Fandos <david.guillen@arm.com>2016-04-05 10:52:28 -0500
committerDavid Guillen Fandos <david.guillen@arm.com>2016-04-05 10:52:28 -0500
commitf902c0218ae3a8df558f1427302fbf0931b8f7d7 (patch)
treeb82de4efdff69b2511941fe9312fa9e96601f710 /src/sim/clocked_object.cc
parent1c34ee20dfbbd557e394d61825232b10c0f3d37f (diff)
downloadgem5-f902c0218ae3a8df558f1427302fbf0931b8f7d7.tar.xz
power: Add support for power models
This patch adds some basic support for power models in gem5. The power interface is defined so it can interact with thermal models as well. It implements a simple power evaluator that can be used for simple power models that express power in the form of a math expression. These expressions can use stats within the same SimObject (or down its hierarchy) and some magic variables such as "temp" for temperature. In future patches we will extend this functionality to allow slightly more complex expressions. The model allows it to be extended to use other kinds of models. Finally, the thermal model is updated to use the power usage as input.
Diffstat (limited to 'src/sim/clocked_object.cc')
-rw-r--r--src/sim/clocked_object.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/sim/clocked_object.cc b/src/sim/clocked_object.cc
index 9a682a4ce..e679f03a0 100644
--- a/src/sim/clocked_object.cc
+++ b/src/sim/clocked_object.cc
@@ -41,6 +41,17 @@
#include "sim/clocked_object.hh"
#include "base/misc.hh"
+#include "sim/power/power_model.hh"
+
+ClockedObject::ClockedObject(const ClockedObjectParams *p) :
+ SimObject(p), Clocked(*p->clk_domain),
+ _currPwrState(p->default_p_state),
+ prvEvalTick(0)
+{
+ // Register the power_model with the object
+ if (p->power_model)
+ p->power_model->setClockedObject(this);
+}
void
ClockedObject::serialize(CheckpointOut &cp) const