From: David Guillen Fandos Date: Fri, 1 Jul 2016 16:46:25 +0000 (+0100) Subject: pwr: Enable multiple power models per component X-Git-Tag: v19.0.0.0~2554 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0757bef15d934b22555c396bcbcb91c0a1dffbe5;p=gem5.git pwr: Enable multiple power models per component This patch allows the user to specify more than one power model for any given Clocked Object. This is useful and some times necessary to properly model components that have multiple power sources (or subcomponents) but gem5 doesn't model them. The ideal solution would be to have a DictParam to replace the VectorParam so each model can have a name and can be identified in the stats file. Change-Id: I4080a7054a16b56069c44750a7a9ce4e674cdf9d Reviewed-by: Andreas Sandberg Reviewed-on: https://gem5-review.googlesource.com/5733 Maintainer: Andreas Sandberg --- diff --git a/src/sim/ClockedObject.py b/src/sim/ClockedObject.py index c8bf809be..2d6171888 100644 --- a/src/sim/ClockedObject.py +++ b/src/sim/ClockedObject.py @@ -67,7 +67,7 @@ class ClockedObject(SimObject): clk_domain = Param.ClockDomain(Parent.clk_domain, "Clock domain") # Power model for this ClockedObject - power_model = Param.PowerModel(NULL, "Power model") + power_model = VectorParam.PowerModel([], "Power models") # Provide initial power state, should ideally get redefined in startup # routine diff --git a/src/sim/clocked_object.cc b/src/sim/clocked_object.cc index f1e3134c3..56389119a 100644 --- a/src/sim/clocked_object.cc +++ b/src/sim/clocked_object.cc @@ -49,8 +49,8 @@ ClockedObject::ClockedObject(const ClockedObjectParams *p) : prvEvalTick(0) { // Register the power_model with the object - if (p->power_model) - p->power_model->setClockedObject(this); + for (auto & power_model: p->power_model) + power_model->setClockedObject(this); } void