gem5  v20.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/cprintf.hh"
36 
41 struct ReplacementData {};
42 
54 {
55  protected:
59  uint32_t _set;
60 
64  uint32_t _way;
65 
66  public:
67  ReplaceableEntry() = default;
68  virtual ~ReplaceableEntry() = default;
69 
74  std::shared_ptr<ReplacementData> replacementData;
75 
82  virtual void
83  setPosition(const uint32_t set, const uint32_t way)
84  {
85  _set = set;
86  _way = way;
87  }
88 
94  uint32_t getSet() const { return _set; }
95 
101  uint32_t getWay() const { return _way; }
102 
108  virtual std::string
109  print() const
110  {
111  return csprintf("set: %#x way: %#x", getSet(), getWay());
112  }
113 };
114 
115 #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:53
ReplaceableEntry::print
virtual std::string print() const
Prints relevant information about this entry.
Definition: replaceable_entry.hh:109
ReplaceableEntry::_set
uint32_t _set
Set to which this entry belongs.
Definition: replaceable_entry.hh:59
ReplaceableEntry::_way
uint32_t _way
Way (relative position within the set) to which this entry belongs.
Definition: replaceable_entry.hh:64
ReplaceableEntry::~ReplaceableEntry
virtual ~ReplaceableEntry()=default
ReplaceableEntry::getSet
uint32_t getSet() const
Get set number.
Definition: replaceable_entry.hh:94
ReplacementData
Copyright (c) 2018 Inria All rights reserved.
Definition: replaceable_entry.hh:41
ReplaceableEntry::ReplaceableEntry
ReplaceableEntry()=default
ReplaceableEntry::setPosition
virtual void setPosition(const uint32_t set, const uint32_t way)
Set both the set and way.
Definition: replaceable_entry.hh:83
cprintf.hh
ReplaceableEntry::replacementData
std::shared_ptr< ReplacementData > replacementData
Replacement data associated to this entry.
Definition: replaceable_entry.hh:74
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:101

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