gem5
|
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... | |
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.
|
inline |
Definition at line 98 of file addr_range.hh.
|
inline |
Definition at line 103 of file addr_range.hh.
References fatal, fatal_if(), intlvBits, intlvHighBit, intlvMatch, ULL, and xorHighBit.
Definition at line 132 of file addr_range.hh.
|
inline |
Create an address range by merging a collection of interleaved ranges.
ranges | Interleaved 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.
|
inline |
Determine if the range contains an address.
a | Address to compare with |
Definition at line 328 of file addr_range.hh.
References _end, _start, bits(), hashed(), interleaved(), intlvBits, intlvHighBit, intlvMatch, and xorHighBit.
Referenced by System::allocPhysPages(), X86ISA::TLB::finalizePhysical(), ArmISA::TLB::finalizePhysical(), BaseXBar::findPort(), intersects(), TsunamiPChip::read(), GenericTimerMem::read(), Pl390::read(), Pl390::readDistributor(), TsunamiPChip::write(), GenericTimerMem::write(), Pl390::write(), and Pl390::writeDistributor().
|
inline |
Get the end address of the range.
Definition at line 232 of file addr_range.hh.
References _end.
Referenced by init_range().
|
inline |
Determing the interleaving granularity of the range.
Definition at line 196 of file addr_range.hh.
References intlvBits, intlvHighBit, and ULL.
Referenced by DRAMCtrl::init(), and init_range().
|
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().
|
inline |
Determine if the range is interleaved or not.
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().
|
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.
r | Range to intersect with |
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().
|
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.
r | Range to compare with |
Definition at line 315 of file addr_range.hh.
References _end, _start, interleaved(), panic, and to_string().
Referenced by AbstractMemory::access(), and init_range().
|
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.
r | Range to evaluate merging with |
Definition at line 267 of file addr_range.hh.
References _end, _start, intlvBits, intlvHighBit, and xorHighBit.
Referenced by AddrRange(), init_range(), and intersects().
|
inline |
Definition at line 378 of file addr_range.hh.
References MipsISA::r.
|
inline |
Less-than operator used to turn an STL map into a binary search tree of non-overlapping address ranges.
r | Range to compare with |
Definition at line 356 of file addr_range.hh.
References _start, and intlvMatch.
|
inline |
Definition at line 366 of file addr_range.hh.
References _end, _start, intlvBits, intlvHighBit, and intlvMatch.
|
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().
|
inline |
Get the start address of the range.
Definition at line 227 of file addr_range.hh.
References _start.
Referenced by AbstractMemory::access(), KvmVM::coalesceMMIO(), MuxingKvmGic::copyGicState(), KvmVM::delayedStartup(), X86ISA::TLB::finalizePhysical(), AbstractMemory::functionalAccess(), init_range(), intersects(), TsunamiPChip::read(), GenericTimerMem::read(), Pl390::readCpu(), Pl390::readDistributor(), AbstractMemory::start(), TsunamiPChip::write(), GenericTimerMem::write(), Pl390::writeCpu(), and Pl390::writeDistributor().
|
inline |
Determine the number of interleaved address stripes this range is part of.
Definition at line 207 of file addr_range.hh.
References intlvBits, and ULL.
Referenced by DRAMCtrl::init(), and init_range().
|
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().
|
inline |
Determine if the range is valid.
Definition at line 222 of file addr_range.hh.
Referenced by init_range().
|
private |
Definition at line 80 of file addr_range.hh.
Referenced by AddrRange(), contains(), end(), intersects(), isSubset(), mergesWith(), operator==(), size(), to_string(), and valid().
|
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().
|
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().
|
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().
|
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().
|
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().