43#include "params/MathExprPowerModel.hh"
62 for (
auto var: vars) {
64 if (var ==
"temp" || var ==
"voltage" || var ==
"clock_period") {
69 fatal_if(!info,
"Failed to evaluate %s in expression:\n%s\n",
81 this, std::placeholders::_1)
88 using namespace statistics;
93 }
else if (
name ==
"voltage") {
95 }
else if (
name==
"clock_period") {
101 const Info *info = it->second;
111 panic(
"Unknown stat type!\n");
MathExprPowerModelParams Params
double getStatValue(const std::string &name) const
Get the value for a variable (maps to a stat)
double eval(const MathExpr &expr) const
Evaluate an expression in the context of this object, fatal if evaluation fails.
MathExprPowerModel(const Params &p)
std::unordered_map< std::string, const statistics::Info * > statsMap
void startup() override
startup() is the final initialization call before simulation.
void regStats() override
Callback to set stat parameters.
double eval(EvalCallback fn) const
Evaluates the expression.
virtual std::string name() const
A PowerModelState is an abstract class used as interface to get power figures out of SimObjects.
Temperature _temp
Current temperature.
ClockedObject * clocked_object
The clocked object we belong to.
constexpr double toCelsius() const
virtual Counter value() const =0
virtual Result total() const =0
#define panic(...)
This implements a cprintf based panic() function.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
virtual void regStats()
Callback to set stat parameters.
const Info * resolve(const std::string &name)
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Declaration of Statistics objects.
const std::string & name()