gem5  v21.1.0.2
power_domain.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017, 2019-2020 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 
39 #ifndef __SIM_POWER_DOMAIN_HH__
40 #define __SIM_POWER_DOMAIN_HH__
41 
42 #include <string>
43 #include <vector>
44 
45 #include "base/statistics.hh"
46 #include "params/PowerDomain.hh"
47 #include "sim/clocked_object.hh"
48 #include "sim/power_state.hh"
49 
50 namespace gem5
51 {
52 
59 class PowerDomain : public PowerState
60 {
61  public:
62  PowerDomain(const PowerDomainParams &p);
63  typedef PowerDomainParams Params;
64  ~PowerDomain() override {};
65 
72  void startup() override;
73 
79  void pwrStateChangeCallback(enums::PwrState new_pwr_state,
80  PowerState* leader);
81 
86  void addFollower(PowerState* pwr_obj) override;
87 
88  private:
98  enums::PwrState calculatePowerDomainState(
99  const std::vector<enums::PwrState> &f_states={});
100 
105  bool isPossiblePwrState(enums::PwrState p_state);
106 
113 
119  void setFollowerPowerStates();
120 
121  private: /* Power domain attributes */
130 
136  enums::PwrState leaderTargetState;
137 
144 
149  const Tick updateLatency = 1;
150 
156 
157  protected:
159  {
161 
162  void regStats() override;
163 
166  } stats;
167 };
168 
169 } // namespace gem5
170 
171 #endif // __SIM_POWER_DOMAIN_HH__
gem5::statistics::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:1927
gem5::PowerDomain
The PowerDomain groups PowerState objects together to regulate their power states.
Definition: power_domain.hh:59
gem5::PowerDomain::stats
gem5::PowerDomain::PowerDomainStats stats
power_state.hh
gem5::PowerDomain::setFollowerPowerStates
void setFollowerPowerStates()
Update the followers of the newly updated power state.
Definition: power_domain.cc:185
gem5::EventWrapper
Definition: eventq.hh:1084
gem5::PowerDomain::isPossiblePwrState
bool isPossiblePwrState(enums::PwrState p_state)
Check if a given p_state is available across all leaders and followers in this domain.
Definition: power_domain.cc:123
gem5::PowerDomain::leaderTargetState
enums::PwrState leaderTargetState
Power state requested by the leader.
Definition: power_domain.hh:136
gem5::PowerDomain::~PowerDomain
~PowerDomain() override
Definition: power_domain.hh:64
gem5::PowerDomain::addFollower
void addFollower(PowerState *pwr_obj) override
Function called by a follower to register itself as a dependant of this power domain.
Definition: power_domain.cc:69
std::vector
STL vector class.
Definition: stl.hh:37
gem5::PowerDomain::leaders
std::vector< PowerState * > leaders
List of all leaders in the PowerDomain.
Definition: power_domain.hh:129
gem5::PowerDomain::PowerDomainStats
Definition: power_domain.hh:158
gem5::PowerDomain::PowerDomain
PowerDomain(const PowerDomainParams &p)
Definition: power_domain.cc:48
gem5::PowerDomain::pwrStateChangeCallback
void pwrStateChangeCallback(enums::PwrState new_pwr_state, PowerState *leader)
Register the change in power state in one of the leader.
Definition: power_domain.cc:214
gem5::PowerDomain::followers
std::vector< PowerState * > followers
List of all followers in the PowerDomain.
Definition: power_domain.hh:143
gem5::PowerDomain::calculatePossiblePwrStates
void calculatePossiblePwrStates()
Calculate the possible power states of the domain based upon the intersection of the power states of ...
Definition: power_domain.cc:137
gem5::PowerDomain::PowerDomainStats::numLeaderCallsChangingState
statistics::Scalar numLeaderCallsChangingState
Definition: power_domain.hh:165
gem5::PowerDomain::calculatePowerDomainState
enums::PwrState calculatePowerDomainState(const std::vector< enums::PwrState > &f_states={})
Calculate the power state of the power domain, based upon the power states of the leaders.
Definition: power_domain.cc:150
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
statistics.hh
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::PowerState
Helper class for objects that have power states.
Definition: power_state.hh:64
gem5::PowerDomain::pwrStateUpdateEvent
EventWrapper< PowerDomain, &PowerDomain::setFollowerPowerStates > pwrStateUpdateEvent
Event to update the power states of the followers.
Definition: power_domain.hh:155
gem5::PowerDomain::PowerDomainStats::PowerDomainStats
PowerDomainStats(PowerDomain &pd)
Definition: power_domain.cc:247
gem5::PowerDomain::startup
void startup() override
During startup, the list of possible power states the PowerDomain can be in is populated,...
Definition: power_domain.cc:76
gem5::PowerDomain::updateLatency
const Tick updateLatency
Latency with which power state changes of the leaders will ripple through to the followers.
Definition: power_domain.hh:149
clocked_object.hh
gem5::statistics::Group
Statistics container.
Definition: group.hh:93
gem5::PowerDomain::PowerDomainStats::numLeaderCalls
statistics::Scalar numLeaderCalls
Definition: power_domain.hh:164
gem5::PowerDomain::Params
PowerDomainParams Params
Definition: power_domain.hh:63
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::PowerDomain::PowerDomainStats::regStats
void regStats() override
Callback to set stat parameters.
Definition: power_domain.cc:258

Generated on Tue Sep 21 2021 12:25:48 for gem5 by doxygen 1.8.17