43 #include "params/MathExprPowerModel.hh" 59 for (
auto var: vars) {
61 if (var ==
"temp" || var ==
"voltage" || var ==
"clock_period") {
66 fatal_if(!info,
"Failed to evaluate %s in expression:\n%s\n",
78 this, std::placeholders::_1)
85 using namespace Stats;
90 }
else if (name ==
"voltage") {
92 }
else if (name==
"clock_period") {
98 const Info *info = it->second;
108 panic(
"Unknown stat type!\n");
118 MathExprPowerModelParams::create()
#define panic(...)
This implements a cprintf based panic() function.
const Info * resolve(const std::string &name)
void startup() override
startup() is the final initialization call before simulation.
void regStats()
Callback to set stat parameters.
void regStats() override
Callback to set stat parameters.
std::unordered_map< std::string, const Stats::Info * > statsMap
Declaration of Statistics objects.
double eval(EvalCallback fn) const
Evaluates the expression.
MathExprPowerModel(const Params *p)
double _temp
Current temperature.
MathExprPowerModelParams Params
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
ClockedObject * clocked_object
The clocked object we belong to.
double getStatValue(const std::string &name) const
Get the value for a variable (maps to a stat)
virtual const std::string name() const
double eval(const MathExpr &expr) const
Evaluate an expression in the context of this object, fatal if evaluation fails.
A PowerModelState is an abstract class used as interface to get power figures out of SimObjects...