gem5  v22.1.0.0
Classes | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
gem5::AddrRange Class Reference

The AddrRange class encapsulates an address range, and supports a number of tests to check if two ranges intersect, if a range contains a specific address etc. More...

#include <addr_range.hh>

Classes

struct  Dummy
 

Public Member Functions

 AddrRange ()
 
 AddrRange (Addr _start, Addr _end, const std::vector< Addr > &_masks, uint8_t _intlv_match)
 Construct an address range. More...
 
 AddrRange (Addr _start, Addr _end, uint8_t _intlv_high_bit, uint8_t _xor_high_bit, uint8_t _intlv_bits, uint8_t _intlv_match)
 Legacy constructor of AddrRange. More...
 
 AddrRange (Addr _start, Addr _end)
 
 AddrRange (std::vector< AddrRange > ranges)
 Create an address range by merging a collection of interleaved ranges. More...
 
 AddrRange (std::list< AddrRange > ranges)
 
bool interleaved () const
 Determine if the range is interleaved or not. More...
 
uint64_t granularity () const
 Determing the interleaving granularity of the range. More...
 
uint32_t stripes () const
 Determine the number of interleaved address stripes this range is part of. More...
 
Addr size () const
 Get the size of the address range. More...
 
bool valid () const
 Determine if the range is valid. More...
 
Addr start () const
 Get the start address of the range. More...
 
Addr end () const
 Get the end address of the range. More...
 
std::string to_string () const
 Get a string representation of the range. More...
 
bool mergesWith (const AddrRange &r) const
 Determine if another range merges with the current one, i.e. More...
 
bool intersects (const AddrRange &r) const
 Determine if another range intersects this one, i.e. More...
 
bool isSubset (const AddrRange &r) const
 Determine if this range is a subset of another range, i.e. More...
 
bool contains (const Addr &a) const
 Determine if the range contains an address. More...
 
Addr removeIntlvBits (Addr a) const
 Remove the interleaving bits from an input address. More...
 
Addr addIntlvBits (Addr a) const
 This method adds the interleaving bits removed by removeIntlvBits. More...
 
Addr getOffset (const Addr &a) const
 Determine the offset of an address within the range. More...
 
AddrRangeList exclude (const AddrRangeList &exclude_ranges) const
 Subtract a list of intervals from the range and return the resulting collection of ranges, so that the union of the two lists cover the original range. More...
 
AddrRangeList exclude (const AddrRange &excluded_range) const
 
bool operator< (const AddrRange &r) const
 Less-than operator used to turn an STL map into a binary search tree of non-overlapping address ranges. More...
 
bool operator== (const AddrRange &r) const
 
bool operator!= (const AddrRange &r) const
 

Protected Member Functions

template<class Iterator >
 AddrRange (Dummy, Iterator begin_it, Iterator end_it)
 

Private Attributes

Addr _start
 Private fields for the start and end of the range _start is the beginning of the range (inclusive). More...
 
Addr _end
 
std::vector< Addrmasks
 Each mask determines the bits we need to xor to get one bit of sel. More...
 
uint8_t intlvMatch
 The value to compare sel with. More...
 

Detailed Description

The AddrRange class encapsulates an address range, and supports a number of tests to check if two ranges intersect, if a range contains a specific address etc.

Besides a basic range, the AddrRange also support interleaved ranges, to stripe across cache banks, or memory controllers. The interleaving is implemented by allowing a number of bits of the address, at an arbitrary bit position, to be used as interleaving bits with an associated matching value. In addition, to prevent uniformly strided address patterns from a very biased interleaving, we also allow XOR-based hashing by specifying a set of bits to XOR with before matching.

The AddrRange is also able to coalesce a number of interleaved ranges to a contiguous range.

Definition at line 81 of file addr_range.hh.

Constructor & Destructor Documentation

◆ AddrRange() [1/3]

template<class Iterator >
gem5::AddrRange::AddrRange ( Dummy  ,
Iterator  begin_it,
Iterator  end_it 
)
inlineprotected

Definition at line 108 of file addr_range.hh.

References _end, _start, gem5::X86ISA::count, fatal_if, intlvMatch, masks, mergesWith(), and to_string().

◆ AddrRange() [2/3]

gem5::AddrRange::AddrRange ( Addr  _start,
Addr  _end 
)
inline

Definition at line 258 of file addr_range.hh.

◆ AddrRange() [3/3]

gem5::AddrRange::AddrRange ( std::list< AddrRange ranges)
inline

Definition at line 273 of file addr_range.hh.

Member Function Documentation

◆ exclude()

AddrRangeList gem5::AddrRange::exclude ( const AddrRange excluded_range) const
inline

Definition at line 681 of file addr_range.hh.

References exclude().

Member Data Documentation

◆ _end

Addr gem5::AddrRange::_end
private

◆ _start

Addr gem5::AddrRange::_start
private

Private fields for the start and end of the range _start is the beginning of the range (inclusive).

_end is not part of the range.

Definition at line 89 of file addr_range.hh.

Referenced by AddrRange(), contains(), getOffset(), intersects(), isSubset(), mergesWith(), operator<(), operator==(), size(), start(), to_string(), and valid().

◆ intlvMatch

uint8_t gem5::AddrRange::intlvMatch
private

The value to compare sel with.

Definition at line 100 of file addr_range.hh.

Referenced by addIntlvBits(), AddrRange(), contains(), intersects(), operator<(), operator==(), and to_string().

◆ masks

std::vector<Addr> gem5::AddrRange::masks
private

Each mask determines the bits we need to xor to get one bit of sel.

The first (0) mask is used to get the LSB and the last for the MSB of sel.

Definition at line 97 of file addr_range.hh.

Referenced by addIntlvBits(), AddrRange(), contains(), granularity(), interleaved(), mergesWith(), operator==(), removeIntlvBits(), size(), stripes(), and to_string().


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

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