44 #include "debug/EnergyCtrl.hh" 47 #include "params/EnergyCtrl.hh" 52 dvfsHandler(p->dvfs_handler),
54 domainIDIndexToRead(0),
59 fatal_if(!
p->dvfs_handler,
"EnergyCtrl: Needs a DVFSHandler for a " 60 "functioning system.\n");
70 assert((daddr & 3) == 0);
75 pkt->
setLE<uint32_t>(0);
76 warn_once(
"EnergyCtrl: Disabled handler, ignoring read from reg %i\n",
141 panic(
"Tried to read EnergyCtrl at offset %#x / reg %i\n", daddr,
144 pkt->
setLE<uint32_t>(result);
156 data = pkt->
getLE<uint32_t>();
159 assert((daddr & 3) == 0);
164 warn_once(
"EnergyCtrl: Disabled handler, ignoring write %u to "\
165 "reg %i\n", data, reg);
167 "reg %i\n", data, reg);
211 panic(
"Tried to write EnergyCtrl at offset %#x\n", daddr);
242 if (next_event != 0) {
256 warn(
"Existing EnergyCtrl, but no enabled DVFSHandler found.\n");
#define panic(...)
This implements a cprintf based panic() function.
bool perfLevel(DomainID domain_id, PerfLevel perf_level)
Set a new performance level for the specified domain.
PerfLevel numPerfLevels(PerfLevel domain_id) const
Get the total number of available performance levels.
double voltageAtPerfLevel(DomainID domain_id, PerfLevel perf_level) const
Read the voltage of the specified domain at the specified performance level.
void updatePLAck()
Update the acknowledgment that is read back by the software to confirm newly requested performance le...
Tick when() const
Get the time that the event is scheduled.
uint32_t perfLevelAck
Acknowledgment (PERF_LEVEL_ACK) RO register, software polls this register to read back the status of ...
bool isEnabled() const
Check enable status of the DVFS handler, when the handler is disabled, no request should be sent to t...
Tick write(PacketPtr pkt) override
Write command sent to the device.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
bool validDomainID(DomainID domain_id) const
Check whether a domain ID is known to the handler or not.
static uint32_t toMicroVolt(double voltage)
Registers
Discovery flows:
void deschedule(Event &event)
void setLE(T v)
Set the value in the data pointer to v as little endian.
uint32_t domainIDIndexToRead
Index for getting the domain ID from the domain ID list available with the DVFS handler.
DomainID domainID(uint32_t index) const
Get the n-th domain ID, from the domains managed by this handler.
Tick clkPeriodAtPerfLevel(DomainID domain_id, PerfLevel perf_level) const
Read the clock period of the specified domain at the specified performance level. ...
DVFSHandler * dvfsHandler
#define UNSERIALIZE_SCALAR(scalar)
EnergyCtrl(const Params *p)
uint32_t domainID
Cluster ID (DOMAIN_ID) R/W register, programmed to ID of the domain for which the set/get performance...
Tick curTick()
The current simulated tick.
bool scheduled() const
Determine if the current event is scheduled.
Addr pioSize
Size that the device's address range.
uint32_t numDomains() const
Get the number of domains assigned to this DVFS handler.
void makeAtomicResponse()
uint64_t Tick
Tick count type.
void serialize(CheckpointOut &cp) const override
Serialize an object.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Tick transLatency() const
Get transition latency to switch between performance levels.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
virtual const std::string name() const
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
DVFSHandler and DomainConfig class declaration used for managing voltage and frequency scaling of the...
#define SERIALIZE_SCALAR(scalar)
static uint32_t ticksTokHz(Tick period)
Declaration of the Packet class.
std::ostream CheckpointOut
The energy controller is a device being used to manage power and energy related control operations wi...
Tick pioDelay
Delay that the device experinces on an access.
void schedule(Event &event, Tick when)
Tick read(PacketPtr pkt) override
Read command sent to the device.
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
void startup() override
startup() is the final initialization call before simulation.
Addr pioAddr
Address that the device listens to.
EventFunctionWrapper updateAckEvent