gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
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, uint8_t _intlv_high_bit, uint8_t _xor_high_bit, uint8_t _intlv_bits, uint8_t _intlv_match)
 
 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...
 
bool hashed () const
 Determine if the range interleaving is hashed 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...
 
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 Both _start and _end are part of the range. More...
 
Addr _end
 
uint8_t intlvHighBit
 The high bit of the slice that is used for interleaving. More...
 
uint8_t xorHighBit
 The high bit of the slice used to XOR hash the value we match against, set to 0 to disable. More...
 
uint8_t intlvBits
 The number of bits used for interleaving, set to 0 to disable. More...
 
uint8_t intlvMatch
 The value to compare the slice addr[high:(high - bits + 1)] 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 basic XOR-based hashing by specifying an additional 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 72 of file addr_range.hh.

Constructor & Destructor Documentation

AddrRange::AddrRange ( )
inline

Definition at line 98 of file addr_range.hh.

AddrRange::AddrRange ( Addr  _start,
Addr  _end,
uint8_t  _intlv_high_bit,
uint8_t  _xor_high_bit,
uint8_t  _intlv_bits,
uint8_t  _intlv_match 
)
inline

Definition at line 103 of file addr_range.hh.

References fatal, fatal_if(), intlvBits, intlvHighBit, intlvMatch, ULL, and xorHighBit.

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

Definition at line 132 of file addr_range.hh.

AddrRange::AddrRange ( const std::vector< AddrRange > &  ranges)
inline

Create an address range by merging a collection of interleaved ranges.

Parameters
rangesInterleaved ranges to be merged

Definition at line 143 of file addr_range.hh.

References _end, _start, fatal, intlvBits, intlvHighBit, mergesWith(), MipsISA::r, ULL, and xorHighBit.

Member Function Documentation

bool AddrRange::contains ( const Addr a) const
inline
Addr AddrRange::end ( ) const
inline

Get the end address of the range.

Definition at line 232 of file addr_range.hh.

References _end.

Referenced by init_range().

uint64_t AddrRange::granularity ( ) const
inline

Determing the interleaving granularity of the range.

Returns
The size of the regions created by the interleaving bits

Definition at line 196 of file addr_range.hh.

References intlvBits, intlvHighBit, and ULL.

Referenced by DRAMCtrl::init(), and init_range().

bool AddrRange::hashed ( ) const
inline

Determine if the range interleaving is hashed or not.

Definition at line 189 of file addr_range.hh.

References interleaved(), and xorHighBit.

Referenced by contains(), init_range(), and to_string().

bool AddrRange::interleaved ( ) const
inline

Determine if the range is interleaved or not.

Returns
true if interleaved

Definition at line 184 of file addr_range.hh.

References intlvBits.

Referenced by contains(), PhysicalMemory::createBackingStore(), KvmVM::delayedStartup(), hashed(), DRAMCtrl::init(), init_range(), intersects(), isSubset(), and to_string().

bool AddrRange::intersects ( const AddrRange r) const
inline

Determine if another range intersects this one, i.e.

if there is an address that is both in this range and the other range. No check is made to ensure either range is valid.

Parameters
rRange to intersect with
Returns
true if the intersection of the two ranges is not empty

Definition at line 283 of file addr_range.hh.

References _end, _start, contains(), interleaved(), intlvMatch, mergesWith(), panic, size(), start(), and to_string().

Referenced by init_range().

bool AddrRange::isSubset ( const AddrRange r) const
inline

Determine if this range is a subset of another range, i.e.

if every address in this range is also in the other range. No check is made to ensure either range is valid.

Parameters
rRange to compare with
Returns
true if the this range is a subset of the other one

Definition at line 315 of file addr_range.hh.

References _end, _start, interleaved(), panic, and to_string().

Referenced by AbstractMemory::access(), and init_range().

bool AddrRange::mergesWith ( const AddrRange r) const
inline

Determine if another range merges with the current one, i.e.

if they are part of the same contigous range and have the same interleaving bits.

Parameters
rRange to evaluate merging with
Returns
true if the two ranges would merge

Definition at line 267 of file addr_range.hh.

References _end, _start, intlvBits, intlvHighBit, and xorHighBit.

Referenced by AddrRange(), init_range(), and intersects().

bool AddrRange::operator!= ( const AddrRange r) const
inline

Definition at line 378 of file addr_range.hh.

References MipsISA::r.

bool AddrRange::operator< ( const AddrRange r) const
inline

Less-than operator used to turn an STL map into a binary search tree of non-overlapping address ranges.

Parameters
rRange to compare with
Returns
true if the start address is less than that of the other range

Definition at line 356 of file addr_range.hh.

References _start, and intlvMatch.

bool AddrRange::operator== ( const AddrRange r) const
inline

Definition at line 366 of file addr_range.hh.

References _end, _start, intlvBits, intlvHighBit, and intlvMatch.

Addr AddrRange::size ( ) const
inline

Get the size of the address range.

For a case where interleaving is used we make the simplifying assumption that the size is a divisible by the size of the interleaving slice.

Definition at line 214 of file addr_range.hh.

References _end, _start, and intlvBits.

Referenced by KvmVM::coalesceMMIO(), PhysicalMemory::createBackingStore(), KvmVM::delayedStartup(), init_range(), intersects(), PhysicalMemory::serializeStore(), AbstractMemory::size(), and PhysicalMemory::unserializeStore().

Addr AddrRange::start ( ) const
inline
uint32_t AddrRange::stripes ( ) const
inline

Determine the number of interleaved address stripes this range is part of.

Returns
The number of stripes spanned by the interleaving bits

Definition at line 207 of file addr_range.hh.

References intlvBits, and ULL.

Referenced by DRAMCtrl::init(), and init_range().

std::string AddrRange::to_string ( ) const
inline

Get a string representation of the range.

This could alternatively be implemented as a operator<<, but at the moment that seems like overkill.

Definition at line 239 of file addr_range.hh.

References _end, _start, csprintf(), hashed(), interleaved(), intlvBits, intlvHighBit, intlvMatch, and xorHighBit.

Referenced by PhysicalMemory::createBackingStore(), init_range(), intersects(), isSubset(), and BaseXBar::recvRangeChange().

bool AddrRange::valid ( ) const
inline

Determine if the range is valid.

Definition at line 222 of file addr_range.hh.

References _end, and _start.

Referenced by init_range().

Member Data Documentation

Addr AddrRange::_end
private
Addr AddrRange::_start
private

Private fields for the start and end of the range Both _start and _end are part of the range.

Definition at line 79 of file addr_range.hh.

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

uint8_t AddrRange::intlvBits
private

The number of bits used for interleaving, set to 0 to disable.

Definition at line 90 of file addr_range.hh.

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

uint8_t AddrRange::intlvHighBit
private

The high bit of the slice that is used for interleaving.

Definition at line 83 of file addr_range.hh.

Referenced by AddrRange(), contains(), granularity(), mergesWith(), operator==(), and to_string().

uint8_t AddrRange::intlvMatch
private

The value to compare the slice addr[high:(high - bits + 1)] with.

Definition at line 94 of file addr_range.hh.

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

uint8_t AddrRange::xorHighBit
private

The high bit of the slice used to XOR hash the value we match against, set to 0 to disable.

Definition at line 87 of file addr_range.hh.

Referenced by AddrRange(), contains(), hashed(), mergesWith(), and to_string().


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

Generated on Fri Jun 9 2017 13:04:00 for gem5 by doxygen 1.8.6