gem5 v24.0.0.0
|
#include <associative_cache.hh>
Public Types | |
using | const_iterator = typename std::vector<Entry>::const_iterator |
Iterator types. | |
using | iterator = typename std::vector<Entry>::iterator |
Public Member Functions | |
AssociativeCache (const char *name) | |
Empty constructor - need to call init() later with all args. | |
AssociativeCache (const char *name, const size_t num_entries, const size_t associativity_, BaseReplacementPolicy *repl_policy, BaseIndexingPolicy *indexing_policy, Entry const &init_val=Entry()) | |
Public constructor. | |
~AssociativeCache ()=default | |
Default destructor. | |
AssociativeCache (const AssociativeCache &)=delete | |
Disable copy and assignment. | |
AssociativeCache & | operator= (const AssociativeCache &)=delete |
void | clear () |
Clear the entries in the cache. | |
void | init (const size_t num_entries, const size_t associativity_, BaseReplacementPolicy *_repl_policy, BaseIndexingPolicy *_indexing_policy, Entry const &init_val=Entry()) |
virtual Addr | getTag (const Addr addr) const |
Get the tag for the addr. | |
virtual Entry * | accessEntryByAddr (const Addr addr) |
Do an access to the entry if it exists. | |
virtual void | accessEntry (Entry *entry) |
Update the replacement information for an entry. | |
virtual Entry * | findEntry (const Addr addr) const |
Find an entry within the set. | |
virtual Entry * | findVictim (const Addr addr) |
Find a victim to be replaced. | |
virtual void | invalidate (Entry *entry) |
Invalidate an entry and its respective replacement data. | |
virtual void | insertEntry (const Addr addr, Entry *entry) |
Indicate that an entry has just been inserted. | |
std::vector< Entry * > | getPossibleEntries (const Addr addr) const |
Find the set of entries that could be replaced given that we want to add a new entry with the provided key. | |
iterator | begin () |
Returns an iterator to the first entry of the dictionary. | |
iterator | end () |
Returns an iterator pointing to the end of the the dictionary (placeholder element, should not be accessed) | |
const_iterator | begin () const |
Returns an iterator to the first entry of the dictionary. | |
const_iterator | end () const |
Returns an iterator pointing to the end of the the dictionary (placeholder element, should not be accessed) | |
Public Member Functions inherited from gem5::Named | |
Named (const std::string &name_) | |
virtual | ~Named ()=default |
virtual std::string | name () const |
Protected Attributes | |
size_t | associativity |
Associativity of the cache. | |
BaseReplacementPolicy * | replPolicy |
The replacement policy of the cache. | |
BaseIndexingPolicy * | indexingPolicy |
Indexing policy of the cache. | |
std::vector< Entry > | entries |
The entries. | |
Private Types | |
typedef replacement_policy::Base | BaseReplacementPolicy |
Private Member Functions | |
void | initParams (size_t _num_entries, size_t _assoc) |
Definition at line 49 of file associative_cache.hh.
|
private |
Definition at line 54 of file associative_cache.hh.
using gem5::AssociativeCache< Entry >::const_iterator = typename std::vector<Entry>::const_iterator |
Iterator types.
Definition at line 277 of file associative_cache.hh.
using gem5::AssociativeCache< Entry >::iterator = typename std::vector<Entry>::iterator |
Definition at line 278 of file associative_cache.hh.
|
inline |
Empty constructor - need to call init() later with all args.
Definition at line 89 of file associative_cache.hh.
|
inline |
Public constructor.
name | Name of the cache |
num_entries | total number of entries of the container, the number of sets can be calculated dividing this balue by the 'assoc' value |
associativity | number of elements in each associative set |
repl_policy | replacement policy |
indexing_policy | indexing policy |
Definition at line 100 of file associative_cache.hh.
References gem5::AssociativeCache< Entry >::associativity, and gem5::AssociativeCache< Entry >::initParams().
|
default |
Default destructor.
|
delete |
Disable copy and assignment.
|
inlinevirtual |
Update the replacement information for an entry.
Entry | to access and upate |
Definition at line 185 of file associative_cache.hh.
References gem5::AssociativeCache< Entry >::replPolicy, and gem5::replacement_policy::Base::touch().
Referenced by gem5::AssociativeCache< Entry >::accessEntryByAddr(), and gem5::prefetch::Stride::calculatePrefetch().
|
inlinevirtual |
Do an access to the entry if it exists.
This is required to update the replacement information data.
addr | key to the entry |
Definition at line 169 of file associative_cache.hh.
References gem5::AssociativeCache< Entry >::accessEntry(), gem5::X86ISA::addr, and gem5::AssociativeCache< Entry >::findEntry().
|
inline |
Returns an iterator to the first entry of the dictionary.
Definition at line 285 of file associative_cache.hh.
References gem5::AssociativeCache< Entry >::entries.
|
inline |
Returns an iterator to the first entry of the dictionary.
Definition at line 306 of file associative_cache.hh.
References gem5::AssociativeCache< Entry >::entries.
|
inline |
Clear the entries in the cache.
Definition at line 129 of file associative_cache.hh.
References gem5::AssociativeCache< Entry >::entries, and gem5::AssociativeCache< Entry >::invalidate().
|
inline |
Returns an iterator pointing to the end of the the dictionary (placeholder element, should not be accessed)
Definition at line 296 of file associative_cache.hh.
References gem5::AssociativeCache< Entry >::entries.
|
inline |
Returns an iterator pointing to the end of the the dictionary (placeholder element, should not be accessed)
Definition at line 317 of file associative_cache.hh.
References gem5::AssociativeCache< Entry >::entries.
|
inlinevirtual |
Find an entry within the set.
addr | key element |
Definition at line 197 of file associative_cache.hh.
References gem5::X86ISA::addr, gem5::BaseIndexingPolicy::getPossibleEntries(), gem5::AssociativeCache< Entry >::getTag(), and gem5::AssociativeCache< Entry >::indexingPolicy.
Referenced by gem5::AssociativeCache< Entry >::accessEntryByAddr().
|
inlinevirtual |
Find a victim to be replaced.
addr | key to select the possible victim |
Definition at line 219 of file associative_cache.hh.
References gem5::X86ISA::addr, gem5::BaseIndexingPolicy::getPossibleEntries(), gem5::replacement_policy::Base::getVictim(), gem5::AssociativeCache< Entry >::indexingPolicy, gem5::AssociativeCache< Entry >::invalidate(), and gem5::AssociativeCache< Entry >::replPolicy.
Referenced by gem5::prefetch::Stride::calculatePrefetch().
|
inline |
Find the set of entries that could be replaced given that we want to add a new entry with the provided key.
addr | key to select the set of entries |
Definition at line 261 of file associative_cache.hh.
References gem5::X86ISA::addr, gem5::AssociativeCache< Entry >::entries, gem5::BaseIndexingPolicy::getPossibleEntries(), and gem5::AssociativeCache< Entry >::indexingPolicy.
|
inlinevirtual |
Get the tag for the addr.
addr | Addr to get the tag for |
Definition at line 157 of file associative_cache.hh.
References gem5::X86ISA::addr, gem5::BaseIndexingPolicy::extractTag(), and gem5::AssociativeCache< Entry >::indexingPolicy.
Referenced by gem5::AssociativeCache< Entry >::findEntry().
|
inline |
|
inlineprivate |
Definition at line 73 of file associative_cache.hh.
References gem5::AssociativeCache< Entry >::entries, fatal_if, gem5::AssociativeCache< Entry >::indexingPolicy, gem5::replacement_policy::Base::instantiateEntry(), gem5::AssociativeCache< Entry >::replPolicy, and gem5::BaseIndexingPolicy::setEntry().
Referenced by gem5::AssociativeCache< Entry >::AssociativeCache(), and gem5::AssociativeCache< Entry >::init().
|
inlinevirtual |
Indicate that an entry has just been inserted.
addr | key of the container |
entry | pointer to the container entry to be inserted |
Definition at line 248 of file associative_cache.hh.
References gem5::X86ISA::addr, gem5::BaseIndexingPolicy::extractTag(), gem5::AssociativeCache< Entry >::indexingPolicy, gem5::AssociativeCache< Entry >::replPolicy, and gem5::replacement_policy::Base::reset().
|
inlinevirtual |
Invalidate an entry and its respective replacement data.
entry | Entry to be invalidated. |
Definition at line 236 of file associative_cache.hh.
References gem5::replacement_policy::Base::invalidate(), and gem5::AssociativeCache< Entry >::replPolicy.
Referenced by gem5::AssociativeCache< Entry >::clear(), and gem5::AssociativeCache< Entry >::findVictim().
|
delete |
|
protected |
Associativity of the cache.
Definition at line 59 of file associative_cache.hh.
Referenced by gem5::AssociativeCache< Entry >::AssociativeCache(), and gem5::AssociativeCache< Entry >::init().
|
protected |
The entries.
Definition at line 68 of file associative_cache.hh.
Referenced by gem5::AssociativeCache< Entry >::begin(), gem5::AssociativeCache< Entry >::begin(), gem5::AssociativeCache< Entry >::clear(), gem5::AssociativeCache< Entry >::end(), gem5::AssociativeCache< Entry >::end(), gem5::AssociativeCache< Entry >::getPossibleEntries(), gem5::AssociativeCache< Entry >::init(), and gem5::AssociativeCache< Entry >::initParams().
|
protected |
Indexing policy of the cache.
Definition at line 65 of file associative_cache.hh.
Referenced by gem5::AssociativeCache< Entry >::findEntry(), gem5::AssociativeCache< Entry >::findVictim(), gem5::AssociativeCache< Entry >::getPossibleEntries(), gem5::AssociativeCache< Entry >::getTag(), gem5::AssociativeCache< Entry >::init(), gem5::AssociativeCache< Entry >::initParams(), and gem5::AssociativeCache< Entry >::insertEntry().
|
protected |
The replacement policy of the cache.
Definition at line 62 of file associative_cache.hh.
Referenced by gem5::AssociativeCache< Entry >::accessEntry(), gem5::AssociativeCache< Entry >::findVictim(), gem5::AssociativeCache< Entry >::init(), gem5::AssociativeCache< Entry >::initParams(), gem5::AssociativeCache< Entry >::insertEntry(), and gem5::AssociativeCache< Entry >::invalidate().