gem5  v20.1.0.0
thermal_model.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 ARM Limited
3  * All rights reserved
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #ifndef __SIM_THERMAL_MODEL_HH__
39 #define __SIM_THERMAL_MODEL_HH__
40 
41 #include <vector>
42 
43 #include "params/ThermalCapacitor.hh"
44 #include "params/ThermalModel.hh"
45 #include "params/ThermalReference.hh"
46 #include "params/ThermalResistor.hh"
47 #include "sim/clocked_object.hh"
51 #include "sim/sim_object.hh"
52 
53 
59 class ThermalResistor : public SimObject, public ThermalEntity
60 {
61  public:
62  typedef ThermalResistorParams Params;
63  ThermalResistor(const Params *p);
64 
65  void serialize(CheckpointOut &cp) const override;
66  void unserialize(CheckpointIn &cp) override;
67 
68  void setNodes(ThermalNode * n1, ThermalNode * n2) {
69  node1 = n1;
70  node2 = n2;
71  }
72 
73  LinearEquation getEquation(ThermalNode * tn, unsigned n,
74  double step) const override;
75 
76  private:
77  /* Resistance value in K/W */
78  double _resistance;
79  /* Nodes connected to the resistor */
81 };
82 
89 {
90  public:
91  typedef ThermalCapacitorParams Params;
92  ThermalCapacitor(const Params *p);
93 
94  void serialize(CheckpointOut &cp) const override;
95  void unserialize(CheckpointIn &cp) override;
96 
97  LinearEquation getEquation(ThermalNode * tn, unsigned n,
98  double step) const override;
99 
100  void setNodes(ThermalNode * n1, ThermalNode * n2) {
101  node1 = n1;
102  node2 = n2;
103  }
104 
105  private:
106  /* Capacitance value in J/K */
107  double _capacitance;
108  /* Nodes connected to the resistor */
110 };
111 
117 {
118  public:
119  typedef ThermalReferenceParams Params;
120  ThermalReference(const Params *p);
121 
123  node = n;
124  }
125 
126  LinearEquation getEquation(ThermalNode * tn, unsigned n,
127  double step) const override;
128 
129  void serialize(CheckpointOut &cp) const override;
130  void unserialize(CheckpointIn &cp) override;
131 
132  /* Fixed temperature value in centigrate degrees */
133  double _temperature;
134  /* Nodes connected to the resistor */
136 };
137 
138 
148 {
149  public:
150  typedef ThermalModelParams Params;
151  ThermalModel(const Params *p);
152 
153  void addDomain(ThermalDomain * d);
156  void addResistor(ThermalResistor * r);
157 
158  void addNode(ThermalNode * n) { nodes.push_back(n); }
159 
160  double getTemp() const;
161 
162  void startup() override;
163  void doStep();
164 
165  void serialize(CheckpointOut &cp) const override;
166  void unserialize(CheckpointIn &cp) override;
167  private:
168 
169  /* Keep track of all components used for the thermal model */
174 
176 
177  /* Keep a list of the instantiated nodes */
180 
183 
185  double _step;
186 
187 };
188 
189 #endif
ThermalResistor::Params
ThermalResistorParams Params
Definition: thermal_model.hh:62
ThermalDomain
A ThermalDomain is used to group objects under that operate under the same temperature.
Definition: thermal_domain.hh:57
ThermalModel
Definition: thermal_model.hh:147
ThermalCapacitor::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: thermal_model.cc:150
ThermalModel::capacitors
std::vector< ThermalCapacitor * > capacitors
Definition: thermal_model.hh:172
ThermalModel::domains
std::vector< ThermalDomain * > domains
Definition: thermal_model.hh:170
ThermalResistor::node2
ThermalNode * node2
Definition: thermal_model.hh:80
ThermalCapacitor::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: thermal_model.cc:156
ThermalNode
A ThermalNode is used to connect thermal entities, such as resistors, capacitors, references and doma...
Definition: thermal_node.hh:50
ThermalModel::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: thermal_model.cc:206
ThermalReference::_temperature
double _temperature
Definition: thermal_model.hh:133
ThermalCapacitor::node1
ThermalNode * node1
Definition: thermal_model.hh:109
ThermalModel::addReference
void addReference(ThermalReference *r)
Definition: thermal_model.cc:283
ThermalResistor::_resistance
double _resistance
Definition: thermal_model.hh:78
LinearEquation
This class describes a linear equation with constant coefficients.
Definition: linear_solver.hh:52
ThermalReference::setNode
void setNode(ThermalNode *n)
Definition: thermal_model.hh:122
thermal_entity.hh
std::vector< ThermalDomain * >
ThermalReference
A ThermalReference is a thermal domain with fixed temperature.
Definition: thermal_model.hh:116
ThermalCapacitor::Params
ThermalCapacitorParams Params
Definition: thermal_model.hh:91
ThermalResistor::getEquation
LinearEquation getEquation(ThermalNode *tn, unsigned n, double step) const override
Definition: thermal_model.cc:109
ClockedObject
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Definition: clocked_object.hh:231
ThermalResistor::ThermalResistor
ThermalResistor(const Params *p)
ThermalResistor.
Definition: thermal_model.cc:85
EventFunctionWrapper
Definition: eventq.hh:1101
ArmISA::n
Bitfield< 31 > n
Definition: miscregs_types.hh:450
ThermalModel::resistors
std::vector< ThermalResistor * > resistors
Definition: thermal_model.hh:173
thermal_node.hh
cp
Definition: cprintf.cc:40
ThermalResistor::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: thermal_model.cc:97
ThermalModel::Params
ThermalModelParams Params
Definition: thermal_model.hh:150
ThermalReference::getEquation
LinearEquation getEquation(ThermalNode *tn, unsigned n, double step) const override
Definition: thermal_model.cc:76
sim_object.hh
ThermalReference::ThermalReference
ThermalReference(const Params *p)
ThermalReference.
Definition: thermal_model.cc:52
ArmISA::d
Bitfield< 9 > d
Definition: miscregs_types.hh:60
ThermalModel::addNode
void addNode(ThermalNode *n)
Definition: thermal_model.hh:158
ThermalCapacitor::getEquation
LinearEquation getEquation(ThermalNode *tn, unsigned n, double step) const override
Definition: thermal_model.cc:162
ThermalModel::_step
double _step
Step in seconds for thermal updates.
Definition: thermal_model.hh:185
MipsISA::r
r
Definition: pra_constants.hh:95
ThermalCapacitor::setNodes
void setNodes(ThermalNode *n1, ThermalNode *n2)
Definition: thermal_model.hh:100
ThermalResistor
A ThermalResistor is used to model a thermal resistance between two thermal domains.
Definition: thermal_model.hh:59
ThermalModel::getTemp
double getTemp() const
Definition: thermal_model.cc:296
ThermalReference::serialize
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: thermal_model.cc:64
ThermalModel::nodes
std::vector< ThermalNode * > nodes
Definition: thermal_model.hh:178
ThermalCapacitor
A ThermalCapacitor is used to model a thermal capacitance between two thermal domains.
Definition: thermal_model.hh:88
thermal_domain.hh
ThermalResistor::node1
ThermalNode * node1
Definition: thermal_model.hh:80
ThermalModel::eq_nodes
std::vector< ThermalNode * > eq_nodes
Definition: thermal_model.hh:179
ThermalModel::addDomain
void addDomain(ThermalDomain *d)
Definition: thermal_model.cc:279
ThermalModel::stepEvent
EventFunctionWrapper stepEvent
Stepping event to update the model values.
Definition: thermal_model.hh:182
ThermalCapacitor::node2
ThermalNode * node2
Definition: thermal_model.hh:109
ClockedObject::Params
ClockedObjectParams Params
Parameters of ClockedObject.
Definition: clocked_object.hh:237
clocked_object.hh
ThermalModel::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: thermal_model.cc:212
ThermalModel::doStep
void doStep()
Definition: thermal_model.cc:218
ThermalModel::addCapacitor
void addCapacitor(ThermalCapacitor *c)
Definition: thermal_model.cc:287
ThermalReference::Params
ThermalReferenceParams Params
Definition: thermal_model.hh:119
ThermalResistor::setNodes
void setNodes(ThermalNode *n1, ThermalNode *n2)
Definition: thermal_model.hh:68
ThermalCapacitor::_capacitance
double _capacitance
Definition: thermal_model.hh:107
CheckpointOut
std::ostream CheckpointOut
Definition: serialize.hh:63
ArmISA::c
Bitfield< 29 > c
Definition: miscregs_types.hh:50
ThermalModel::startup
void startup() override
startup() is the final initialization call before simulation.
Definition: thermal_model.cc:247
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
ThermalResistor::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: thermal_model.cc:103
CheckpointIn
Definition: serialize.hh:67
ThermalModel::addResistor
void addResistor(ThermalResistor *r)
Definition: thermal_model.cc:291
ThermalEntity
An abstract class that represents any thermal entity which is used in the circuital thermal equivalen...
Definition: thermal_entity.hh:51
ThermalCapacitor::ThermalCapacitor
ThermalCapacitor(const Params *p)
ThermalCapacitor.
Definition: thermal_model.cc:138
ThermalReference::unserialize
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: thermal_model.cc:70
ThermalReference::node
ThermalNode * node
Definition: thermal_model.hh:135
ThermalModel::references
std::vector< ThermalReference * > references
Definition: thermal_model.hh:171
ThermalModel::entities
std::vector< ThermalEntity * > entities
Definition: thermal_model.hh:175
SimObject
Abstract superclass for simulation objects.
Definition: sim_object.hh:92
ThermalModel::ThermalModel
ThermalModel(const Params *p)
ThermalModel.
Definition: thermal_model.cc:194

Generated on Wed Sep 30 2020 14:02:14 for gem5 by doxygen 1.8.17