MEM: Separate requests and responses for timing accesses

This patch moves send/recvTiming and send/recvTimingSnoop from the
Port base class to the MasterPort and SlavePort, and also splits them
into separate member functions for requests and responses:
send/recvTimingReq, send/recvTimingResp, and send/recvTimingSnoopReq,
send/recvTimingSnoopResp. A master port sends requests and receives
responses, and also receives snoop requests and sends snoop
responses. A slave port has the reciprocal behaviour as it receives
requests and sends responses, and sends snoop requests and receives
snoop responses.

For all MemObjects that have only master ports or slave ports (but not
both), e.g. a CPU, or a PIO device, this patch merely adds more
clarity to what kind of access is taking place. For example, a CPU
port used to call sendTiming, and will now call
sendTimingReq. Similarly, a response previously came back through
recvTiming, which is now recvTimingResp. For the modules that have
both master and slave ports, e.g. the bus, the behaviour was
previously relying on branches based on pkt->isRequest(), and this is
now replaced with a direct call to the apprioriate member function
depending on the type of access. Please note that send/recvRetry is
still shared by all the timing accessors and remains in the Port base
class for now (to maintain the current bus functionality and avoid
changing the statistics of all regressions).

The packet queue is split into a MasterPort and SlavePort version to
facilitate the use of the new timing accessors. All uses of the
PacketQueue are updated accordingly.

With this patch, the type of packet (request or response) is now well
defined for each type of access, and asserts on pkt->isRequest() and
pkt->isResponse() are now moved to the appropriate send member
functions. It is also worth noting that sendTimingSnoopReq no longer
returns a boolean, as the semantics do not alow snoop requests to be
rejected or stalled. All these assumptions are now excplicitly part of
the port interface itself.
This commit is contained in:
Andreas Hansson
2012-05-01 13:40:42 -04:00
parent 8966e6d36d
commit 3fea59e162
47 changed files with 546 additions and 424 deletions

View File

@@ -80,7 +80,7 @@ InvalidateGenerator::initiate()
*dummyData = 0;
pkt->dataDynamic(dummyData);
if (port->sendTiming(pkt)) {
if (port->sendTimingReq(pkt)) {
DPRINTF(DirectedTest, "initiating request - successful\n");
if (m_status == InvalidateGeneratorStatus_Load_Waiting) {
m_status = InvalidateGeneratorStatus_Load_Pending;

View File

@@ -91,7 +91,7 @@ RubyDirectedTester::getMasterPort(const std::string &if_name, int idx)
}
bool
RubyDirectedTester::CpuPort::recvTiming(PacketPtr pkt)
RubyDirectedTester::CpuPort::recvTimingResp(PacketPtr pkt)
{
tester->hitCallback(id, pkt->getAddr());

View File

@@ -59,7 +59,7 @@ class RubyDirectedTester : public MemObject
{}
protected:
virtual bool recvTiming(PacketPtr pkt);
virtual bool recvTimingResp(PacketPtr pkt);
virtual void recvRetry()
{ panic("%s does not expect a retry\n", name()); }
};

View File

@@ -70,7 +70,7 @@ SeriesRequestGenerator::initiate()
*dummyData = 0;
pkt->dataDynamic(dummyData);
if (port->sendTiming(pkt)) {
if (port->sendTimingReq(pkt)) {
DPRINTF(DirectedTest, "initiating request - successful\n");
m_status = SeriesRequestGeneratorStatus_Request_Pending;
return true;

View File

@@ -53,9 +53,8 @@ using namespace std;
int TESTER_ALLOCATOR=0;
bool
MemTest::CpuPort::recvTiming(PacketPtr pkt)
MemTest::CpuPort::recvTimingResp(PacketPtr pkt)
{
assert(pkt->isResponse());
memtest->completeRequest(pkt);
return true;
}
@@ -72,7 +71,7 @@ MemTest::sendPkt(PacketPtr pkt) {
cachePort.sendAtomic(pkt);
completeRequest(pkt);
}
else if (!cachePort.sendTiming(pkt)) {
else if (!cachePort.sendTimingReq(pkt)) {
DPRINTF(MemTest, "accessRetry setting to true\n");
//
@@ -379,7 +378,7 @@ MemTest::tick()
void
MemTest::doRetry()
{
if (cachePort.sendTiming(retryPkt)) {
if (cachePort.sendTimingReq(retryPkt)) {
DPRINTF(MemTest, "accessRetry setting to false\n");
accessRetry = false;
retryPkt = NULL;

View File

@@ -97,9 +97,9 @@ class MemTest : public MemObject
protected:
virtual bool recvTiming(PacketPtr pkt);
virtual bool recvTimingResp(PacketPtr pkt);
virtual bool recvTimingSnoop(PacketPtr pkt) { return true; }
virtual void recvTimingSnoopReq(PacketPtr pkt) { }
virtual Tick recvAtomicSnoop(PacketPtr pkt) { return 0; }

View File

@@ -51,9 +51,8 @@ using namespace std;
int TESTER_NETWORK=0;
bool
NetworkTest::CpuPort::recvTiming(PacketPtr pkt)
NetworkTest::CpuPort::recvTimingResp(PacketPtr pkt)
{
assert(pkt->isResponse());
networktest->completeRequest(pkt);
return true;
}
@@ -67,7 +66,7 @@ NetworkTest::CpuPort::recvRetry()
void
NetworkTest::sendPkt(PacketPtr pkt)
{
if (!cachePort.sendTiming(pkt)) {
if (!cachePort.sendTimingReq(pkt)) {
retryPkt = pkt; // RubyPort will retry sending
}
numPacketsSent++;
@@ -269,7 +268,7 @@ NetworkTest::generatePkt()
void
NetworkTest::doRetry()
{
if (cachePort.sendTiming(retryPkt)) {
if (cachePort.sendTimingReq(retryPkt)) {
retryPkt = NULL;
}
}

View File

@@ -92,7 +92,7 @@ class NetworkTest : public MemObject
protected:
virtual bool recvTiming(PacketPtr pkt);
virtual bool recvTimingResp(PacketPtr pkt);
virtual void recvRetry();
};

View File

@@ -114,7 +114,7 @@ Check::initiatePrefetch()
pkt->senderState =
new SenderState(m_address, req->getSize(), pkt->senderState);
if (port->sendTiming(pkt)) {
if (port->sendTimingReq(pkt)) {
DPRINTF(RubyTest, "successfully initiated prefetch.\n");
} else {
// If the packet did not issue, must delete
@@ -154,7 +154,7 @@ Check::initiateFlush()
pkt->senderState =
new SenderState(m_address, req->getSize(), pkt->senderState);
if (port->sendTiming(pkt)) {
if (port->sendTimingReq(pkt)) {
DPRINTF(RubyTest, "initiating Flush - successful\n");
}
}
@@ -201,7 +201,7 @@ Check::initiateAction()
pkt->senderState =
new SenderState(writeAddr, req->getSize(), pkt->senderState);
if (port->sendTiming(pkt)) {
if (port->sendTimingReq(pkt)) {
DPRINTF(RubyTest, "initiating action - successful\n");
DPRINTF(RubyTest, "status before action update: %s\n",
(TesterStatus_to_string(m_status)).c_str());
@@ -253,7 +253,7 @@ Check::initiateCheck()
pkt->senderState =
new SenderState(m_address, req->getSize(), pkt->senderState);
if (port->sendTiming(pkt)) {
if (port->sendTimingReq(pkt)) {
DPRINTF(RubyTest, "initiating check - successful\n");
DPRINTF(RubyTest, "status before check update: %s\n",
TesterStatus_to_string(m_status).c_str());

View File

@@ -145,7 +145,7 @@ RubyTester::getMasterPort(const std::string &if_name, int idx)
}
bool
RubyTester::CpuPort::recvTiming(PacketPtr pkt)
RubyTester::CpuPort::recvTimingResp(PacketPtr pkt)
{
// retrieve the subblock and call hitCallback
RubyTester::SenderState* senderState =

View File

@@ -62,7 +62,7 @@ class RubyTester : public MemObject
{}
protected:
virtual bool recvTiming(PacketPtr pkt);
virtual bool recvTimingResp(PacketPtr pkt);
virtual void recvRetry()
{ panic("%s does not expect a retry\n", name()); }
};