gem5  v21.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 
44 {
45  public:
46  TaggedEntry() : _valid(false), _secure(false), _tag(MaxAddr) {}
47  ~TaggedEntry() = default;
48 
54  virtual bool isValid() const { return _valid; }
55 
61  bool isSecure() const { return _secure; }
62 
68  virtual Addr getTag() const { return _tag; }
69 
77  virtual bool
78  matchTag(Addr tag, bool is_secure) const
79  {
80  return isValid() && (getTag() == tag) && (isSecure() == is_secure);
81  }
82 
89  virtual void
90  insert(const Addr tag, const bool is_secure)
91  {
92  setValid();
93  setTag(tag);
94  if (is_secure) {
95  setSecure();
96  }
97  }
98 
100  virtual void invalidate()
101  {
102  _valid = false;
103  setTag(MaxAddr);
104  clearSecure();
105  }
106 
107  std::string
108  print() const override
109  {
110  return csprintf("tag: %#x secure: %d valid: %d | %s", getTag(),
112  }
113 
114  protected:
120  virtual void setTag(Addr tag) { _tag = tag; }
121 
123  virtual void setSecure() { _secure = true; }
124 
126  virtual void
128  {
129  assert(!isValid());
130  _valid = true;
131  }
132 
133  private:
139  bool _valid;
140 
145  bool _secure;
146 
149 
151  void clearSecure() { _secure = false; }
152 };
153 
154 #endif//__CACHE_TAGGED_ENTRY_HH__
TaggedEntry::print
std::string print() const override
Prints relevant information about this entry.
Definition: tagged_entry.hh:108
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
TaggedEntry::insert
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:90
TaggedEntry::clearSecure
void clearSecure()
Clear secure bit.
Definition: tagged_entry.hh:151
TaggedEntry
Copyright (c) 2020 Inria All rights reserved.
Definition: tagged_entry.hh:43
TaggedEntry::matchTag
virtual bool matchTag(Addr tag, bool is_secure) const
Checks if the given tag information corresponds to this entry's.
Definition: tagged_entry.hh:78
TaggedEntry::_valid
bool _valid
Valid bit.
Definition: tagged_entry.hh:139
MaxAddr
const Addr MaxAddr
Definition: types.hh:172
replaceable_entry.hh
TaggedEntry::_secure
bool _secure
Secure bit.
Definition: tagged_entry.hh:145
TaggedEntry::setSecure
virtual void setSecure()
Set secure bit.
Definition: tagged_entry.hh:123
TaggedEntry::isSecure
bool isSecure() const
Check if this block holds data from the secure memory space.
Definition: tagged_entry.hh:61
cprintf.hh
TaggedEntry::isValid
virtual bool isValid() const
Checks if the entry is valid.
Definition: tagged_entry.hh:54
TaggedEntry::TaggedEntry
TaggedEntry()
Definition: tagged_entry.hh:46
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:148
TaggedEntry::setTag
virtual void setTag(Addr tag)
Set tag associated to this block.
Definition: tagged_entry.hh:120
TaggedEntry::_tag
Addr _tag
The entry's tag.
Definition: tagged_entry.hh:148
TaggedEntry::invalidate
virtual void invalidate()
Invalidate the block.
Definition: tagged_entry.hh:100
types.hh
TaggedEntry::getTag
virtual Addr getTag() const
Get tag associated to this block.
Definition: tagged_entry.hh:68
csprintf
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:158
TaggedEntry::setValid
virtual void setValid()
Set valid bit.
Definition: tagged_entry.hh:127
TaggedEntry::~TaggedEntry
~TaggedEntry()=default

Generated on Tue Mar 23 2021 19:41:27 for gem5 by doxygen 1.8.17