45 #ifndef __BASE_ADDR_RANGE_HH__
46 #define __BASE_ADDR_RANGE_HH__
104 uint8_t _xor_high_bit, uint8_t _intlv_bits,
105 uint8_t _intlv_match)
106 : _start(_start), _end(_end),
intlvHighBit(_intlv_high_bit),
112 "Match value %d does not fit in %d interleaving bits\n",
118 fatal(
"XOR and interleave high bit must be different\n");
121 fatal(
"XOR and interleave high bit must be at least "
125 fatal(
"Interleave and XOR high bit must be at least "
147 if (!ranges.empty()) {
149 _start = ranges.front()._start;
150 _end = ranges.front()._end;
156 fatal(
"Got %d ranges spanning %d interleaving bits\n",
160 for (
const auto&
r : ranges) {
162 fatal(
"Can only merge ranges with the same start, end "
163 "and interleaving bits\n");
165 if (
r.intlvMatch != match)
166 fatal(
"Expected interleave match %d but got %d when "
167 "merging\n", match,
r.intlvMatch);
243 return csprintf(
"[%#llx : %#llx], [%d : %d] XOR [%d : %d] = %d",
249 return csprintf(
"[%#llx : %#llx], [%d : %d] = %d",
303 panic(
"Cannot test intersection of %s and %s\n",
318 panic(
"Cannot test subset of interleaved range %s\n",
to_string());
336 }
else if (in_range) {
380 return !(*
this ==
r);
399 {
return AddrRange(start, start + size - 1); }
401 #endif // __BASE_ADDR_RANGE_HH__
bool intersects(const AddrRange &r) const
Determine if another range intersects this one, i.e.
AddrRange RangeSize(Addr start, Addr size)
uint64_t granularity() const
Determing the interleaving granularity of the range.
bool hashed() const
Determine if the range interleaving is hashed or not.
Addr start() const
Get the start address of the range.
bool interleaved() const
Determine if the range is interleaved or not.
std::list< AddrRange > AddrRangeList
Convenience typedef for a collection of address ranges.
bool mergesWith(const AddrRange &r) const
Determine if another range merges with the current one, i.e.
uint8_t intlvMatch
The value to compare the slice addr[high:(high - bits + 1)] with.
bool contains(const Addr &a) const
Determine if the range contains an address.
uint8_t xorHighBit
The high bit of the slice used to XOR hash the value we match against, set to 0 to disable...
bool operator<(const AddrRange &r) const
Less-than operator used to turn an STL map into a binary search tree of non-overlapping address range...
Addr _start
Private fields for the start and end of the range Both _start and _end are part of the range...
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
AddrRange(const std::vector< AddrRange > &ranges)
Create an address range by merging a collection of interleaved ranges.
std::string csprintf(const char *format, const Args &...args)
bool valid() const
Determine if the range is valid.
uint32_t stripes() const
Determine the number of interleaved address stripes this range is part of.
std::string to_string() const
Get a string representation of the range.
AddrRange RangeIn(Addr start, Addr end)
bool isSubset(const AddrRange &r) const
Determine if this range is a subset of another range, i.e.
uint8_t intlvHighBit
The high bit of the slice that is used for interleaving.
AddrRange(Addr _start, Addr _end)
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
#define ULL(N)
uint64_t constant
uint8_t intlvBits
The number of bits used for interleaving, set to 0 to disable.
AddrRange RangeEx(Addr start, Addr end)
Addr end() const
Get the end address of the range.
AddrRange(Addr _start, Addr _end, uint8_t _intlv_high_bit, uint8_t _xor_high_bit, uint8_t _intlv_bits, uint8_t _intlv_match)
fatal_if(p->js_features.size() > 16,"Too many job slot feature registers specified (%i)\n", p->js_features.size())
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it...
bool operator==(const AddrRange &r) const
Addr size() const
Get the size of the address range.
bool operator!=(const AddrRange &r) const