gem5  v21.1.0.2
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
gem5::AddrRangeMap< V, max_cache_size > Class Template Reference

The AddrRangeMap uses an STL map to implement an interval tree for address decoding. More...

#include <addr_range_map.hh>

Public Types

typedef RangeMap::iterator iterator
 
typedef RangeMap::const_iterator const_iterator
 

Public Member Functions

iterator insert (const AddrRange &r, const V &d)
 
void erase (iterator p)
 
void erase (iterator p, iterator q)
 
void clear ()
 
const_iterator begin () const
 
iterator begin ()
 
const_iterator end () const
 
iterator end ()
 
std::size_t size () const
 
bool empty () const
 
const_iterator contains (const AddrRange &r) const
 Find entry that contains the given address range. More...
 
iterator contains (const AddrRange &r)
 
const_iterator contains (Addr r) const
 Find entry that contains the given address. More...
 
iterator contains (Addr r)
 
const_iterator intersects (const AddrRange &r) const
 Find entry that intersects with the given address range. More...
 
iterator intersects (const AddrRange &r)
 

Private Types

typedef std::map< AddrRange, V > RangeMap
 

Private Member Functions

void addNewEntryToCache (iterator it) const
 Add an address range map entry to the cache. More...
 
iterator find (const AddrRange &r, std::function< bool(const AddrRange)> cond)
 Find entry that satisfies a condition on an address range. More...
 
const_iterator find (const AddrRange &r, std::function< bool(const AddrRange)> cond) const
 

Private Attributes

RangeMap tree
 
std::list< iteratorcache
 A list of iterator that correspond to the max_cache_size most recently used entries in the address range map. More...
 

Detailed Description

template<typename V, int max_cache_size = 0>
class gem5::AddrRangeMap< V, max_cache_size >

The AddrRangeMap uses an STL map to implement an interval tree for address decoding.

The value stored is a template type and can be e.g. a port identifier, or a pointer.

Definition at line 62 of file addr_range_map.hh.

Member Typedef Documentation

◆ RangeMap

template<typename V , int max_cache_size = 0>
typedef std::map<AddrRange, V> gem5::AddrRangeMap< V, max_cache_size >::RangeMap
private

Definition at line 65 of file addr_range_map.hh.

Member Function Documentation

◆ addNewEntryToCache()

template<typename V , int max_cache_size = 0>
void gem5::AddrRangeMap< V, max_cache_size >::addNewEntryToCache ( iterator  it) const
inlineprivate

Add an address range map entry to the cache.

Parameters
itIterator to the entry in the address range map

Definition at line 256 of file addr_range_map.hh.

Referenced by gem5::AddrRangeMap< gem5::MemBackdoor, 1 >::find().

◆ find() [1/2]

template<typename V , int max_cache_size = 0>
iterator gem5::AddrRangeMap< V, max_cache_size >::find ( const AddrRange r,
std::function< bool(const AddrRange)>  cond 
)
inlineprivate

Find entry that satisfies a condition on an address range.

Searches through the ranges in the address map and returns an iterator to the entry that satisfies the input conidition on the input address range. Returns end() if none found.

Parameters
rAn input address range
fA condition on an address range
Returns
An iterator that contains the input address range

Definition at line 287 of file addr_range_map.hh.

Referenced by gem5::AddrRangeMap< gem5::MemBackdoor, 1 >::contains(), gem5::AddrRangeMap< gem5::MemBackdoor, 1 >::find(), and gem5::AddrRangeMap< gem5::MemBackdoor, 1 >::intersects().

◆ find() [2/2]

template<typename V , int max_cache_size = 0>
const_iterator gem5::AddrRangeMap< V, max_cache_size >::find ( const AddrRange r,
std::function< bool(const AddrRange)>  cond 
) const
inlineprivate

Definition at line 324 of file addr_range_map.hh.

Member Data Documentation

◆ cache

template<typename V , int max_cache_size = 0>
std::list<iterator> gem5::AddrRangeMap< V, max_cache_size >::cache
mutableprivate

A list of iterator that correspond to the max_cache_size most recently used entries in the address range map.

This mainly used to optimize lookups. The elements in the list should always be valid iterators of the tree.

Definition at line 337 of file addr_range_map.hh.

Referenced by gem5::AddrRangeMap< gem5::MemBackdoor, 1 >::addNewEntryToCache(), gem5::AddrRangeMap< gem5::MemBackdoor, 1 >::clear(), gem5::AddrRangeMap< gem5::MemBackdoor, 1 >::erase(), and gem5::AddrRangeMap< gem5::MemBackdoor, 1 >::find().

◆ tree

template<typename V , int max_cache_size = 0>
RangeMap gem5::AddrRangeMap< V, max_cache_size >::tree
private

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

Generated on Tue Sep 21 2021 12:27:13 for gem5 by doxygen 1.8.17