xbar.hh (12084:5a3769ff3d55) xbar.hh (12778:ca8c50112a66)
1/*
2 * Copyright (c) 2011-2015 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

--- 305 unchanged lines hidden (view full) ---

314 const Cycles frontendLatency;
315 /** Cycles of forward latency */
316 const Cycles forwardLatency;
317 /** Cycles of response latency */
318 const Cycles responseLatency;
319 /** the width of the xbar in bytes */
320 const uint32_t width;
321
1/*
2 * Copyright (c) 2011-2015 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

--- 305 unchanged lines hidden (view full) ---

314 const Cycles frontendLatency;
315 /** Cycles of forward latency */
316 const Cycles forwardLatency;
317 /** Cycles of response latency */
318 const Cycles responseLatency;
319 /** the width of the xbar in bytes */
320 const uint32_t width;
321
322 AddrRangeMap portMap;
322 AddrRangeMap<PortID, 3> portMap;
323
324 /**
325 * Remember where request packets came from so that we can route
326 * responses to the appropriate port. This relies on the fact that
327 * the underlying Request pointer inside the Packet stays
328 * constant.
329 */
330 std::unordered_map<RequestPtr, PortID> routeTo;

--- 14 unchanged lines hidden (view full) ---

345 /** Find which port connected to this crossbar (if any) should be
346 * given a packet with this address.
347 *
348 * @param addr Address to find port for.
349 * @return id of port that the packet should be sent out of.
350 */
351 PortID findPort(Addr addr);
352
323
324 /**
325 * Remember where request packets came from so that we can route
326 * responses to the appropriate port. This relies on the fact that
327 * the underlying Request pointer inside the Packet stays
328 * constant.
329 */
330 std::unordered_map<RequestPtr, PortID> routeTo;

--- 14 unchanged lines hidden (view full) ---

345 /** Find which port connected to this crossbar (if any) should be
346 * given a packet with this address.
347 *
348 * @param addr Address to find port for.
349 * @return id of port that the packet should be sent out of.
350 */
351 PortID findPort(Addr addr);
352
353 // Cache for the findPort function storing recently used ports from portMap
354 struct PortCache {
355 bool valid;
356 PortID id;
357 AddrRange range;
358 };
359
360 PortCache portCache[3];
361
362 // Checks the cache and returns the id of the port that has the requested
363 // address within its range
364 inline PortID checkPortCache(Addr addr) const {
365 if (portCache[0].valid && portCache[0].range.contains(addr)) {
366 return portCache[0].id;
367 }
368 if (portCache[1].valid && portCache[1].range.contains(addr)) {
369 return portCache[1].id;
370 }
371 if (portCache[2].valid && portCache[2].range.contains(addr)) {
372 return portCache[2].id;
373 }
374
375 return InvalidPortID;
376 }
377
378 // Clears the earliest entry of the cache and inserts a new port entry
379 inline void updatePortCache(short id, const AddrRange& range) {
380 portCache[2].valid = portCache[1].valid;
381 portCache[2].id = portCache[1].id;
382 portCache[2].range = portCache[1].range;
383
384 portCache[1].valid = portCache[0].valid;
385 portCache[1].id = portCache[0].id;
386 portCache[1].range = portCache[0].range;
387
388 portCache[0].valid = true;
389 portCache[0].id = id;
390 portCache[0].range = range;
391 }
392
393 // Clears the cache. Needs to be called in constructor.
394 inline void clearPortCache() {
395 portCache[2].valid = false;
396 portCache[1].valid = false;
397 portCache[0].valid = false;
398 }
399
400 /**
401 * Return the address ranges the crossbar is responsible for.
402 *
403 * @return a list of non-overlapping address ranges
404 */
405 AddrRangeList getAddrRanges() const;
406
407 /**

--- 64 unchanged lines hidden ---
353 /**
354 * Return the address ranges the crossbar is responsible for.
355 *
356 * @return a list of non-overlapping address ranges
357 */
358 AddrRangeList getAddrRanges() const;
359
360 /**

--- 64 unchanged lines hidden ---