1/* |
2 * Copyright (c) 2012, 2014, 2017-2018 ARM Limited |
3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software 9 * licensed hereunder. You may use the software subject to the license 10 * terms below provided that you ensure that this notice is replicated --- 29 unchanged lines hidden (view full) --- 40 * Authors: Nathan Binkert 41 * Steve Reinhardt 42 * Andreas Hansson 43 */ 44 45#ifndef __BASE_ADDR_RANGE_HH__ 46#define __BASE_ADDR_RANGE_HH__ 47 |
48#include <algorithm> |
49#include <list> 50#include <vector> 51 52#include "base/bitfield.hh" 53#include "base/cprintf.hh" 54#include "base/logging.hh" 55#include "base/types.hh" 56 --- 134 unchanged lines hidden (view full) --- 191 192 /** 193 * Determing the interleaving granularity of the range. 194 * 195 * @return The size of the regions created by the interleaving bits 196 */ 197 uint64_t granularity() const 198 { |
199 if (interleaved()) { 200 const uint8_t intlv_low_bit = intlvHighBit - intlvBits + 1; 201 if (hashed()) { 202 const uint8_t xor_low_bit = xorHighBit - intlvBits + 1; 203 return ULL(1) << std::min(intlv_low_bit, xor_low_bit); 204 } else { 205 return ULL(1) << intlv_low_bit; 206 } 207 } else { 208 return size(); 209 } |
210 } 211 212 /** 213 * Determine the number of interleaved address stripes this range 214 * is part of. 215 * 216 * @return The number of stripes spanned by the interleaving bits 217 */ --- 104 unchanged lines hidden (view full) --- 322 * 323 * @param r Range to compare with 324 * @return true if the this range is a subset of the other one 325 */ 326 bool isSubset(const AddrRange& r) const 327 { 328 if (interleaved()) 329 panic("Cannot test subset of interleaved range %s\n", to_string()); |
330 331 // This address range is not interleaved and therefore it 332 // suffices to check the upper bound, the lower bound and 333 // whether it would fit in a continuous segment of the input 334 // addr range. 335 if (r.interleaved()) { 336 return r.contains(_start) && r.contains(_end) && 337 size() <= r.granularity(); 338 } else { 339 return _start >= r._start && _end <= r._end; 340 } |
341 } 342 343 /** 344 * Determine if the range contains an address. 345 * 346 * @param a Address to compare with 347 * @return true if the address is in the range 348 */ --- 123 unchanged lines hidden --- |