gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
associative_set.hh
Go to the documentation of this file.
1 
31 #ifndef __CACHE_PREFETCH_ASSOCIATIVE_SET_HH__
32 #define __CACHE_PREFETCH_ASSOCIATIVE_SET_HH__
33 
37 
41 class TaggedEntry : public ReplaceableEntry {
45  bool valid;
47  bool secure;
48  public:
49  TaggedEntry() : tag(0), valid(false), secure(false) {}
50  virtual ~TaggedEntry() {}
51 
56  bool isValid() const
57  {
58  return valid;
59  }
60 
64  void setValid()
65  {
66  valid = true;
67  }
68 
70  virtual void
72  {
73  valid = false;
74  }
75 
80  Addr getTag() const
81  {
82  return tag;
83  }
84 
89  void setTag(Addr t)
90  {
91  tag = t;
92  }
93 
98  bool isSecure() const
99  {
100  return secure;
101  }
102 
107  void setSecure(bool s)
108  {
109  secure = s;
110  }
111 };
112 
118 template<class Entry>
120  static_assert(std::is_base_of<TaggedEntry, Entry>::value,
121  "Entry must derive from TaggedEntry");
122 
124  const int associativity;
130  const int numEntries;
137 
138  public:
148  AssociativeSet(int assoc, int num_entries, BaseIndexingPolicy *idx_policy,
149  BaseReplacementPolicy *rpl_policy, Entry const &init_value =
150  Entry());
151 
159  Entry* findEntry(Addr addr, bool is_secure) const;
160 
166  void accessEntry(Entry *entry);
167 
173  Entry* findVictim(Addr addr);
174 
181  std::vector<Entry *> getPossibleEntries(const Addr addr) const;
182 
189  void insertEntry(Addr addr, bool is_secure, Entry* entry);
190 
196  void invalidate(Entry* entry);
197 
201 
207  {
208  return entries.begin();
209  }
210 
217  {
218  return entries.end();
219  }
220 
226  {
227  return entries.begin();
228  }
229 
236  {
237  return entries.end();
238  }
239 };
240 
241 #endif//__CACHE_PREFETCH_ASSOCIATIVE_SET_HH__
BaseIndexingPolicy *const indexingPolicy
Pointer to the indexing policy.
BaseReplacementPolicy *const replacementPolicy
Pointer to the replacement policy.
Addr getTag() const
Obtain the entry tag.
bool valid
Valid bit.
ip6_addr_t addr
Definition: inet.hh:335
std::vector< Entry > entries
Vector containing the entries of the container.
A common base class of cache replacement policy objects.
Definition: base.hh:48
bool secure
Whether this entry refers to a memory area in the secure space.
iterator end()
Returns an iterator pointing to the end of the the dictionary (placeholder element, should not be accessed)
typename std::vector< SignaturePathPrefetcher::SignatureEntry >::iterator iterator
Addr tag
Tag for the entry.
Bitfield< 4 > s
void setValid()
Sets the entry to valid.
bool isSecure() const
Consult if this entry refers to a memory in the secure area.
const_iterator begin() const
Returns an iterator to the first entry of the dictionary.
void setSecure(bool s)
Sets the secure value bit.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
Associative container based on the previosuly defined Entry type Each element is indexed by a key of ...
iterator begin()
Returns an iterator to the first entry of the dictionary.
bool isValid() const
Consult the valid bit.
A replaceable entry is a basic entry in a 2d table-like structure that needs to have replacement func...
Copyright (c) 2018 Metempsy Technology Consulting All rights reserved.
void setTag(Addr t)
Sets the tag of the entry.
A common base class for indexing table locations.
Definition: base.hh:66
virtual ~TaggedEntry()
Bitfield< 5 > t
virtual void invalidate()
Invalidates the entry.
typename std::vector< SignaturePathPrefetcher::SignatureEntry >::const_iterator const_iterator
Iterator types.
const int associativity
Associativity of the container.
Declaration of a common framework for indexing policies.
const int numEntries
Total number of entries, entries are organized in sets of the provided associativity.
const_iterator end() const
Returns an iterator pointing to the end of the the dictionary (placeholder element, should not be accessed)

Generated on Fri Feb 28 2020 16:27:01 for gem5 by doxygen 1.8.13