addr_range.hh (11990:5fad911cc326) | addr_range.hh (12065:e3e51756dfef) |
---|---|
1/* | 1/* |
2 * Copyright (c) 2012, 2014 ARM Limited | 2 * Copyright (c) 2012, 2014, 2017 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 --- 331 unchanged lines hidden (view full) --- 342 bits(a, xorHighBit, xorHighBit - intlvBits + 1)) == 343 intlvMatch; 344 } 345 } 346 return false; 347 } 348 349 /** | 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 --- 331 unchanged lines hidden (view full) --- 342 bits(a, xorHighBit, xorHighBit - intlvBits + 1)) == 343 intlvMatch; 344 } 345 } 346 return false; 347 } 348 349 /** |
350 * Remove the interleaving bits from an input address. 351 * 352 * This function returns a new address that doesn't have the bits 353 * that are use to determine which of the interleaved ranges it 354 * belongs to. 355 * 356 * e.g., if the input address is: 357 * ------------------------------- 358 * | prefix | intlvBits | suffix | 359 * ------------------------------- 360 * this function will return: 361 * ------------------------------- 362 * | 0 | prefix | suffix | 363 * ------------------------------- 364 * 365 * @param the input address 366 * @return the address without the interleaved bits 367 */ 368 inline Addr removeIntlvBits(const Addr &a) const 369 { 370 const auto intlv_low_bit = intlvHighBit - intlvBits + 1; 371 return insertBits(a >> intlvBits, intlv_low_bit - 1, 0, a); 372 } 373 374 /** 375 * Determine the offset of an address within the range. 376 * 377 * This function returns the offset of the given address from the 378 * starting address discarding any bits that are used for 379 * interleaving. This way we can convert the input address to a 380 * new unique address in a continuous range that starts from 0. 381 * 382 * @param the input address 383 * @return the flat offset in the address range 384 */ 385 Addr getOffset(const Addr& a) const 386 { 387 bool in_range = a >= _start && a <= _end; 388 if (!in_range) { 389 return MaxAddr; 390 } 391 if (interleaved()) { 392 return removeIntlvBits(a) - removeIntlvBits(_start); 393 } else { 394 return a - _start; 395 } 396 } 397 398 /** |
|
350 * Less-than operator used to turn an STL map into a binary search 351 * tree of non-overlapping address ranges. 352 * 353 * @param r Range to compare with 354 * @return true if the start address is less than that of the other range 355 */ 356 bool operator<(const AddrRange& r) const 357 { --- 44 unchanged lines hidden --- | 399 * Less-than operator used to turn an STL map into a binary search 400 * tree of non-overlapping address ranges. 401 * 402 * @param r Range to compare with 403 * @return true if the start address is less than that of the other range 404 */ 405 bool operator<(const AddrRange& r) const 406 { --- 44 unchanged lines hidden --- |