gem5  v20.1.0.0
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
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 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 59 of file addr_range_map.hh.

Member Typedef Documentation

◆ RangeMap

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

Definition at line 62 of file addr_range_map.hh.

Member Function Documentation

◆ addNewEntryToCache()

template<typename V , int max_cache_size = 0>
void 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 253 of file addr_range_map.hh.

Referenced by AddrRangeMap< AbstractMemory *, 1 >::find().

◆ find() [1/2]

template<typename V , int max_cache_size = 0>
iterator 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 284 of file addr_range_map.hh.

Referenced by AddrRangeMap< AbstractMemory *, 1 >::contains(), AddrRangeMap< AbstractMemory *, 1 >::find(), and AddrRangeMap< AbstractMemory *, 1 >::intersects().

◆ find() [2/2]

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

Definition at line 321 of file addr_range_map.hh.

Member Data Documentation

◆ cache

template<typename V , int max_cache_size = 0>
std::list<iterator> 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 334 of file addr_range_map.hh.

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

◆ tree

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

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

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