gem5  v22.1.0.0
replaceable_entry.hh
Go to the documentation of this file.
1 
29 #ifndef __MEM_CACHE_REPLACEMENT_POLICIES_REPLACEABLE_ENTRY_HH__
30 #define __MEM_CACHE_REPLACEMENT_POLICIES_REPLACEABLE_ENTRY_HH__
31 
32 #include <cstdint>
33 #include <memory>
34 
35 #include "base/compiler.hh"
36 #include "base/cprintf.hh"
37 
38 namespace gem5
39 {
40 
41 GEM5_DEPRECATED_NAMESPACE(ReplacementPolicy, replacement_policy);
42 namespace replacement_policy
43 {
44 
49 struct ReplacementData {};
50 
51 } // namespace replacement_policy
52 
64 {
65  protected:
69  uint32_t _set;
70 
74  uint32_t _way;
75 
76  public:
77  ReplaceableEntry() = default;
78  virtual ~ReplaceableEntry() = default;
79 
84  std::shared_ptr<replacement_policy::ReplacementData> replacementData;
85 
92  virtual void
93  setPosition(const uint32_t set, const uint32_t way)
94  {
95  _set = set;
96  _way = way;
97  }
98 
104  uint32_t getSet() const { return _set; }
105 
111  uint32_t getWay() const { return _way; }
112 
118  virtual std::string
119  print() const
120  {
121  return csprintf("set: %#x way: %#x", getSet(), getWay());
122  }
123 };
124 
125 } // namespace gem5
126 
127 #endif // __MEM_CACHE_REPLACEMENT_POLICIES_REPLACEABLE_ENTRY_HH_
A replaceable entry is a basic entry in a 2d table-like structure that needs to have replacement func...
std::shared_ptr< replacement_policy::ReplacementData > replacementData
Replacement data associated to this entry.
virtual ~ReplaceableEntry()=default
uint32_t getWay() const
Get way number.
uint32_t _set
Set to which this entry belongs.
uint32_t getSet() const
Get set number.
virtual void setPosition(const uint32_t set, const uint32_t way)
Set both the set and way.
virtual std::string print() const
Prints relevant information about this entry.
uint32_t _way
Way (relative position within the set) to which this entry belongs.
Bitfield< 12, 11 > set
Definition: misc_types.hh:709
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:161
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
The replacement data needed by replacement policies.

Generated on Wed Dec 21 2022 10:22:36 for gem5 by doxygen 1.9.1