diff options
author | Ron Dreslinski <rdreslin@umich.edu> | 2006-10-10 22:52:52 -0400 |
---|---|---|
committer | Ron Dreslinski <rdreslin@umich.edu> | 2006-10-10 22:52:52 -0400 |
commit | 477a3b0b61db26c86a390a75b2582279738dd221 (patch) | |
tree | 3912e46e8bf2d7ddd4e9b72b3bafff153063642e /src | |
parent | 1de8eae43a5310ff6e6b76ef0554c08800ac01ed (diff) | |
parent | 59dd317cb5251c8cff714a94b5d772af201febbe (diff) | |
download | gem5-477a3b0b61db26c86a390a75b2582279738dd221.tar.xz |
Merge zizzer:/n/wexford/x/gblack/m5/newmem_bus
into zazzer.eecs.umich.edu:/z/rdreslin/m5bk/newmemcleanest
src/mem/bus.cc:
SCCS merged
--HG--
extra : convert_revision : eaae105025635c37af06cf72bb061ce82def9dc9
Diffstat (limited to 'src')
-rw-r--r-- | src/mem/bus.cc | 6 | ||||
-rw-r--r-- | src/mem/bus.hh | 18 | ||||
-rw-r--r-- | src/mem/packet.cc | 10 |
3 files changed, 21 insertions, 13 deletions
diff --git a/src/mem/bus.cc b/src/mem/bus.cc index c475f6d8f..58652ab38 100644 --- a/src/mem/bus.cc +++ b/src/mem/bus.cc @@ -61,7 +61,7 @@ Bus::getPort(const std::string &if_name, int idx) void Bus::init() { - std::vector<Port*>::iterator intIter; + std::vector<BusPort*>::iterator intIter; for (intIter = interfaces.begin(); intIter != interfaces.end(); intIter++) (*intIter)->sendStatusChange(Port::RangeChange); @@ -89,7 +89,7 @@ Bus::recvTiming(Packet *pkt) DPRINTF(Bus, "recvTiming: packet src %d dest %d addr 0x%x cmd %s\n", pkt->getSrc(), pkt->getDest(), pkt->getAddr(), pkt->cmdString()); - Port *pktPort = interfaces[pkt->getSrc()]; + BusPort *pktPort = interfaces[pkt->getSrc()]; // If the bus is busy, or other devices are in line ahead of the current // one, put this device on the retry list. @@ -110,6 +110,7 @@ Bus::recvTiming(Packet *pkt) //Cache-Cache transfer occuring if (inRetry) { DPRINTF(Bus, "Removing RETRY %i\n", retryList.front()); + retryList.front()->onRetryList(false); retryList.pop_front(); inRetry = false; } @@ -185,6 +186,7 @@ Bus::recvTiming(Packet *pkt) // Also take care of retries if (inRetry) { DPRINTF(Bus, "Remove retry from list %i\n", retryList.front()); + retryList.front()->onRetryList(false); retryList.pop_front(); inRetry = false; } diff --git a/src/mem/bus.hh b/src/mem/bus.hh index 4affcd6ae..4f330230f 100644 --- a/src/mem/bus.hh +++ b/src/mem/bus.hh @@ -130,6 +130,8 @@ class Bus : public MemObject of the interfaces connecting to the bus. */ class BusPort : public Port { + bool _onRetryList; + /** A pointer to the bus to which this port belongs. */ Bus *bus; @@ -140,9 +142,15 @@ class Bus : public MemObject /** Constructor for the BusPort.*/ BusPort(const std::string &_name, Bus *_bus, int _id) - : Port(_name), bus(_bus), id(_id) + : Port(_name), _onRetryList(false), bus(_bus), id(_id) { } + bool onRetryList() + { return _onRetryList; } + + void onRetryList(bool newVal) + { _onRetryList = newVal; } + protected: /** When reciving a timing request from the peer port (at id), @@ -199,17 +207,19 @@ class Bus : public MemObject /** An array of pointers to the peer port interfaces connected to this bus.*/ - std::vector<Port*> interfaces; + std::vector<BusPort*> interfaces; /** An array of pointers to ports that retry should be called on because the * original send failed for whatever reason.*/ - std::list<Port*> retryList; + std::list<BusPort*> retryList; - void addToRetryList(Port * port) + void addToRetryList(BusPort * port) { if (!inRetry) { // The device wasn't retrying a packet, or wasn't at an appropriate // time. + assert(!port->onRetryList()); + port->onRetryList(true); retryList.push_back(port); } else { // The device was retrying a packet. It didn't work, so we'll leave diff --git a/src/mem/packet.cc b/src/mem/packet.cc index 91298df8c..7b8fa4a96 100644 --- a/src/mem/packet.cc +++ b/src/mem/packet.cc @@ -102,15 +102,11 @@ bool Packet::intersect(Packet *p) { Addr s1 = getAddr(); - Addr e1 = getAddr() + getSize(); + Addr e1 = getAddr() + getSize() - 1; Addr s2 = p->getAddr(); - Addr e2 = p->getAddr() + p->getSize(); + Addr e2 = p->getAddr() + p->getSize() - 1; - if (s1 >= s2 && s1 < e2) - return true; - if (e1 >= s2 && e1 < e2) - return true; - return false; + return !(s1 > e2 || e1 < s2); } bool |