gem5  v21.1.0.2
Public 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>

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 (const std::vector< AddrRange > &ranges)
 Create an address range by merging a collection of interleaved ranges. More...
 
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...
 
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
 

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 71 of file addr_range.hh.

Constructor & Destructor Documentation

◆ AddrRange()

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

Definition at line 206 of file addr_range.hh.

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 79 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 90 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 87 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 Tue Sep 21 2021 12:27:13 for gem5 by doxygen 1.8.17