public:
+ /**
+ * @ingroup api_addr_range
+ */
AddrRange()
: _start(1), _end(0), intlvMatch(0)
{}
* @param _end The end address of this range (not included in the range)
* @param _masks The input vector of masks
* @param intlv_match The matching value of the xor operations
+ *
+ * @ingroup api_addr_range
*/
AddrRange(Addr _start, Addr _end, const std::vector<Addr> &_masks,
uint8_t _intlv_match)
* @param _xor_high_bit The MSB of the xor bit (disabled if 0)
* @param _intlv_bits the size, in bits, of the intlv and xor bits
* @param intlv_match The matching value of the xor operations
+ *
+ * @ingroup api_addr_range
*/
AddrRange(Addr _start, Addr _end, uint8_t _intlv_high_bit,
uint8_t _xor_high_bit, uint8_t _intlv_bits,
* ranges.
*
* @param ranges Interleaved ranges to be merged
+ *
+ * @ingroup api_addr_range
*/
AddrRange(const std::vector<AddrRange>& ranges)
: _start(1), _end(0), intlvMatch(0)
* Determine if the range is interleaved or not.
*
* @return true if interleaved
+ *
+ * @ingroup api_addr_range
*/
bool interleaved() const { return masks.size() > 0; }
* Determing the interleaving granularity of the range.
*
* @return The size of the regions created by the interleaving bits
+ *
+ * @ingroup api_addr_range
*/
uint64_t granularity() const
{
* is part of.
*
* @return The number of stripes spanned by the interleaving bits
+ *
+ * @ingroup api_addr_range
*/
uint32_t stripes() const { return ULL(1) << masks.size(); }
* 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.
+ *
+ * @ingroup api_addr_range
*/
Addr size() const
{
/**
* Determine if the range is valid.
+ *
+ * @ingroup api_addr_range
*/
bool valid() const { return _start <= _end; }
/**
* Get the start address of the range.
+ *
+ * @ingroup api_addr_range
*/
Addr start() const { return _start; }
/**
* Get the end address of the range.
+ *
+ * @ingroup api_addr_range
*/
Addr end() const { return _end; }
* Get a string representation of the range. This could
* alternatively be implemented as a operator<<, but at the moment
* that seems like overkill.
+ *
+ * @ingroup api_addr_range
*/
std::string to_string() const
{
*
* @param r Range to evaluate merging with
* @return true if the two ranges would merge
+ *
+ * @ingroup api_addr_range
*/
bool mergesWith(const AddrRange& r) const
{
*
* @param r Range to intersect with
* @return true if the intersection of the two ranges is not empty
+ *
+ * @ingroup api_addr_range
*/
bool intersects(const AddrRange& r) const
{
*
* @param r Range to compare with
* @return true if the this range is a subset of the other one
+ *
+ * @ingroup api_addr_range
*/
bool isSubset(const AddrRange& r) const
{
*
* @param a Address to compare with
* @return true if the address is in the range
+ *
+ * @ingroup api_addr_range
*/
bool contains(const Addr& a) const
{
*
* @param a the input address
* @return the new address
+ *
+ * @ingroup api_addr_range
*/
inline Addr removeIntlvBits(Addr a) const
{
/**
* This method adds the interleaving bits removed by
* removeIntlvBits.
+ *
+ * @ingroup api_addr_range
*/
inline Addr addIntlvBits(Addr a) const
{
*
* @param the input address
* @return the flat offset in the address range
+ *
+ * @ingroup api_addr_range
*/
Addr getOffset(const Addr& a) const
{
*
* @param r Range to compare with
* @return true if the start address is less than that of the other range
+ *
+ * @ingroup api_addr_range
*/
bool operator<(const AddrRange& r) const
{
return intlvMatch < r.intlvMatch;
}
+ /**
+ * @ingroup api_addr_range
+ */
bool operator==(const AddrRange& r) const
{
if (_start != r._start) return false;
return true;
}
+ /**
+ * @ingroup api_addr_range
+ */
bool operator!=(const AddrRange& r) const
{
return !(*this == r);
/**
* Convenience typedef for a collection of address ranges
+ *
+ * @ingroup api_addr_range
*/
typedef std::list<AddrRange> AddrRangeList;
+/**
+ * @ingroup api_addr_range
+ */
inline AddrRange
RangeEx(Addr start, Addr end)
{ return AddrRange(start, end); }
+/**
+ * @ingroup api_addr_range
+ */
inline AddrRange
RangeIn(Addr start, Addr end)
{ return AddrRange(start, end + 1); }
+/**
+ * @ingroup api_addr_range
+ */
inline AddrRange
RangeSize(Addr start, Addr size)
{ return AddrRange(start, start + size); }