addr_range.hh (9411:22e15f9c3fda) | addr_range.hh (9412:190fd0e285f6) |
---|---|
1/* 2 * Copyright (c) 2012 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 --- 31 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 | 1/* 2 * Copyright (c) 2012 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 --- 31 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 <vector> 49 |
|
48#include "base/bitfield.hh" 49#include "base/cprintf.hh" 50#include "base/misc.hh" 51#include "base/types.hh" 52 53class AddrRange 54{ 55 --- 26 unchanged lines hidden (view full) --- 82 {} 83 84 AddrRange(Addr _start, Addr _end) 85 : _start(_start), _end(_end), intlvHighBit(0), intlvBits(0), 86 intlvMatch(0) 87 {} 88 89 /** | 50#include "base/bitfield.hh" 51#include "base/cprintf.hh" 52#include "base/misc.hh" 53#include "base/types.hh" 54 55class AddrRange 56{ 57 --- 26 unchanged lines hidden (view full) --- 84 {} 85 86 AddrRange(Addr _start, Addr _end) 87 : _start(_start), _end(_end), intlvHighBit(0), intlvBits(0), 88 intlvMatch(0) 89 {} 90 91 /** |
92 * Create an address range by merging a collection of interleaved 93 * ranges. 94 * 95 * @param ranges Interleaved ranges to be merged 96 */ 97 AddrRange(const std::vector<AddrRange>& ranges) 98 : _start(1), _end(0), intlvHighBit(0), intlvBits(0), intlvMatch(0) 99 { 100 if (!ranges.empty()) { 101 // get the values from the first one and check the others 102 _start = ranges.front()._start; 103 _end = ranges.front()._end; 104 intlvHighBit = ranges.front().intlvHighBit; 105 intlvBits = ranges.front().intlvBits; 106 107 if (ranges.size() != (ULL(1) << intlvBits)) 108 fatal("Got %d ranges spanning %d interleaving bits\n", 109 ranges.size(), intlvBits); 110 111 uint8_t match = 0; 112 for (std::vector<AddrRange>::const_iterator r = ranges.begin(); 113 r != ranges.end(); ++r) { 114 if (!mergesWith(*r)) 115 fatal("Can only merge ranges with the same start, end " 116 "and interleaving bits\n"); 117 118 if (r->intlvMatch != match) 119 fatal("Expected interleave match %d but got %d when " 120 "merging\n", match, r->intlvMatch); 121 ++match; 122 } 123 124 // our range is complete and we can turn this into a 125 // non-interleaved range 126 intlvHighBit = 0; 127 intlvBits = 0; 128 } 129 } 130 131 /** |
|
90 * Determine if the range is interleaved or not. 91 * 92 * @return true if interleaved 93 */ 94 bool interleaved() const { return intlvBits != 0; } 95 96 /** 97 * Determing the interleaving granularity of the range. --- 165 unchanged lines hidden --- | 132 * Determine if the range is interleaved or not. 133 * 134 * @return true if interleaved 135 */ 136 bool interleaved() const { return intlvBits != 0; } 137 138 /** 139 * Determing the interleaving granularity of the range. --- 165 unchanged lines hidden --- |