gem5  v20.1.0.0
Public Types | Public Member Functions | Private Attributes | List of all members
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, BaseReplacementPolicy *rpl_policy, Entry const &init_value=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...
 
BaseReplacementPolicy *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 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 117 of file associative_set.hh.

Member Typedef Documentation

◆ const_iterator

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

Iterator types.

Definition at line 197 of file associative_set.hh.

◆ iterator

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

Definition at line 198 of file associative_set.hh.

Constructor & Destructor Documentation

◆ AssociativeSet()

template<class Entry >
AssociativeSet< Entry >::AssociativeSet ( int  assoc,
int  num_entries,
BaseIndexingPolicy idx_policy,
BaseReplacementPolicy rpl_policy,
Entry const &  init_value = Entry() 
)

Public constructor.

Copyright (c) 2018 Metempsy Technology Consulting All rights reserved.

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
initialvalue of the elements of the set

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer; redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution; neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition at line 36 of file associative_set_impl.hh.

Member Function Documentation

◆ accessEntry()

template<class Entry >
void 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 73 of file associative_set_impl.hh.

Referenced by Prefetcher::Stride::calculatePrefetch().

◆ begin() [1/2]

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

Returns an iterator to the first entry of the dictionary.

Returns
iterator to the first element

Definition at line 204 of file associative_set.hh.

◆ begin() [2/2]

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

Returns an iterator to the first entry of the dictionary.

Returns
iterator to the first element

Definition at line 223 of file associative_set.hh.

◆ end() [1/2]

template<class Entry >
iterator 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 214 of file associative_set.hh.

◆ end() [2/2]

template<class Entry >
const_iterator 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 233 of file associative_set.hh.

◆ findEntry()

template<class Entry >
Entry * 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 55 of file associative_set_impl.hh.

Referenced by Prefetcher::Stride::calculatePrefetch().

◆ findVictim()

template<class Entry >
Entry * 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 80 of file associative_set_impl.hh.

Referenced by Prefetcher::Stride::calculatePrefetch().

◆ getPossibleEntries()

template<class Entry >
std::vector< Entry * > 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 95 of file associative_set_impl.hh.

◆ insertEntry()

template<class Entry >
void 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 110 of file associative_set_impl.hh.

Referenced by Prefetcher::Stride::calculatePrefetch().

◆ invalidate()

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

Invalidate an entry and its respective replacement data.

Parameters
entryEntry to be invalidated.

Definition at line 120 of file associative_set_impl.hh.

Member Data Documentation

◆ associativity

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

Associativity of the container.

Definition at line 119 of file associative_set.hh.

◆ entries

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

◆ indexingPolicy

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

Pointer to the indexing policy.

Definition at line 130 of file associative_set.hh.

Referenced by AssociativeSet< Prefetcher::IrregularStreamBuffer::AddressMappingEntry >::AssociativeSet().

◆ numEntries

template<class Entry >
const int 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 128 of file associative_set.hh.

Referenced by AssociativeSet< Prefetcher::IrregularStreamBuffer::AddressMappingEntry >::AssociativeSet().

◆ replacementPolicy

template<class Entry >
BaseReplacementPolicy* const AssociativeSet< Entry >::replacementPolicy
private

Pointer to the replacement policy.

Definition at line 132 of file associative_set.hh.

Referenced by AssociativeSet< Prefetcher::IrregularStreamBuffer::AddressMappingEntry >::AssociativeSet().


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

Generated on Wed Sep 30 2020 14:02:21 for gem5 by doxygen 1.8.17