From ad82dd3b56331d3447cf0c6df6a78606989df4ca Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Tue, 19 Jan 2021 10:16:03 +0000 Subject: [PATCH] sim: Use the Temperature param type Add support for passing typed temperatures using the new Temperature param type. Change-Id: If68d619fd824e171d895a5cbbe4d0325d4c4f4db Signed-off-by: Andreas Sandberg Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39219 Tested-by: kokoro Reviewed-by: Gabe Black Reviewed-by: Daniel Carvalho Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power --- src/sim/power/PowerModel.py | 4 ++-- src/sim/power/ThermalDomain.py | 4 ++-- src/sim/power/ThermalModel.py | 4 ++-- src/sim/power/power_model.cc | 2 +- src/sim/power/thermal_domain.cc | 4 ++-- src/sim/power/thermal_model.cc | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/sim/power/PowerModel.py b/src/sim/power/PowerModel.py index 2047c645b..cfbd8cb66 100644 --- a/src/sim/power/PowerModel.py +++ b/src/sim/power/PowerModel.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016-2018 ARM Limited +# Copyright (c) 2016-2018, 2021 Arm Limited # All rights reserved. # # The license below extends only to copyright in the software and shall @@ -63,4 +63,4 @@ class PowerModel(SimObject): pm_type = Param.PMType("All", "Type of power model") # Ambient temperature to be used when no thermal model is present - ambient_temp = Param.Float(25.0, "Ambient temperature") + ambient_temp = Param.Temperature("25.0C", "Ambient temperature") diff --git a/src/sim/power/ThermalDomain.py b/src/sim/power/ThermalDomain.py index 3fd5cadbf..57c53b291 100644 --- a/src/sim/power/ThermalDomain.py +++ b/src/sim/power/ThermalDomain.py @@ -1,4 +1,4 @@ -# Copyright (c) 2015 ARM Limited +# Copyright (c) 2015, 2021 Arm Limited # All rights reserved. # # The license below extends only to copyright in the software and shall @@ -46,4 +46,4 @@ class ThermalDomain(SimObject): ] # Static temperature which may change over time - initial_temperature = Param.Float(25.0, "Initial temperature") + initial_temperature = Param.Temperature("25.0C", "Initial temperature") diff --git a/src/sim/power/ThermalModel.py b/src/sim/power/ThermalModel.py index 2894dd8eb..90710e19e 100644 --- a/src/sim/power/ThermalModel.py +++ b/src/sim/power/ThermalModel.py @@ -1,4 +1,4 @@ -# Copyright (c) 2015 ARM Limited +# Copyright (c) 2015, 2021 Arm Limited # All rights reserved. # # The license below extends only to copyright in the software and shall @@ -77,7 +77,7 @@ class ThermalReference(SimObject, object): ] # Static temperature which may change over time - temperature = Param.Float(25.0, "Operational temperature in Celsius") + temperature = Param.Temperature("25.0C", "Operational temperature") # Represents a thermal capacitor diff --git a/src/sim/power/power_model.cc b/src/sim/power/power_model.cc index fbc67d34b..42515ace8 100644 --- a/src/sim/power/power_model.cc +++ b/src/sim/power/power_model.cc @@ -66,7 +66,7 @@ PowerModel::PowerModel(const Params &p) // The temperature passed here will be overwritten, if there is // a thermal model present for (auto & pms: states_pm){ - pms->setTemperature(p.ambient_temp); + pms->setTemperature(p.ambient_temp.toCelsius()); } dynamicPower diff --git a/src/sim/power/thermal_domain.cc b/src/sim/power/thermal_domain.cc index a5eb33c8e..b0868becf 100644 --- a/src/sim/power/thermal_domain.cc +++ b/src/sim/power/thermal_domain.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 ARM Limited + * Copyright (c) 2015, 2021 Arm Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -49,7 +49,7 @@ #include "sim/sub_system.hh" ThermalDomain::ThermalDomain(const Params &p) - : SimObject(p), _initTemperature(p.initial_temperature), + : SimObject(p), _initTemperature(p.initial_temperature.toCelsius()), node(NULL), subsystem(NULL), ADD_STAT(currentTemp, "Temperature in centigrade degrees") { diff --git a/src/sim/power/thermal_model.cc b/src/sim/power/thermal_model.cc index a37240b9b..c57e284c9 100644 --- a/src/sim/power/thermal_model.cc +++ b/src/sim/power/thermal_model.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 ARM Limited + * Copyright (c) 2015, 2021 Arm Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -51,7 +51,7 @@ * ThermalReference */ ThermalReference::ThermalReference(const Params &p) - : SimObject(p), _temperature(p.temperature), node(NULL) + : SimObject(p), _temperature(p.temperature.toCelsius()), node(NULL) { } -- 2.30.2