gem5  v21.1.0.2
dueling.hh
Go to the documentation of this file.
1 
29 #ifndef __BASE_DUELING_HH__
30 #define __BASE_DUELING_HH__
31 
32 #include <cstddef>
33 #include <cstdint>
34 
35 #include "base/sat_counter.hh"
36 
37 namespace gem5
38 {
39 
52 class Dueler
53 {
54  private:
61  uint64_t _isSample;
62 
67  uint64_t _team;
68 
69  public:
71  Dueler();
72  virtual ~Dueler() = default;
73 
80  void setSample(uint64_t id, bool team);
81 
90  bool isSample(uint64_t id, bool& team) const;
91 };
92 
108 {
109  private:
110  // There are always exactly two duelers. If this is changed the logic
111  // must be revisited
112  const int NUM_DUELERS = 2;
113 
121  const uint64_t id;
122 
128  const std::size_t constituencySize;
129 
131  const std::size_t teamSize;
132 
137  const double lowThreshold;
138 
143  const double highThreshold;
144 
150 
156 
158  bool winner;
159 
160  public:
165  static unsigned numInstances;
166 
167  DuelingMonitor(std::size_t constituency_size, std::size_t team_size = 1,
168  unsigned num_bits = 10, double low_threshold = 0.5,
169  double high_threshold = 0.5);
170  ~DuelingMonitor() = default;
171 
178  void sample(const Dueler* dueler);
179 
188  bool isSample(const Dueler* dueler, bool& team) const;
189 
195  bool getWinner() const;
196 
204  void initEntry(Dueler* dueler);
205 };
206 
207 } // namespace gem5
208 
209 #endif // __BASE_DUELING_HH__
gem5::DuelingMonitor::lowThreshold
const double lowThreshold
If the winning team was "True", and the counter is decreased further than this threshold,...
Definition: dueling.hh:137
gem5::Dueler::setSample
void setSample(uint64_t id, bool team)
Make this entry a sampling entry for a specific Dueling instance.
Definition: dueling.cc:45
gem5::Dueler::_team
uint64_t _team
If entry is a sample, it belongs to one of two possible teams.
Definition: dueling.hh:67
gem5::DuelingMonitor::initEntry
void initEntry(Dueler *dueler)
Initialize a dueler entry, deciding wether it is a sample or not.
Definition: dueling.cc:124
gem5::Dueler::isSample
bool isSample(uint64_t id, bool &team) const
Check if entry is a sample for the given instance.
Definition: dueling.cc:57
gem5::DuelingMonitor::DuelingMonitor
DuelingMonitor(std::size_t constituency_size, std::size_t team_size=1, unsigned num_bits=10, double low_threshold=0.5, double high_threshold=0.5)
Definition: dueling.cc:63
gem5::DuelingMonitor::selector
SatCounter32 selector
Counter that determines which dueler is winning.
Definition: dueling.hh:149
gem5::Dueler::_isSample
uint64_t _isSample
Whether this entry is a sample or a follower.
Definition: dueling.hh:61
sat_counter.hh
gem5::DuelingMonitor::numInstances
static unsigned numInstances
Number of times this class has been instantiated.
Definition: dueling.hh:165
gem5::GenericSatCounter< uint32_t >
gem5::Dueler::~Dueler
virtual ~Dueler()=default
gem5::DuelingMonitor::getWinner
bool getWinner() const
Get the team that is currently winning the duel.
Definition: dueling.cc:118
gem5::DuelingMonitor::id
const uint64_t id
Unique identifier of this instance.
Definition: dueling.hh:121
gem5::DuelingMonitor::constituencySize
const std::size_t constituencySize
Given a table containing X entries, a constituency is a region of the table such that it contains X/c...
Definition: dueling.hh:128
gem5::DuelingMonitor::teamSize
const std::size_t teamSize
Number of entries that belong to each team within a constituency.
Definition: dueling.hh:131
gem5::DuelingMonitor::regionCounter
int regionCounter
Counts the number of entries have been initialized in the current constituency.
Definition: dueling.hh:155
gem5::DuelingMonitor::highThreshold
const double highThreshold
If the winning team was "False", and the counter is increased further than this threshold,...
Definition: dueling.hh:143
gem5::DuelingMonitor::~DuelingMonitor
~DuelingMonitor()=default
gem5::DuelingMonitor::NUM_DUELERS
const int NUM_DUELERS
Definition: dueling.hh:112
gem5::Dueler::Dueler
Dueler()
By default initializes entries as followers.
Definition: dueling.cc:39
gem5::DuelingMonitor::isSample
bool isSample(const Dueler *dueler, bool &team) const
Check if the given dueler is a sample for this instance.
Definition: dueling.cc:112
gem5::Dueler
A dueler is an entry that may or may not be accounted for sampling.
Definition: dueling.hh:52
gem5::DuelingMonitor::sample
void sample(const Dueler *dueler)
If given dueler is a sampling entry, sample it and check if the winning team must be updated.
Definition: dueling.cc:91
gem5::DuelingMonitor::winner
bool winner
The team that is currently winning.
Definition: dueling.hh:158
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::DuelingMonitor
Duel between two sampled options to determine which is the winner.
Definition: dueling.hh:107

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