Changed the bus to use a bool to keep track of retries rather than a pointer
src/mem/tport.cc: minor formatting tweak --HG-- extra : convert_revision : 7391d142815c5876fcc0f991bd053e6a1781c101
This commit is contained in:
parent
5f9aca531d
commit
549412b333
|
@ -68,13 +68,11 @@ Bus::init()
|
||||||
}
|
}
|
||||||
|
|
||||||
Bus::BusFreeEvent::BusFreeEvent(Bus *_bus) : Event(&mainEventQueue), bus(_bus)
|
Bus::BusFreeEvent::BusFreeEvent(Bus *_bus) : Event(&mainEventQueue), bus(_bus)
|
||||||
{
|
{}
|
||||||
assert(!scheduled());
|
|
||||||
}
|
|
||||||
|
|
||||||
void Bus::BusFreeEvent::process()
|
void Bus::BusFreeEvent::process()
|
||||||
{
|
{
|
||||||
bus->recvRetry(0);
|
bus->recvRetry(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * Bus::BusFreeEvent::description()
|
const char * Bus::BusFreeEvent::description()
|
||||||
|
@ -96,7 +94,7 @@ Bus::recvTiming(Packet *pkt)
|
||||||
// If the bus is busy, or other devices are in line ahead of the current
|
// If the bus is busy, or other devices are in line ahead of the current
|
||||||
// one, put this device on the retry list.
|
// one, put this device on the retry list.
|
||||||
if (tickNextIdle > curTick ||
|
if (tickNextIdle > curTick ||
|
||||||
(retryList.size() && pktPort != retryingPort)) {
|
(retryList.size() && (!inRetry || pktPort != retryList.front()))) {
|
||||||
addToRetryList(pktPort);
|
addToRetryList(pktPort);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -109,9 +107,9 @@ Bus::recvTiming(Packet *pkt)
|
||||||
assert(success);
|
assert(success);
|
||||||
if (pkt->flags & SATISFIED) {
|
if (pkt->flags & SATISFIED) {
|
||||||
//Cache-Cache transfer occuring
|
//Cache-Cache transfer occuring
|
||||||
if (retryingPort) {
|
if (inRetry) {
|
||||||
retryList.pop_front();
|
retryList.pop_front();
|
||||||
retryingPort = NULL;
|
inRetry = false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -182,9 +180,9 @@ Bus::recvTiming(Packet *pkt)
|
||||||
if (port->sendTiming(pkt)) {
|
if (port->sendTiming(pkt)) {
|
||||||
// Packet was successfully sent. Return true.
|
// Packet was successfully sent. Return true.
|
||||||
// Also take care of retries
|
// Also take care of retries
|
||||||
if (retryingPort) {
|
if (inRetry) {
|
||||||
retryList.pop_front();
|
retryList.pop_front();
|
||||||
retryingPort = NULL;
|
inRetry = false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -199,14 +197,14 @@ Bus::recvRetry(int id)
|
||||||
{
|
{
|
||||||
// If there's anything waiting...
|
// If there's anything waiting...
|
||||||
if (retryList.size()) {
|
if (retryList.size()) {
|
||||||
retryingPort = retryList.front();
|
//retryingPort = retryList.front();
|
||||||
retryingPort->sendRetry();
|
inRetry = true;
|
||||||
// If the retryingPort pointer isn't null, sendTiming wasn't called
|
retryList.front()->sendRetry();
|
||||||
if (retryingPort) {
|
// If inRetry is still true, sendTiming wasn't called
|
||||||
warn("sendRetry didn't call sendTiming\n");
|
if (inRetry)
|
||||||
retryList.pop_front();
|
panic("Port %s didn't call sendTiming in it's recvRetry\n",\
|
||||||
retryingPort = NULL;
|
retryList.front()->getPeer()->name());
|
||||||
}
|
//assert(!inRetry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,7 @@ class Bus : public MemObject
|
||||||
|
|
||||||
BusFreeEvent busIdle;
|
BusFreeEvent busIdle;
|
||||||
|
|
||||||
Port * retryingPort;
|
bool inRetry;
|
||||||
|
|
||||||
/** An array of pointers to the peer port interfaces
|
/** An array of pointers to the peer port interfaces
|
||||||
connected to this bus.*/
|
connected to this bus.*/
|
||||||
|
@ -207,18 +207,18 @@ class Bus : public MemObject
|
||||||
|
|
||||||
void addToRetryList(Port * port)
|
void addToRetryList(Port * port)
|
||||||
{
|
{
|
||||||
if (!retryingPort) {
|
if (!inRetry) {
|
||||||
// The device wasn't retrying a packet, or wasn't at an appropriate
|
// The device wasn't retrying a packet, or wasn't at an appropriate
|
||||||
// time.
|
// time.
|
||||||
retryList.push_back(port);
|
retryList.push_back(port);
|
||||||
} else {
|
} else {
|
||||||
// The device was retrying a packet. It didn't work, so we'll leave
|
// The device was retrying a packet. It didn't work, so we'll leave
|
||||||
// it at the head of the retry list.
|
// it at the head of the retry list.
|
||||||
retryingPort = NULL;
|
inRetry = false;
|
||||||
|
|
||||||
// We shouldn't be receiving a packet from one port when a different
|
/* // We shouldn't be receiving a packet from one port when a different
|
||||||
// one is retrying.
|
// one is retrying.
|
||||||
assert(port == retryingPort);
|
assert(port == retryingPort);*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,11 +234,13 @@ class Bus : public MemObject
|
||||||
|
|
||||||
Bus(const std::string &n, int bus_id, int _clock, int _width)
|
Bus(const std::string &n, int bus_id, int _clock, int _width)
|
||||||
: MemObject(n), busId(bus_id), clock(_clock), width(_width),
|
: MemObject(n), busId(bus_id), clock(_clock), width(_width),
|
||||||
tickNextIdle(0), busIdle(this), retryingPort(NULL), defaultPort(NULL)
|
tickNextIdle(0), busIdle(this), inRetry(false), defaultPort(NULL)
|
||||||
{
|
{
|
||||||
//Both the width and clock period must be positive
|
//Both the width and clock period must be positive
|
||||||
assert(width);
|
if (width <= 0)
|
||||||
assert(clock);
|
fatal("Bus width must be positive\n");
|
||||||
|
if (clock <= 0)
|
||||||
|
fatal("Bus clock period must be positive\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -79,8 +79,7 @@ SimpleTimingPort::SendEvent::process()
|
||||||
assert(port->outTiming >= 0);
|
assert(port->outTiming >= 0);
|
||||||
if (port->transmitList.size()) {
|
if (port->transmitList.size()) {
|
||||||
port->transmitList.push_back(packet);
|
port->transmitList.push_back(packet);
|
||||||
}
|
} else if (port->sendTiming(packet)) {
|
||||||
else if (port->sendTiming(packet)) {
|
|
||||||
// send successful
|
// send successful
|
||||||
if (port->transmitList.size() == 0 && port->drainEvent) {
|
if (port->transmitList.size() == 0 && port->drainEvent) {
|
||||||
port->drainEvent->process();
|
port->drainEvent->process();
|
||||||
|
|
Loading…
Reference in a new issue