From 36d199b9a96838359230f1ae8a40446e05296145 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Mon, 15 Oct 2012 08:07:04 -0400 Subject: Mem: Use range operations in bus in preparation for striping This patch transitions the bus to use the AddrRange operations instead of directly accessing the start and end. The change facilitates the move to a more elaborate AddrRange class that also supports address striping in the bus by specifying interleaving bits in the ranges. Two new functions are added to the AddrRange to determine if two ranges intersect, and if one is a subset of another. The bus propagation of address ranges is also tweaked such that an update is only propagated if the bus received information from all the downstream slave modules. This avoids the iteration and need for the cycle-breaking scheme that was previously used. --- src/mem/bus.hh | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/mem/bus.hh') diff --git a/src/mem/bus.hh b/src/mem/bus.hh index a3469a478..849bef639 100644 --- a/src/mem/bus.hh +++ b/src/mem/bus.hh @@ -236,7 +236,7 @@ class BaseBus : public MemObject typedef AddrRangeMap::const_iterator PortMapConstIter; AddrRangeMap portMap; - AddrRangeList defaultRange; + AddrRange defaultRange; /** * Function called by the port when the bus is recieving a range change. @@ -256,25 +256,21 @@ class BaseBus : public MemObject struct PortCache { bool valid; PortID id; - Addr start; - Addr end; + AddrRange range; }; PortCache portCache[3]; // Checks the cache and returns the id of the port that has the requested // address within its range - inline PortID checkPortCache(Addr addr) { - if (portCache[0].valid && addr >= portCache[0].start && - addr < portCache[0].end) { + inline PortID checkPortCache(Addr addr) const { + if (portCache[0].valid && portCache[0].range == addr) { return portCache[0].id; } - if (portCache[1].valid && addr >= portCache[1].start && - addr < portCache[1].end) { + if (portCache[1].valid && portCache[1].range == addr) { return portCache[1].id; } - if (portCache[2].valid && addr >= portCache[2].start && - addr < portCache[2].end) { + if (portCache[2].valid && portCache[2].range == addr) { return portCache[2].id; } @@ -282,21 +278,18 @@ class BaseBus : public MemObject } // Clears the earliest entry of the cache and inserts a new port entry - inline void updatePortCache(short id, Addr start, Addr end) { + inline void updatePortCache(short id, const AddrRange& range) { portCache[2].valid = portCache[1].valid; portCache[2].id = portCache[1].id; - portCache[2].start = portCache[1].start; - portCache[2].end = portCache[1].end; + portCache[2].range = portCache[1].range; portCache[1].valid = portCache[0].valid; portCache[1].id = portCache[0].id; - portCache[1].start = portCache[0].start; - portCache[1].end = portCache[0].end; + portCache[1].range = portCache[0].range; portCache[0].valid = true; portCache[0].id = id; - portCache[0].start = start; - portCache[0].end = end; + portCache[0].range = range; } // Clears the cache. Needs to be called in constructor. @@ -329,7 +322,14 @@ class BaseBus : public MemObject */ unsigned deviceBlockSize() const; - std::set inRecvRangeChange; + /** + * Remember for each of the master ports of the bus if we got an + * address range from the connected slave. For convenience, also + * keep track of if we got ranges from all the slave modules or + * not. + */ + std::vector gotAddrRanges; + bool gotAllAddrRanges; /** The master and slave ports of the bus */ std::vector slavePorts; -- cgit v1.2.3