gem5  v21.1.0.2
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__
gem5::TaggedEntry::setTag
virtual void setTag(Addr tag)
Set tag associated to this block.
Definition: tagged_entry.hh:123
gem5::TaggedEntry::print
std::string print() const override
Prints relevant information about this entry.
Definition: tagged_entry.hh:111
gem5::TaggedEntry::~TaggedEntry
~TaggedEntry()=default
gem5::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:81
gem5::TaggedEntry::getTag
virtual Addr getTag() const
Get tag associated to this block.
Definition: tagged_entry.hh:71
gem5::csprintf
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:161
replaceable_entry.hh
gem5::TaggedEntry
A tagged entry is an entry containing a tag.
Definition: tagged_entry.hh:46
gem5::TaggedEntry::setSecure
virtual void setSecure()
Set secure bit.
Definition: tagged_entry.hh:126
gem5::MaxAddr
const Addr MaxAddr
Definition: types.hh:171
gem5::ReplaceableEntry::print
virtual std::string print() const
Prints relevant information about this entry.
Definition: replaceable_entry.hh:119
gem5::TaggedEntry::clearSecure
void clearSecure()
Clear secure bit.
Definition: tagged_entry.hh:154
cprintf.hh
gem5::TaggedEntry::invalidate
virtual void invalidate()
Invalidate the block.
Definition: tagged_entry.hh:103
gem5::TaggedEntry::_secure
bool _secure
Secure bit.
Definition: tagged_entry.hh:148
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::TaggedEntry::TaggedEntry
TaggedEntry()
Definition: tagged_entry.hh:49
gem5::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:93
types.hh
gem5::ReplaceableEntry
A replaceable entry is a basic entry in a 2d table-like structure that needs to have replacement func...
Definition: replaceable_entry.hh:63
gem5::TaggedEntry::isSecure
bool isSecure() const
Check if this block holds data from the secure memory space.
Definition: tagged_entry.hh:64
gem5::TaggedEntry::_valid
bool _valid
Valid bit.
Definition: tagged_entry.hh:142
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::TaggedEntry::setValid
virtual void setValid()
Set valid bit.
Definition: tagged_entry.hh:130
gem5::TaggedEntry::isValid
virtual bool isValid() const
Checks if the entry is valid.
Definition: tagged_entry.hh:57
gem5::TaggedEntry::_tag
Addr _tag
The entry's tag.
Definition: tagged_entry.hh:151

Generated on Tue Sep 21 2021 12:25:30 for gem5 by doxygen 1.8.17