41#include "debug/EnergyCtrl.hh"
44#include "params/EnergyCtrl.hh"
53 dvfsHandler(
p.dvfs_handler),
55 domainIDIndexToRead(0),
60 fatal_if(!
p.dvfs_handler,
"EnergyCtrl: Needs a DVFSHandler for a "
61 "functioning system.\n");
71 assert((daddr & 3) == 0);
76 pkt->
setLE<uint32_t>(0);
77 warn_once(
"EnergyCtrl: Disabled handler, ignoring read from reg %i\n",
142 panic(
"Tried to read EnergyCtrl at offset %#x / reg %i\n", daddr,
145 pkt->
setLE<uint32_t>(result);
160 assert((daddr & 3) == 0);
165 warn_once(
"EnergyCtrl: Disabled handler, ignoring write %u to "\
212 panic(
"Tried to write EnergyCtrl at offset %#x\n", daddr);
243 if (next_event != 0) {
252 warn(
"Existing EnergyCtrl, but no enabled DVFSHandler found.\n");
Addr pioAddr
Address that the device listens to.
Tick pioDelay
Delay that the device experinces on an access.
Addr pioSize
Size that the device's address range.
Tick transLatency() const
Get transition latency to switch between performance levels.
Tick clkPeriodAtPerfLevel(DomainID domain_id, PerfLevel perf_level) const
Read the clock period of the specified domain at the specified performance level.
bool perfLevel(DomainID domain_id, PerfLevel perf_level)
Set a new performance level for the specified domain.
bool isEnabled() const
Check enable status of the DVFS handler, when the handler is disabled, no request should be sent to t...
DomainID domainID(uint32_t index) const
Get the n-th domain ID, from the domains managed by this handler.
double voltageAtPerfLevel(DomainID domain_id, PerfLevel perf_level) const
Read the voltage of the specified domain at the specified performance level.
uint32_t numDomains() const
Get the number of domains assigned to this DVFS handler.
PerfLevel numPerfLevels(PerfLevel domain_id) const
Get the total number of available performance levels.
bool validDomainID(DomainID domain_id) const
Check whether a domain ID is known to the handler or not.
static uint32_t toMicroVolt(double voltage)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
static uint32_t ticksTokHz(Tick period)
Tick read(PacketPtr pkt) override
Read command sent to the device.
void startup() override
startup() is the final initialization call before simulation.
DVFSHandler * dvfsHandler
EventFunctionWrapper updateAckEvent
EnergyCtrl(const Params &p)
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Tick write(PacketPtr pkt) override
Write command sent to the device.
@ DVFS_HANDLER_TRANS_LATENCY
void updatePLAck()
Update the acknowledgment that is read back by the software to confirm newly requested performance le...
void serialize(CheckpointOut &cp) const override
Serialize an object.
uint32_t perfLevelAck
Acknowledgment (PERF_LEVEL_ACK) RO register, software polls this register to read back the status of ...
uint32_t domainIDIndexToRead
Index for getting the domain ID from the domain ID list available with the DVFS handler.
uint32_t domainID
Cluster ID (DOMAIN_ID) R/W register, programmed to ID of the domain for which the set/get performance...
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
void setLE(T v)
Set the value in the data pointer to v as little endian.
void makeAtomicResponse()
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
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...
The energy controller is a device being used to manage power and energy related control operations wi...
void deschedule(Event &event)
bool scheduled() const
Determine if the current event is scheduled.
void schedule(Event &event, Tick when)
Tick when() const
Get the time that the event is scheduled.
#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...
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Tick curTick()
The universal simulation clock.
std::ostream CheckpointOut
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
uint64_t Tick
Tick count type.
Declaration of the Packet class.
#define UNSERIALIZE_SCALAR(scalar)
#define SERIALIZE_SCALAR(scalar)
const std::string & name()