gem5  v22.1.0.0
tagged_entry.hh
Go to the documentation of this file.
1 
29 #ifndef __CACHE_TAGGED_ENTRY_HH__
30 #define __CACHE_TAGGED_ENTRY_HH__
31 
32 #include <cassert>
33 
34 #include "base/cprintf.hh"
35 #include "base/types.hh"
37 
38 namespace gem5
39 {
40 
47 {
48  public:
49  TaggedEntry() : _valid(false), _secure(false), _tag(MaxAddr) {}
50  ~TaggedEntry() = default;
51 
57  virtual bool isValid() const { return _valid; }
58 
64  bool isSecure() const { return _secure; }
65 
71  virtual Addr getTag() const { return _tag; }
72 
80  virtual bool
81  matchTag(Addr tag, bool is_secure) const
82  {
83  return isValid() && (getTag() == tag) && (isSecure() == is_secure);
84  }
85 
92  virtual void
93  insert(const Addr tag, const bool is_secure)
94  {
95  setValid();
96  setTag(tag);
97  if (is_secure) {
98  setSecure();
99  }
100  }
101 
103  virtual void invalidate()
104  {
105  _valid = false;
106  setTag(MaxAddr);
107  clearSecure();
108  }
109 
110  std::string
111  print() const override
112  {
113  return csprintf("tag: %#x secure: %d valid: %d | %s", getTag(),
115  }
116 
117  protected:
123  virtual void setTag(Addr tag) { _tag = tag; }
124 
126  virtual void setSecure() { _secure = true; }
127 
129  virtual void
131  {
132  assert(!isValid());
133  _valid = true;
134  }
135 
136  private:
142  bool _valid;
143 
148  bool _secure;
149 
152 
154  void clearSecure() { _secure = false; }
155 };
156 
157 } // namespace gem5
158 
159 #endif//__CACHE_TAGGED_ENTRY_HH__
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
A replaceable entry is a basic entry in a 2d table-like structure that needs to have replacement func...
virtual std::string print() const
Prints relevant information about this entry.
A tagged entry is an entry containing a tag.
Definition: tagged_entry.hh:47
virtual bool isValid() const
Checks if the entry is valid.
Definition: tagged_entry.hh:57
std::string print() const override
Prints relevant information about this entry.
void clearSecure()
Clear secure bit.
~TaggedEntry()=default
virtual void setTag(Addr tag)
Set tag associated to this block.
virtual void invalidate()
Invalidate the block.
virtual bool matchTag(Addr tag, bool is_secure) const
Checks if the given tag information corresponds to this entry's.
Definition: tagged_entry.hh:81
bool _valid
Valid bit.
virtual void insert(const Addr tag, const bool is_secure)
Insert the block by assigning it a tag and marking it valid.
Definition: tagged_entry.hh:93
bool isSecure() const
Check if this block holds data from the secure memory space.
Definition: tagged_entry.hh:64
Addr _tag
The entry's tag.
virtual Addr getTag() const
Get tag associated to this block.
Definition: tagged_entry.hh:71
bool _secure
Secure bit.
virtual void setValid()
Set valid bit.
virtual void setSecure()
Set secure bit.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:161
const Addr MaxAddr
Definition: types.hh:171

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