gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
pc_count_pair.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met: redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef __PC_COUNT_PAIR_HH__
30 #define __PC_COUNT_PAIR_HH__
31 
32 #include "base/types.hh"
33 
34 namespace gem5
35 {
36 
38 {
39 
40  private:
41 
45  int count;
46 
47  public:
48 
50  explicit constexpr PcCountPair(Addr _pc, int _count) :
51  pc(_pc), count(_count) {}
52 
54  PcCountPair() : pc(0), count(0) {}
55 
57  constexpr Addr getPC() const { return pc; }
59  constexpr int getCount() const { return count; }
60 
62  constexpr bool
63  operator>(const PcCountPair& cc) const
64  {
65  return count > cc.getCount();
66  }
67 
69  constexpr bool
70  operator==(const PcCountPair& cc) const
71  {
72  return (pc == cc.getPC() && count == cc.getCount());
73  }
74 
76  std::string
77  to_string() const
78  {
79  std::string s = "(" + std::to_string(pc)
80  + "," + std::to_string(count) + ")";
81  return s;
82  }
83 
85  struct HashFunction
86  {
87  size_t operator()(const PcCountPair& item) const
88  {
89  size_t xHash = std::hash<int>()(item.pc);
90  size_t yHash = std::hash<int>()(item.count);
91  return xHash * 2 + yHash;
92  }
93  };
94 
95 };
96 
97 } // namespace gem5
98 
99 #endif // __PC_COUNT_PAIR_HH__
gem5::VegaISA::s
Bitfield< 1 > s
Definition: pagetable.hh:64
gem5::PcCountPair::to_string
std::string to_string() const
String format.
Definition: pc_count_pair.hh:77
sc_dt::to_string
const std::string to_string(sc_enc enc)
Definition: sc_fxdefs.cc:91
gem5::PcCountPair::HashFunction::operator()
size_t operator()(const PcCountPair &item) const
Definition: pc_count_pair.hh:87
gem5::PcCountPair::pc
Addr pc
The Program Counter address.
Definition: pc_count_pair.hh:43
gem5::PcCountPair::operator==
constexpr bool operator==(const PcCountPair &cc) const
Equal comparison.
Definition: pc_count_pair.hh:70
gem5::PcCountPair::count
int count
The count of the Program Counter address.
Definition: pc_count_pair.hh:45
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::PcCountPair::PcCountPair
PcCountPair()
Default constructor for parameter classes.
Definition: pc_count_pair.hh:54
types.hh
gem5::PcCountPair::PcCountPair
constexpr PcCountPair(Addr _pc, int _count)
Explicit constructor assigning the pc and count values.
Definition: pc_count_pair.hh:50
gem5::PcCountPair::getPC
constexpr Addr getPC() const
Returns the Program Counter address.
Definition: pc_count_pair.hh:57
gem5::PcCountPair::getCount
constexpr int getCount() const
Returns the count of the Program.
Definition: pc_count_pair.hh:59
gem5::PcCountPair::HashFunction
Enable hashing for this parameter.
Definition: pc_count_pair.hh:85
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::PcCountPair::operator>
constexpr bool operator>(const PcCountPair &cc) const
Greater than comparison.
Definition: pc_count_pair.hh:63
gem5::PcCountPair
Definition: pc_count_pair.hh:37

Generated on Sun Jul 30 2023 01:56:53 for gem5 by doxygen 1.8.17