gem5 v24.0.0.0
Loading...
Searching...
No Matches
gem5::AssociativeSet< Entry > Class Template Reference

Associative container based on the previosuly defined Entry type Each element is indexed by a key of type Addr, an additional bool value is used as an additional tag data of the entry. More...

#include <associative_set.hh>

Inheritance diagram for gem5::AssociativeSet< Entry >:
gem5::AssociativeCache< Entry > gem5::Named

Public Member Functions

 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.
 
void insertEntry (Addr addr, bool is_secure, Entry *entry)
 Indicate that an entry has just been inserted.
 
- Public Member Functions inherited from gem5::AssociativeCache< Entry >
 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.
 
AssociativeCacheoperator= (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
 

Additional Inherited Members

- Public Types inherited from gem5::AssociativeCache< Entry >
using const_iterator = typename std::vector<Entry>::const_iterator
 Iterator types.
 
using iterator = typename std::vector<Entry>::iterator
 
- Protected Attributes inherited from gem5::AssociativeCache< Entry >
size_t associativity
 Associativity of the cache.
 
BaseReplacementPolicyreplPolicy
 The replacement policy of the cache.
 
BaseIndexingPolicyindexingPolicy
 Indexing policy of the cache.
 
std::vector< Entry > entries
 The entries.
 

Detailed Description

template<class Entry>
class gem5::AssociativeSet< Entry >

Associative container based on the previosuly defined Entry type Each element is indexed by a key of type Addr, an additional bool value is used as an additional tag data of the entry.

Definition at line 48 of file associative_set.hh.

Constructor & Destructor Documentation

◆ AssociativeSet()

template<class Entry >
gem5::AssociativeSet< Entry >::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.

Parameters
nameName of the cache
num_entriestotal number of entries of the container, the number of sets can be calculated dividing this balue by the 'assoc' value
assocnumber of elements in each associative set
rpl_policyreplacement policy
idx_policyindexing policy
init_valinitial value of the elements of the set

Definition at line 39 of file associative_set_impl.hh.

Member Function Documentation

◆ findEntry()

template<class Entry >
Entry * gem5::AssociativeSet< Entry >::findEntry ( Addr addr,
bool is_secure ) const

Find an entry within the set.

Parameters
addrkey element
is_securetag element
Returns
returns a pointer to the wanted entry or nullptr if it does not exist.

Definition at line 52 of file associative_set_impl.hh.

References gem5::X86ISA::addr.

Referenced by gem5::prefetch::Stride::calculatePrefetch().

◆ insertEntry()

template<class Entry >
void gem5::AssociativeSet< Entry >::insertEntry ( Addr addr,
bool is_secure,
Entry * entry )

Indicate that an entry has just been inserted.

Parameters
addrkey of the container
is_securetag component of the container
entrypointer to the container entry to be inserted

Definition at line 69 of file associative_set_impl.hh.

References gem5::X86ISA::addr.

Referenced by gem5::prefetch::Stride::calculatePrefetch().


The documentation for this class was generated from the following files:

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