1/* 2 * Copyright (c) 2011-2014 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 11 * unmodified and in its entirety in all distributions of the software, 12 * modified or unmodified, in source code or in binary form. 13 * 14 * Copyright (c) 2002-2005 The Regents of The University of Michigan 15 * All rights reserved. 16 * 17 * Redistribution and use in source and binary forms, with or without 18 * modification, are permitted provided that the following conditions are 19 * met: redistributions of source code must retain the above copyright 20 * notice, this list of conditions and the following disclaimer; 21 * redistributions in binary form must reproduce the above copyright 22 * notice, this list of conditions and the following disclaimer in the 23 * documentation and/or other materials provided with the distribution; 24 * neither the name of the copyright holders nor the names of its 25 * contributors may be used to endorse or promote products derived from 26 * this software without specific prior written permission. 27 * 28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 * 40 * Authors: Ron Dreslinski 41 * Ali Saidi 42 * Andreas Hansson 43 * William Wang 44 */ 45 46/** 47 * @file 48 * Declaration of an abstract crossbar base class. 49 */ 50 51#ifndef __MEM_XBAR_HH__ 52#define __MEM_XBAR_HH__ 53 54#include <deque> 55 56#include "base/addr_range_map.hh"
| 1/* 2 * Copyright (c) 2011-2014 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 11 * unmodified and in its entirety in all distributions of the software, 12 * modified or unmodified, in source code or in binary form. 13 * 14 * Copyright (c) 2002-2005 The Regents of The University of Michigan 15 * All rights reserved. 16 * 17 * Redistribution and use in source and binary forms, with or without 18 * modification, are permitted provided that the following conditions are 19 * met: redistributions of source code must retain the above copyright 20 * notice, this list of conditions and the following disclaimer; 21 * redistributions in binary form must reproduce the above copyright 22 * notice, this list of conditions and the following disclaimer in the 23 * documentation and/or other materials provided with the distribution; 24 * neither the name of the copyright holders nor the names of its 25 * contributors may be used to endorse or promote products derived from 26 * this software without specific prior written permission. 27 * 28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 * 40 * Authors: Ron Dreslinski 41 * Ali Saidi 42 * Andreas Hansson 43 * William Wang 44 */ 45 46/** 47 * @file 48 * Declaration of an abstract crossbar base class. 49 */ 50 51#ifndef __MEM_XBAR_HH__ 52#define __MEM_XBAR_HH__ 53 54#include <deque> 55 56#include "base/addr_range_map.hh"
|
| 57#include "base/hashmap.hh"
|
57#include "base/types.hh" 58#include "mem/mem_object.hh" 59#include "params/BaseXBar.hh" 60#include "sim/stats.hh" 61 62/** 63 * The base crossbar contains the common elements of the non-coherent 64 * and coherent crossbar. It is an abstract class that does not have 65 * any of the functionality relating to the actual reception and 66 * transmission of packets, as this is left for the subclasses. 67 * 68 * The BaseXBar is responsible for the basic flow control (busy or 69 * not), the administration of retries, and the address decoding. 70 */ 71class BaseXBar : public MemObject 72{ 73 74 protected: 75 76 /** 77 * A layer is an internal crossbar arbitration point with its own 78 * flow control. Each layer is a converging multiplexer tree. By 79 * instantiating one layer per destination port (and per packet 80 * type, i.e. request, response, snoop request and snoop 81 * response), we model full crossbar structures like AXI, ACE, 82 * PCIe, etc. 83 * 84 * The template parameter, PortClass, indicates the destination 85 * port type for the layer. The retry list holds either master 86 * ports or slave ports, depending on the direction of the 87 * layer. Thus, a request layer has a retry list containing slave 88 * ports, whereas a response layer holds master ports. 89 */ 90 template <typename SrcType, typename DstType> 91 class Layer : public Drainable 92 { 93 94 public: 95 96 /** 97 * Create a layer and give it a name. The layer uses 98 * the crossbar an event manager. 99 * 100 * @param _port destination port the layer converges at 101 * @param _xbar the crossbar this layer belongs to 102 * @param _name the layer's name 103 */ 104 Layer(DstType& _port, BaseXBar& _xbar, const std::string& _name); 105 106 /** 107 * Drain according to the normal semantics, so that the crossbar 108 * can tell the layer to drain, and pass an event to signal 109 * back when drained. 110 * 111 * @param de drain event to call once drained 112 * 113 * @return 1 if busy or waiting to retry, or 0 if idle 114 */ 115 unsigned int drain(DrainManager *dm); 116 117 /** 118 * Get the crossbar layer's name 119 */ 120 const std::string name() const { return xbar.name() + _name; } 121 122 123 /** 124 * Determine if the layer accepts a packet from a specific 125 * port. If not, the port in question is also added to the 126 * retry list. In either case the state of the layer is 127 * updated accordingly. 128 * 129 * @param port Source port presenting the packet 130 * 131 * @return True if the layer accepts the packet 132 */ 133 bool tryTiming(SrcType* src_port); 134 135 /** 136 * Deal with a destination port accepting a packet by potentially 137 * removing the source port from the retry list (if retrying) and 138 * occupying the layer accordingly. 139 * 140 * @param busy_time Time to spend as a result of a successful send 141 */ 142 void succeededTiming(Tick busy_time); 143 144 /** 145 * Deal with a destination port not accepting a packet by 146 * potentially adding the source port to the retry list (if 147 * not already at the front) and occupying the layer 148 * accordingly. 149 * 150 * @param src_port Source port 151 * @param busy_time Time to spend as a result of a failed send 152 */ 153 void failedTiming(SrcType* src_port, Tick busy_time); 154 155 /** Occupy the layer until until */ 156 void occupyLayer(Tick until); 157 158 /** 159 * Send a retry to the port at the head of waitingForLayer. The 160 * caller must ensure that the list is not empty. 161 */ 162 void retryWaiting(); 163 164 /** 165 * Handle a retry from a neighbouring module. This wraps 166 * retryWaiting by verifying that there are ports waiting 167 * before calling retryWaiting. 168 */ 169 void recvRetry(); 170 171 /** 172 * Register stats for the layer 173 */ 174 void regStats(); 175 176 private: 177 178 /** The destination port this layer converges at. */ 179 DstType& port; 180 181 /** The crossbar this layer is a part of. */ 182 BaseXBar& xbar; 183 184 /** A name for this layer. */ 185 std::string _name; 186 187 /** 188 * We declare an enum to track the state of the layer. The 189 * starting point is an idle state where the layer is waiting 190 * for a packet to arrive. Upon arrival, the layer 191 * transitions to the busy state, where it remains either 192 * until the packet transfer is done, or the header time is 193 * spent. Once the layer leaves the busy state, it can 194 * either go back to idle, if no packets have arrived while it 195 * was busy, or the layer goes on to retry the first port 196 * in waitingForLayer. A similar transition takes place from 197 * idle to retry if the layer receives a retry from one of 198 * its connected ports. The retry state lasts until the port 199 * in questions calls sendTiming and returns control to the 200 * layer, or goes to a busy state if the port does not 201 * immediately react to the retry by calling sendTiming. 202 */ 203 enum State { IDLE, BUSY, RETRY }; 204 205 /** track the state of the layer */ 206 State state; 207 208 /** manager to signal when drained */ 209 DrainManager *drainManager; 210 211 /** 212 * A deque of ports that retry should be called on because 213 * the original send was delayed due to a busy layer. 214 */ 215 std::deque<SrcType*> waitingForLayer; 216 217 /** 218 * Track who is waiting for the retry when receiving it from a 219 * peer. If no port is waiting NULL is stored. 220 */ 221 SrcType* waitingForPeer; 222 223 /** 224 * Release the layer after being occupied and return to an 225 * idle state where we proceed to send a retry to any 226 * potential waiting port, or drain if asked to do so. 227 */ 228 void releaseLayer(); 229 230 /** event used to schedule a release of the layer */ 231 EventWrapper<Layer, &Layer::releaseLayer> releaseEvent; 232 233 /** 234 * Stats for occupancy and utilization. These stats capture 235 * the time the layer spends in the busy state and are thus only 236 * relevant when the memory system is in timing mode. 237 */ 238 Stats::Scalar occupancy; 239 Stats::Formula utilization; 240 241 }; 242 243 /** cycles of overhead per transaction */ 244 const Cycles headerCycles; 245 /** the width of the xbar in bytes */ 246 const uint32_t width; 247 248 AddrRangeMap<PortID> portMap; 249
| 58#include "base/types.hh" 59#include "mem/mem_object.hh" 60#include "params/BaseXBar.hh" 61#include "sim/stats.hh" 62 63/** 64 * The base crossbar contains the common elements of the non-coherent 65 * and coherent crossbar. It is an abstract class that does not have 66 * any of the functionality relating to the actual reception and 67 * transmission of packets, as this is left for the subclasses. 68 * 69 * The BaseXBar is responsible for the basic flow control (busy or 70 * not), the administration of retries, and the address decoding. 71 */ 72class BaseXBar : public MemObject 73{ 74 75 protected: 76 77 /** 78 * A layer is an internal crossbar arbitration point with its own 79 * flow control. Each layer is a converging multiplexer tree. By 80 * instantiating one layer per destination port (and per packet 81 * type, i.e. request, response, snoop request and snoop 82 * response), we model full crossbar structures like AXI, ACE, 83 * PCIe, etc. 84 * 85 * The template parameter, PortClass, indicates the destination 86 * port type for the layer. The retry list holds either master 87 * ports or slave ports, depending on the direction of the 88 * layer. Thus, a request layer has a retry list containing slave 89 * ports, whereas a response layer holds master ports. 90 */ 91 template <typename SrcType, typename DstType> 92 class Layer : public Drainable 93 { 94 95 public: 96 97 /** 98 * Create a layer and give it a name. The layer uses 99 * the crossbar an event manager. 100 * 101 * @param _port destination port the layer converges at 102 * @param _xbar the crossbar this layer belongs to 103 * @param _name the layer's name 104 */ 105 Layer(DstType& _port, BaseXBar& _xbar, const std::string& _name); 106 107 /** 108 * Drain according to the normal semantics, so that the crossbar 109 * can tell the layer to drain, and pass an event to signal 110 * back when drained. 111 * 112 * @param de drain event to call once drained 113 * 114 * @return 1 if busy or waiting to retry, or 0 if idle 115 */ 116 unsigned int drain(DrainManager *dm); 117 118 /** 119 * Get the crossbar layer's name 120 */ 121 const std::string name() const { return xbar.name() + _name; } 122 123 124 /** 125 * Determine if the layer accepts a packet from a specific 126 * port. If not, the port in question is also added to the 127 * retry list. In either case the state of the layer is 128 * updated accordingly. 129 * 130 * @param port Source port presenting the packet 131 * 132 * @return True if the layer accepts the packet 133 */ 134 bool tryTiming(SrcType* src_port); 135 136 /** 137 * Deal with a destination port accepting a packet by potentially 138 * removing the source port from the retry list (if retrying) and 139 * occupying the layer accordingly. 140 * 141 * @param busy_time Time to spend as a result of a successful send 142 */ 143 void succeededTiming(Tick busy_time); 144 145 /** 146 * Deal with a destination port not accepting a packet by 147 * potentially adding the source port to the retry list (if 148 * not already at the front) and occupying the layer 149 * accordingly. 150 * 151 * @param src_port Source port 152 * @param busy_time Time to spend as a result of a failed send 153 */ 154 void failedTiming(SrcType* src_port, Tick busy_time); 155 156 /** Occupy the layer until until */ 157 void occupyLayer(Tick until); 158 159 /** 160 * Send a retry to the port at the head of waitingForLayer. The 161 * caller must ensure that the list is not empty. 162 */ 163 void retryWaiting(); 164 165 /** 166 * Handle a retry from a neighbouring module. This wraps 167 * retryWaiting by verifying that there are ports waiting 168 * before calling retryWaiting. 169 */ 170 void recvRetry(); 171 172 /** 173 * Register stats for the layer 174 */ 175 void regStats(); 176 177 private: 178 179 /** The destination port this layer converges at. */ 180 DstType& port; 181 182 /** The crossbar this layer is a part of. */ 183 BaseXBar& xbar; 184 185 /** A name for this layer. */ 186 std::string _name; 187 188 /** 189 * We declare an enum to track the state of the layer. The 190 * starting point is an idle state where the layer is waiting 191 * for a packet to arrive. Upon arrival, the layer 192 * transitions to the busy state, where it remains either 193 * until the packet transfer is done, or the header time is 194 * spent. Once the layer leaves the busy state, it can 195 * either go back to idle, if no packets have arrived while it 196 * was busy, or the layer goes on to retry the first port 197 * in waitingForLayer. A similar transition takes place from 198 * idle to retry if the layer receives a retry from one of 199 * its connected ports. The retry state lasts until the port 200 * in questions calls sendTiming and returns control to the 201 * layer, or goes to a busy state if the port does not 202 * immediately react to the retry by calling sendTiming. 203 */ 204 enum State { IDLE, BUSY, RETRY }; 205 206 /** track the state of the layer */ 207 State state; 208 209 /** manager to signal when drained */ 210 DrainManager *drainManager; 211 212 /** 213 * A deque of ports that retry should be called on because 214 * the original send was delayed due to a busy layer. 215 */ 216 std::deque<SrcType*> waitingForLayer; 217 218 /** 219 * Track who is waiting for the retry when receiving it from a 220 * peer. If no port is waiting NULL is stored. 221 */ 222 SrcType* waitingForPeer; 223 224 /** 225 * Release the layer after being occupied and return to an 226 * idle state where we proceed to send a retry to any 227 * potential waiting port, or drain if asked to do so. 228 */ 229 void releaseLayer(); 230 231 /** event used to schedule a release of the layer */ 232 EventWrapper<Layer, &Layer::releaseLayer> releaseEvent; 233 234 /** 235 * Stats for occupancy and utilization. These stats capture 236 * the time the layer spends in the busy state and are thus only 237 * relevant when the memory system is in timing mode. 238 */ 239 Stats::Scalar occupancy; 240 Stats::Formula utilization; 241 242 }; 243 244 /** cycles of overhead per transaction */ 245 const Cycles headerCycles; 246 /** the width of the xbar in bytes */ 247 const uint32_t width; 248 249 AddrRangeMap<PortID> portMap; 250
|
| 251 /** 252 * Remember where request packets came from so that we can route 253 * responses to the appropriate port. This relies on the fact that 254 * the underlying Request pointer inside the Packet stays 255 * constant. 256 */ 257 m5::unordered_map<RequestPtr, PortID> routeTo; 258
|
250 /** all contigous ranges seen by this crossbar */ 251 AddrRangeList xbarRanges; 252 253 AddrRange defaultRange; 254 255 /** 256 * Function called by the port when the crossbar is recieving a 257 * range change. 258 * 259 * @param master_port_id id of the port that received the change 260 */ 261 void recvRangeChange(PortID master_port_id); 262 263 /** Find which port connected to this crossbar (if any) should be 264 * given a packet with this address. 265 * 266 * @param addr Address to find port for. 267 * @return id of port that the packet should be sent out of. 268 */ 269 PortID findPort(Addr addr); 270 271 // Cache for the findPort function storing recently used ports from portMap 272 struct PortCache { 273 bool valid; 274 PortID id; 275 AddrRange range; 276 }; 277 278 PortCache portCache[3]; 279 280 // Checks the cache and returns the id of the port that has the requested 281 // address within its range 282 inline PortID checkPortCache(Addr addr) const { 283 if (portCache[0].valid && portCache[0].range.contains(addr)) { 284 return portCache[0].id; 285 } 286 if (portCache[1].valid && portCache[1].range.contains(addr)) { 287 return portCache[1].id; 288 } 289 if (portCache[2].valid && portCache[2].range.contains(addr)) { 290 return portCache[2].id; 291 } 292 293 return InvalidPortID; 294 } 295 296 // Clears the earliest entry of the cache and inserts a new port entry 297 inline void updatePortCache(short id, const AddrRange& range) { 298 portCache[2].valid = portCache[1].valid; 299 portCache[2].id = portCache[1].id; 300 portCache[2].range = portCache[1].range; 301 302 portCache[1].valid = portCache[0].valid; 303 portCache[1].id = portCache[0].id; 304 portCache[1].range = portCache[0].range; 305 306 portCache[0].valid = true; 307 portCache[0].id = id; 308 portCache[0].range = range; 309 } 310 311 // Clears the cache. Needs to be called in constructor. 312 inline void clearPortCache() { 313 portCache[2].valid = false; 314 portCache[1].valid = false; 315 portCache[0].valid = false; 316 } 317 318 /** 319 * Return the address ranges the crossbar is responsible for. 320 * 321 * @return a list of non-overlapping address ranges 322 */ 323 AddrRangeList getAddrRanges() const; 324 325 /** 326 * Calculate the timing parameters for the packet. Updates the 327 * firstWordDelay and lastWordDelay fields of the packet 328 * object with the relative number of ticks required to transmit 329 * the header and the first word, and the last word, respectively. 330 */ 331 void calcPacketTiming(PacketPtr pkt); 332 333 /** 334 * Remember for each of the master ports of the crossbar if we got 335 * an address range from the connected slave. For convenience, 336 * also keep track of if we got ranges from all the slave modules 337 * or not. 338 */ 339 std::vector<bool> gotAddrRanges; 340 bool gotAllAddrRanges; 341 342 /** The master and slave ports of the crossbar */ 343 std::vector<SlavePort*> slavePorts; 344 std::vector<MasterPort*> masterPorts; 345 346 /** Port that handles requests that don't match any of the interfaces.*/ 347 PortID defaultPortID; 348 349 /** If true, use address range provided by default device. Any 350 address not handled by another port and not in default device's 351 range will cause a fatal error. If false, just send all 352 addresses not handled by another port to default device. */ 353 const bool useDefaultRange; 354 355 BaseXBar(const BaseXBarParams *p); 356 357 virtual ~BaseXBar(); 358 359 /** 360 * Stats for transaction distribution and data passing through the 361 * crossbar. The transaction distribution is globally counting 362 * different types of commands. The packet count and total packet 363 * size are two-dimensional vectors that are indexed by the 364 * slave port and master port id (thus the neighbouring master and 365 * neighbouring slave), summing up both directions (request and 366 * response). 367 */ 368 Stats::Vector transDist; 369 Stats::Vector2d pktCount; 370 Stats::Vector2d pktSize; 371 372 public: 373 374 virtual void init(); 375 376 /** A function used to return the port associated with this object. */ 377 BaseMasterPort& getMasterPort(const std::string& if_name, 378 PortID idx = InvalidPortID); 379 BaseSlavePort& getSlavePort(const std::string& if_name, 380 PortID idx = InvalidPortID); 381 382 virtual unsigned int drain(DrainManager *dm) = 0; 383 384 virtual void regStats(); 385 386}; 387 388#endif //__MEM_XBAR_HH__
| 259 /** all contigous ranges seen by this crossbar */ 260 AddrRangeList xbarRanges; 261 262 AddrRange defaultRange; 263 264 /** 265 * Function called by the port when the crossbar is recieving a 266 * range change. 267 * 268 * @param master_port_id id of the port that received the change 269 */ 270 void recvRangeChange(PortID master_port_id); 271 272 /** Find which port connected to this crossbar (if any) should be 273 * given a packet with this address. 274 * 275 * @param addr Address to find port for. 276 * @return id of port that the packet should be sent out of. 277 */ 278 PortID findPort(Addr addr); 279 280 // Cache for the findPort function storing recently used ports from portMap 281 struct PortCache { 282 bool valid; 283 PortID id; 284 AddrRange range; 285 }; 286 287 PortCache portCache[3]; 288 289 // Checks the cache and returns the id of the port that has the requested 290 // address within its range 291 inline PortID checkPortCache(Addr addr) const { 292 if (portCache[0].valid && portCache[0].range.contains(addr)) { 293 return portCache[0].id; 294 } 295 if (portCache[1].valid && portCache[1].range.contains(addr)) { 296 return portCache[1].id; 297 } 298 if (portCache[2].valid && portCache[2].range.contains(addr)) { 299 return portCache[2].id; 300 } 301 302 return InvalidPortID; 303 } 304 305 // Clears the earliest entry of the cache and inserts a new port entry 306 inline void updatePortCache(short id, const AddrRange& range) { 307 portCache[2].valid = portCache[1].valid; 308 portCache[2].id = portCache[1].id; 309 portCache[2].range = portCache[1].range; 310 311 portCache[1].valid = portCache[0].valid; 312 portCache[1].id = portCache[0].id; 313 portCache[1].range = portCache[0].range; 314 315 portCache[0].valid = true; 316 portCache[0].id = id; 317 portCache[0].range = range; 318 } 319 320 // Clears the cache. Needs to be called in constructor. 321 inline void clearPortCache() { 322 portCache[2].valid = false; 323 portCache[1].valid = false; 324 portCache[0].valid = false; 325 } 326 327 /** 328 * Return the address ranges the crossbar is responsible for. 329 * 330 * @return a list of non-overlapping address ranges 331 */ 332 AddrRangeList getAddrRanges() const; 333 334 /** 335 * Calculate the timing parameters for the packet. Updates the 336 * firstWordDelay and lastWordDelay fields of the packet 337 * object with the relative number of ticks required to transmit 338 * the header and the first word, and the last word, respectively. 339 */ 340 void calcPacketTiming(PacketPtr pkt); 341 342 /** 343 * Remember for each of the master ports of the crossbar if we got 344 * an address range from the connected slave. For convenience, 345 * also keep track of if we got ranges from all the slave modules 346 * or not. 347 */ 348 std::vector<bool> gotAddrRanges; 349 bool gotAllAddrRanges; 350 351 /** The master and slave ports of the crossbar */ 352 std::vector<SlavePort*> slavePorts; 353 std::vector<MasterPort*> masterPorts; 354 355 /** Port that handles requests that don't match any of the interfaces.*/ 356 PortID defaultPortID; 357 358 /** If true, use address range provided by default device. Any 359 address not handled by another port and not in default device's 360 range will cause a fatal error. If false, just send all 361 addresses not handled by another port to default device. */ 362 const bool useDefaultRange; 363 364 BaseXBar(const BaseXBarParams *p); 365 366 virtual ~BaseXBar(); 367 368 /** 369 * Stats for transaction distribution and data passing through the 370 * crossbar. The transaction distribution is globally counting 371 * different types of commands. The packet count and total packet 372 * size are two-dimensional vectors that are indexed by the 373 * slave port and master port id (thus the neighbouring master and 374 * neighbouring slave), summing up both directions (request and 375 * response). 376 */ 377 Stats::Vector transDist; 378 Stats::Vector2d pktCount; 379 Stats::Vector2d pktSize; 380 381 public: 382 383 virtual void init(); 384 385 /** A function used to return the port associated with this object. */ 386 BaseMasterPort& getMasterPort(const std::string& if_name, 387 PortID idx = InvalidPortID); 388 BaseSlavePort& getSlavePort(const std::string& if_name, 389 PortID idx = InvalidPortID); 390 391 virtual unsigned int drain(DrainManager *dm) = 0; 392 393 virtual void regStats(); 394 395}; 396 397#endif //__MEM_XBAR_HH__
|