gem5 v24.0.0.0
Loading...
Searching...
No Matches
associative_set_impl.hh
Go to the documentation of this file.
1
29#ifndef __CACHE_PREFETCH_ASSOCIATIVE_SET_IMPL_HH__
30#define __CACHE_PREFETCH_ASSOCIATIVE_SET_IMPL_HH__
31
32#include "base/intmath.hh"
34
35namespace gem5
36{
37
38template <class Entry>
40 const size_t num_entries,
41 const size_t associativity_,
42 replacement_policy::Base *repl_policy,
43 BaseIndexingPolicy *indexing_policy,
44 Entry const &init_val)
45 : AssociativeCache<Entry>(name, num_entries, associativity_,
46 repl_policy, indexing_policy, init_val)
47{
48}
49
50template <class Entry>
51Entry*
53{
54 Addr tag = indexingPolicy->extractTag(addr);
55 auto candidates = indexingPolicy->getPossibleEntries(addr);
56
57 for (auto candidate : candidates) {
58 Entry* entry = static_cast<Entry*>(candidate);
59 if (entry->matchTag(tag, is_secure)) {
60 return entry;
61 }
62 }
63
64 return nullptr;
65}
66
67template<class Entry>
68void
69AssociativeSet<Entry>::insertEntry(Addr addr, bool is_secure, Entry* entry)
70{
71 entry->insert(indexingPolicy->extractTag(addr), is_secure);
72 replPolicy->reset(entry->replacementData);
73}
74
75} // namespace gem5
76
77#endif//__CACHE_PREFETCH_ASSOCIATIVE_SET_IMPL_HH__
void insertEntry(Addr addr, bool is_secure, Entry *entry)
Indicate that an entry has just been inserted.
AssociativeSet(const char *name, const size_t num_entries, const size_t associativity_, replacement_policy::Base *repl_policy, BaseIndexingPolicy *indexing_policy, Entry const &init_val=Entry())
Public constructor.
Entry * findEntry(Addr addr, bool is_secure) const
Find an entry within the set.
A common base class for indexing table locations.
Definition base.hh:67
A common base class of cache replacement policy objects.
Definition base.hh:55
Bitfield< 3 > addr
Definition types.hh:84
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
const std::string & name()
Definition trace.cc:48

Generated on Tue Jun 18 2024 16:24:05 for gem5 by doxygen 1.11.0