gem5  v20.1.0.0
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 
56 class PowerDomain : public PowerState
57 {
58  public:
59  PowerDomain(const PowerDomainParams* p);
60  typedef PowerDomainParams Params;
61  ~PowerDomain() override {};
62 
69  void startup() override;
70 
76  void pwrStateChangeCallback(Enums::PwrState new_pwr_state,
77  PowerState* leader);
78 
83  void addFollower(PowerState* pwr_obj) override;
84 
85  private:
95  Enums::PwrState calculatePowerDomainState(
96  const std::vector<Enums::PwrState> &f_states={});
97 
102  bool isPossiblePwrState(Enums::PwrState p_state);
103 
110 
116  void setFollowerPowerStates();
117 
118  private: /* Power domain attributes */
127 
133  Enums::PwrState leaderTargetState;
134 
141 
146  const Tick updateLatency = 1;
147 
153 
154  protected:
156  {
158 
159  void regStats() override;
160 
163  } stats;
164 };
165 
166 #endif // __SIM_POWER_DOMAIN_HH__
power_state.hh
PowerDomain::Params
PowerDomainParams Params
Definition: power_domain.hh:60
PowerDomain::PowerDomainStats::PowerDomainStats
PowerDomainStats(PowerDomain &pd)
Definition: power_domain.cc:244
PowerDomain::setFollowerPowerStates
void setFollowerPowerStates()
Update the followers of the newly updated power state.
Definition: power_domain.cc:182
PowerDomain::PowerDomainStats::numLeaderCalls
Stats::Scalar numLeaderCalls
Definition: power_domain.hh:161
PowerDomain
The PowerDomain groups PowerState objects together to regulate their power states.
Definition: power_domain.hh:56
PowerDomain::PowerDomain
PowerDomain(const PowerDomainParams *p)
Definition: power_domain.cc:45
PowerDomain::PowerDomainStats::regStats
void regStats() override
Callback to set stat parameters.
Definition: power_domain.cc:255
EventWrapper< PowerDomain, &PowerDomain::setFollowerPowerStates >
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
PowerDomain::~PowerDomain
~PowerDomain() override
Definition: power_domain.hh:61
std::vector
STL vector class.
Definition: stl.hh:37
PowerDomain::followers
std::vector< PowerState * > followers
List of all followers in the PowerDomain.
Definition: power_domain.hh:140
PowerDomain::leaders
std::vector< PowerState * > leaders
List of all leaders in the PowerDomain.
Definition: power_domain.hh:126
PowerDomain::stats
PowerDomain::PowerDomainStats stats
Stats::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:2533
PowerDomain::updateLatency
const Tick updateLatency
Latency with which power state changes of the leaders will ripple through to the followers.
Definition: power_domain.hh:146
statistics.hh
PowerState
Helper class for objects that have power states.
Definition: power_state.hh:61
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:211
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:66
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:134
PowerDomain::PowerDomainStats::numLeaderCallsChangingState
Stats::Scalar numLeaderCallsChangingState
Definition: power_domain.hh:162
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:120
PowerDomain::leaderTargetState
Enums::PwrState leaderTargetState
Power state requested by the leader.
Definition: power_domain.hh:133
clocked_object.hh
Stats::Group
Statistics container.
Definition: group.hh:83
PowerDomain::startup
void startup() override
During startup, the list of possible power states the PowerDomain can be in is populated,...
Definition: power_domain.cc:73
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
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:147
PowerDomain::PowerDomainStats
Definition: power_domain.hh:155
PowerDomain::pwrStateUpdateEvent
EventWrapper< PowerDomain, &PowerDomain::setFollowerPowerStates > pwrStateUpdateEvent
Event to update the power states of the followers.
Definition: power_domain.hh:152

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