base: Tag API methods and variables in addr_range.hh
Change-Id: I4bff99ecf1e0eeab4a76574e99163303f7dec83b Signed-off-by: Hoa Nguyen <hoanguyen@ucdavis.edu> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/32955 Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
This commit is contained in:
@@ -88,6 +88,9 @@ class AddrRange
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* @ingroup api_addr_range
|
||||
*/
|
||||
AddrRange()
|
||||
: _start(1), _end(0), intlvMatch(0)
|
||||
{}
|
||||
@@ -119,6 +122,8 @@ class AddrRange
|
||||
* @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)
|
||||
@@ -154,6 +159,8 @@ class AddrRange
|
||||
* @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,
|
||||
@@ -202,6 +209,8 @@ class AddrRange
|
||||
* ranges.
|
||||
*
|
||||
* @param ranges Interleaved ranges to be merged
|
||||
*
|
||||
* @ingroup api_addr_range
|
||||
*/
|
||||
AddrRange(const std::vector<AddrRange>& ranges)
|
||||
: _start(1), _end(0), intlvMatch(0)
|
||||
@@ -242,6 +251,8 @@ class AddrRange
|
||||
* Determine if the range is interleaved or not.
|
||||
*
|
||||
* @return true if interleaved
|
||||
*
|
||||
* @ingroup api_addr_range
|
||||
*/
|
||||
bool interleaved() const { return masks.size() > 0; }
|
||||
|
||||
@@ -249,6 +260,8 @@ class AddrRange
|
||||
* 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
|
||||
{
|
||||
@@ -269,6 +282,8 @@ class AddrRange
|
||||
* 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(); }
|
||||
|
||||
@@ -276,6 +291,8 @@ class AddrRange
|
||||
* 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
|
||||
{
|
||||
@@ -284,16 +301,22 @@ class AddrRange
|
||||
|
||||
/**
|
||||
* 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; }
|
||||
|
||||
@@ -301,6 +324,8 @@ class AddrRange
|
||||
* 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
|
||||
{
|
||||
@@ -329,6 +354,8 @@ class AddrRange
|
||||
*
|
||||
* @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
|
||||
{
|
||||
@@ -343,6 +370,8 @@ class AddrRange
|
||||
*
|
||||
* @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
|
||||
{
|
||||
@@ -375,6 +404,8 @@ class AddrRange
|
||||
*
|
||||
* @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
|
||||
{
|
||||
@@ -398,6 +429,8 @@ class AddrRange
|
||||
*
|
||||
* @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
|
||||
{
|
||||
@@ -441,6 +474,8 @@ class AddrRange
|
||||
*
|
||||
* @param a the input address
|
||||
* @return the new address
|
||||
*
|
||||
* @ingroup api_addr_range
|
||||
*/
|
||||
inline Addr removeIntlvBits(Addr a) const
|
||||
{
|
||||
@@ -471,6 +506,8 @@ class AddrRange
|
||||
/**
|
||||
* This method adds the interleaving bits removed by
|
||||
* removeIntlvBits.
|
||||
*
|
||||
* @ingroup api_addr_range
|
||||
*/
|
||||
inline Addr addIntlvBits(Addr a) const
|
||||
{
|
||||
@@ -516,6 +553,8 @@ class AddrRange
|
||||
*
|
||||
* @param the input address
|
||||
* @return the flat offset in the address range
|
||||
*
|
||||
* @ingroup api_addr_range
|
||||
*/
|
||||
Addr getOffset(const Addr& a) const
|
||||
{
|
||||
@@ -536,6 +575,8 @@ class AddrRange
|
||||
*
|
||||
* @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
|
||||
{
|
||||
@@ -547,6 +588,9 @@ class AddrRange
|
||||
return intlvMatch < r.intlvMatch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup api_addr_range
|
||||
*/
|
||||
bool operator==(const AddrRange& r) const
|
||||
{
|
||||
if (_start != r._start) return false;
|
||||
@@ -557,6 +601,9 @@ class AddrRange
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup api_addr_range
|
||||
*/
|
||||
bool operator!=(const AddrRange& r) const
|
||||
{
|
||||
return !(*this == r);
|
||||
@@ -565,17 +612,28 @@ class AddrRange
|
||||
|
||||
/**
|
||||
* 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); }
|
||||
|
||||
Reference in New Issue
Block a user