Added code to handle draining.
--HG-- extra : convert_revision : 3861f553bde5865cd21a8a58a4c410896726f0a3
This commit is contained in:
parent
6f78d49410
commit
8dbab9f701
2 changed files with 21 additions and 0 deletions
|
@ -239,6 +239,9 @@ Bus::recvRetry(int id)
|
||||||
busIdle.reschedule(tickNextIdle);
|
busIdle.reschedule(tickNextIdle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//If we weren't able to drain before, we might be able to now.
|
||||||
|
if (drainEvent && retryList.size() == 0 && curTick >= tickNextIdle)
|
||||||
|
drainEvent->process();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -498,6 +501,20 @@ Bus::addressRanges(AddrRangeList &resp, AddrRangeList &snoop, int id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int
|
||||||
|
Bus::drain(Event * de)
|
||||||
|
{
|
||||||
|
//We should check that we're not "doing" anything, and that noone is
|
||||||
|
//waiting. We might be idle but have someone waiting if the device we
|
||||||
|
//contacted for a retry didn't actually retry.
|
||||||
|
if (curTick >= tickNextIdle && retryList.size() == 0) {
|
||||||
|
drainEvent = de;
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BEGIN_DECLARE_SIM_OBJECT_PARAMS(Bus)
|
BEGIN_DECLARE_SIM_OBJECT_PARAMS(Bus)
|
||||||
|
|
||||||
Param<int> bus_id;
|
Param<int> bus_id;
|
||||||
|
|
|
@ -59,6 +59,8 @@ class Bus : public MemObject
|
||||||
/** the next tick at which the bus will be idle */
|
/** the next tick at which the bus will be idle */
|
||||||
Tick tickNextIdle;
|
Tick tickNextIdle;
|
||||||
|
|
||||||
|
Event * drainEvent;
|
||||||
|
|
||||||
static const int defaultId = -3; //Make it unique from Broadcast
|
static const int defaultId = -3; //Make it unique from Broadcast
|
||||||
|
|
||||||
struct DevMap {
|
struct DevMap {
|
||||||
|
@ -247,6 +249,8 @@ class Bus : public MemObject
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
|
|
||||||
|
unsigned int drain(Event *de);
|
||||||
|
|
||||||
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), inRetry(false), defaultPort(NULL)
|
tickNextIdle(0), busIdle(this), inRetry(false), defaultPort(NULL)
|
||||||
|
|
Loading…
Reference in a new issue