/*
- * Copyright (c) 2012-2014 ARM Limited
+ * Copyright (c) 2012-2014, 2019 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Vasileios Spiliopoulos
- * Akash Bagdia
*/
+#include "sim/voltage_domain.hh"
+
#include <algorithm>
#include "base/statistics.hh"
+#include "base/trace.hh"
#include "debug/VoltageDomain.hh"
#include "params/VoltageDomain.hh"
#include "sim/sim_object.hh"
-#include "sim/voltage_domain.hh"
VoltageDomain::VoltageDomain(const Params *p)
- : SimObject(p), voltageOpPoints(p->voltage), _perfLevel(0)
+ : SimObject(p), voltageOpPoints(p->voltage), _perfLevel(0), stats(*this)
{
fatal_if(voltageOpPoints.empty(), "DVFS: Empty set of voltages for "\
"voltage domain %s\n", name());
// Voltages must be sorted in descending order.
fatal_if(!std::is_sorted(voltageOpPoints.begin(), voltageOpPoints.end(),
- std::greater_equal<Voltages::value_type>()), "DVFS: Voltage "\
- "operation points not in descending order for voltage domain "\
- "%s\n", name());
+ std::greater<Voltages::value_type>()), "DVFS: Voltage operation "\
+ "points not in descending order for voltage domain %s\n",
+ name());
}
void
"DVFS: Requested voltage ID %d is outside the known "\
"range for domain %s.\n", perf_level, name());
+ if (perf_level == _perfLevel) {
+ // Silently ignore identical overwrites
+ return;
+ }
+
_perfLevel = perf_level;
DPRINTF(VoltageDomain, "Setting voltage to %.3fV idx: %d for domain %s\n",
}
}
-void
-VoltageDomain::regStats()
-{
- currentVoltage
- .method(this, &VoltageDomain::voltage)
- .name(params()->name + ".voltage")
- .desc("Voltage in Volts")
- ;
-}
-
VoltageDomain *
VoltageDomainParams::create()
{
}
void
-VoltageDomain::serialize(std::ostream &os) {
+VoltageDomain::serialize(CheckpointOut &cp) const
+{
SERIALIZE_SCALAR(_perfLevel);
}
void
-VoltageDomain::unserialize(Checkpoint *cp, const std::string §ion) {
+VoltageDomain::unserialize(CheckpointIn &cp)
+{
UNSERIALIZE_SCALAR(_perfLevel);
perfLevel(_perfLevel);
}
+
+VoltageDomain::VoltageDomainStats::VoltageDomainStats(VoltageDomain &vd)
+ : Stats::Group(&vd),
+ ADD_STAT(voltage, "Voltage in Volts")
+{
+ voltage.method(&vd, &VoltageDomain::voltage);
+}