gem5  v21.0.1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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/cprintf.hh"
36 
37 namespace ReplacementPolicy {
38 
43 struct ReplacementData {};
44 
45 } // namespace ReplacementPolicy
46 
58 {
59  protected:
63  uint32_t _set;
64 
68  uint32_t _way;
69 
70  public:
71  ReplaceableEntry() = default;
72  virtual ~ReplaceableEntry() = default;
73 
78  std::shared_ptr<ReplacementPolicy::ReplacementData> replacementData;
79 
86  virtual void
87  setPosition(const uint32_t set, const uint32_t way)
88  {
89  _set = set;
90  _way = way;
91  }
92 
98  uint32_t getSet() const { return _set; }
99 
105  uint32_t getWay() const { return _way; }
106 
112  virtual std::string
113  print() const
114  {
115  return csprintf("set: %#x way: %#x", getSet(), getWay());
116  }
117 };
118 
119 #endif // __MEM_CACHE_REPLACEMENT_POLICIES_REPLACEABLE_ENTRY_HH_
ReplaceableEntry
A replaceable entry is a basic entry in a 2d table-like structure that needs to have replacement func...
Definition: replaceable_entry.hh:57
ReplaceableEntry::print
virtual std::string print() const
Prints relevant information about this entry.
Definition: replaceable_entry.hh:113
ReplaceableEntry::_set
uint32_t _set
Set to which this entry belongs.
Definition: replaceable_entry.hh:63
ReplaceableEntry::_way
uint32_t _way
Way (relative position within the set) to which this entry belongs.
Definition: replaceable_entry.hh:68
ReplaceableEntry::~ReplaceableEntry
virtual ~ReplaceableEntry()=default
ReplaceableEntry::getSet
uint32_t getSet() const
Get set number.
Definition: replaceable_entry.hh:98
ReplaceableEntry::ReplaceableEntry
ReplaceableEntry()=default
ReplacementPolicy
Copyright (c) 2018-2020 Inria All rights reserved.
Definition: stride.hh:64
ReplacementPolicy::ReplacementData
The replacement data needed by replacement policies.
Definition: replaceable_entry.hh:43
ReplaceableEntry::setPosition
virtual void setPosition(const uint32_t set, const uint32_t way)
Set both the set and way.
Definition: replaceable_entry.hh:87
cprintf.hh
ReplaceableEntry::replacementData
std::shared_ptr< ReplacementPolicy::ReplacementData > replacementData
Replacement data associated to this entry.
Definition: replaceable_entry.hh:78
csprintf
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:158
ReplaceableEntry::getWay
uint32_t getWay() const
Get way number.
Definition: replaceable_entry.hh:105

Generated on Tue Jun 22 2021 15:28:29 for gem5 by doxygen 1.8.17