This document gives an overview of the power and thermal modelling infrastructure in Gem5.
The purpose is to give a high level view of all the pieces involved and how they interact with each other and the simulator.
Classes involved in the power model are:
Classes involved in the thermal model are:
The thermal model works by creating a circuital equivalent of the simulated platform. Each node in the circuit has a temperature (as voltage equivalent) and power flows between nodes (as current in a circuit).
To build this equivalent temperature model the platform is required to group the power actors (any component that has a power model) under SubSystems and attach ThermalDomains to those subsystems. Other components might also be created (like ThermalReferences) and connected all together by creating thermal entities (capacitors and resistors).
Last step to conclude the thermal model is to create the ThermalModel instance itself and attach all the instances used to it, so it can properly update them at runtime. Only one thermal model instance is supported right now and it will automatically report temperature when appropriate (ie. platform sensor devices).
Every ClockedObject has a power model associated. If this power model is non-null power will be calculated at every stats dump (although it might be possible to force power evaluation at any other point, if the power model uses the stats, it is a good idea to keep both events in sync). The definition of a power model is quite vague in the sense that it is as flexible as users want it to be. The only enforced contraints so far is the fact that a power model has several power state models, one for each possible power state for that hardware block. When it comes to compute power consumption the power is just the weighted average of each power model.
A power state model is essentially an interface that allows us to define two power functions for dynamic and static. As an example implementation a class called MathExprPowerModel has been provided. This implementation allows the user to define a power model as an equation involving several statistics. There's also some automatic (or “magic”) variables such as “temp”, which reports temperature.