-# Copyright (c) 2016 ARM Limited
+# Copyright (c) 2016-2018 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
from m5.params import *
from m5.proxy import Parent
+# Enum for a type of power model
+class PMType(Enum) : vals = ['All', 'Static', 'Dynamic']
+
# Represents a power model for a simobj
# The model itself is also a SimObject so we can make use some
# nice features available such as Parent.any
# Need a reference to the system so we can query the thermal domain
# about temperature (temperature is needed for leakage calculation)
subsystem = Param.SubSystem(Parent.any, "subsystem")
+
+ # Type of power model
+ pm_type = Param.PMType("All", "Type of power model")
/*
- * Copyright (c) 2016 ARM Limited
+ * Copyright (c) 2016-2018 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
PowerModel::PowerModel(const Params *p)
: SimObject(p), states_pm(p->pm), subsystem(p->subsystem),
- clocked_object(NULL)
+ clocked_object(NULL), power_model_type(p->pm_type)
{
panic_if(subsystem == NULL,
"Subsystem is NULL! This is not acceptable for a PowerModel!\n");
{
assert(clocked_object);
+ if (power_model_type == Enums::PMType::Static) {
+ // This power model only collects static data
+ return 0;
+ }
std::vector<double> w = clocked_object->pwrStateWeights();
// Same number of states (excluding UNDEFINED)
std::vector<double> w = clocked_object->pwrStateWeights();
+ if (power_model_type == Enums::PMType::Dynamic) {
+ // This power model only collects dynamic data
+ return 0;
+ }
+
// Same number of states (excluding UNDEFINED)
assert(w.size() - 1 == states_pm.size());
/*
- * Copyright (c) 2016 ARM Limited
+ * Copyright (c) 2016, 2018 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
#define __SIM_POWER_POWER_MODEL_HH__
#include "base/statistics.hh"
+#include "enums/PMType.hh"
#include "params/PowerModel.hh"
#include "params/PowerModelState.hh"
#include "sim/probe/probe.hh"
/** The clocked object we belong to */
ClockedObject * clocked_object;
+
+ /** The type of power model - collects all power, static or dynamic only */
+ Enums::PMType power_model_type;
};
#endif