gem5  v22.1.0.0
Public Types | Public Member Functions | Private Attributes | List of all members
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>

Public Types

using const_iterator = typename std::vector< Entry >::const_iterator
 Iterator types. More...
 
using iterator = typename std::vector< Entry >::iterator
 

Public Member Functions

 AssociativeSet (int assoc, int num_entries, BaseIndexingPolicy *idx_policy, replacement_policy::Base *rpl_policy, Entry const &init_val=Entry())
 Public constructor. More...
 
Entry * findEntry (Addr addr, bool is_secure) const
 Find an entry within the set. More...
 
void accessEntry (Entry *entry)
 Do an access to the entry, this is required to update the replacement information data. More...
 
Entry * findVictim (Addr addr)
 Find a victim to be replaced. More...
 
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. More...
 
void insertEntry (Addr addr, bool is_secure, Entry *entry)
 Indicate that an entry has just been inserted. More...
 
void invalidate (Entry *entry)
 Invalidate an entry and its respective replacement data. More...
 
iterator begin ()
 Returns an iterator to the first entry of the dictionary. More...
 
iterator end ()
 Returns an iterator pointing to the end of the the dictionary (placeholder element, should not be accessed) More...
 
const_iterator begin () const
 Returns an iterator to the first entry of the dictionary. More...
 
const_iterator end () const
 Returns an iterator pointing to the end of the the dictionary (placeholder element, should not be accessed) More...
 

Private Attributes

const int associativity
 Associativity of the container. More...
 
const int numEntries
 Total number of entries, entries are organized in sets of the provided associativity. More...
 
BaseIndexingPolicy *const indexingPolicy
 Pointer to the indexing policy. More...
 
replacement_policy::Base *const replacementPolicy
 Pointer to the replacement policy. More...
 
std::vector< Entry > entries
 Vector containing the entries of the container. More...
 

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 45 of file associative_set.hh.

Member Typedef Documentation

◆ const_iterator

template<class Entry >
using gem5::AssociativeSet< Entry >::const_iterator = typename std::vector<Entry>::const_iterator

Iterator types.

Definition at line 125 of file associative_set.hh.

◆ iterator

template<class Entry >
using gem5::AssociativeSet< Entry >::iterator = typename std::vector<Entry>::iterator

Definition at line 126 of file associative_set.hh.

Constructor & Destructor Documentation

◆ AssociativeSet()

template<class Entry >
gem5::AssociativeSet< Entry >::AssociativeSet ( int  assoc,
int  num_entries,
BaseIndexingPolicy idx_policy,
replacement_policy::Base rpl_policy,
Entry const &  init_val = Entry() 
)

Public constructor.

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

Definition at line 39 of file associative_set_impl.hh.

References gem5::AssociativeSet< Entry >::entries, gem5::auxv::Entry, fatal_if, gem5::AssociativeSet< Entry >::indexingPolicy, gem5::replacement_policy::Base::instantiateEntry(), gem5::isPowerOf2(), gem5::AssociativeSet< Entry >::numEntries, gem5::AssociativeSet< Entry >::replacementPolicy, and gem5::BaseIndexingPolicy::setEntry().

Member Function Documentation

◆ accessEntry()

template<class Entry >
void gem5::AssociativeSet< Entry >::accessEntry ( Entry *  entry)

Do an access to the entry, this is required to update the replacement information data.

Parameters
entrythe accessed entry

Definition at line 76 of file associative_set_impl.hh.

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

◆ begin() [1/2]

template<class Entry >
iterator gem5::AssociativeSet< Entry >::begin ( )
inline

Returns an iterator to the first entry of the dictionary.

Returns
iterator to the first element

Definition at line 132 of file associative_set.hh.

References gem5::AssociativeSet< Entry >::entries.

◆ begin() [2/2]

template<class Entry >
const_iterator gem5::AssociativeSet< Entry >::begin ( ) const
inline

Returns an iterator to the first entry of the dictionary.

Returns
iterator to the first element

Definition at line 151 of file associative_set.hh.

References gem5::AssociativeSet< Entry >::entries.

◆ end() [1/2]

template<class Entry >
iterator gem5::AssociativeSet< Entry >::end ( )
inline

Returns an iterator pointing to the end of the the dictionary (placeholder element, should not be accessed)

Returns
iterator to the end element

Definition at line 142 of file associative_set.hh.

References gem5::AssociativeSet< Entry >::entries.

◆ end() [2/2]

template<class Entry >
const_iterator gem5::AssociativeSet< Entry >::end ( ) const
inline

Returns an iterator pointing to the end of the the dictionary (placeholder element, should not be accessed)

Returns
iterator to the end element

Definition at line 161 of file associative_set.hh.

References gem5::AssociativeSet< Entry >::entries.

◆ 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 58 of file associative_set_impl.hh.

References gem5::X86ISA::addr, and gem5::auxv::Entry.

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

◆ findVictim()

template<class Entry >
Entry * gem5::AssociativeSet< Entry >::findVictim ( Addr  addr)

Find a victim to be replaced.

Parameters
addrkey to select the possible victim
Returns
entry to be victimized

Definition at line 83 of file associative_set_impl.hh.

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

◆ getPossibleEntries()

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

Parameters
addrkey to select the set of entries
Returns
vector of candidates matching with the provided key

Definition at line 98 of file associative_set_impl.hh.

◆ 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 113 of file associative_set_impl.hh.

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

◆ invalidate()

template<class Entry >
void gem5::AssociativeSet< Entry >::invalidate ( Entry *  entry)

Invalidate an entry and its respective replacement data.

Parameters
entryEntry to be invalidated.

Definition at line 121 of file associative_set_impl.hh.

Member Data Documentation

◆ associativity

template<class Entry >
const int gem5::AssociativeSet< Entry >::associativity
private

Associativity of the container.

Definition at line 51 of file associative_set.hh.

◆ entries

template<class Entry >
std::vector<Entry> gem5::AssociativeSet< Entry >::entries
private

Vector containing the entries of the container.

Definition at line 63 of file associative_set.hh.

Referenced by gem5::AssociativeSet< Entry >::AssociativeSet(), gem5::AssociativeSet< Entry >::begin(), and gem5::AssociativeSet< Entry >::end().

◆ indexingPolicy

template<class Entry >
BaseIndexingPolicy* const gem5::AssociativeSet< Entry >::indexingPolicy
private

Pointer to the indexing policy.

Definition at line 59 of file associative_set.hh.

Referenced by gem5::AssociativeSet< Entry >::AssociativeSet().

◆ numEntries

template<class Entry >
const int gem5::AssociativeSet< Entry >::numEntries
private

Total number of entries, entries are organized in sets of the provided associativity.

The number of associative sets is obtained by dividing numEntries by associativity.

Definition at line 57 of file associative_set.hh.

Referenced by gem5::AssociativeSet< Entry >::AssociativeSet().

◆ replacementPolicy

template<class Entry >
replacement_policy::Base* const gem5::AssociativeSet< Entry >::replacementPolicy
private

Pointer to the replacement policy.

Definition at line 61 of file associative_set.hh.

Referenced by gem5::AssociativeSet< Entry >::AssociativeSet().


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

Generated on Wed Dec 21 2022 10:23:26 for gem5 by doxygen 1.9.1