2011-03-22 03:51:58 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2009 Advanced Micro Devices, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met: redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer;
|
|
|
|
* redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution;
|
|
|
|
* neither the name of the copyright holders nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived from
|
|
|
|
* this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* Authors: Tushar Krishna
|
|
|
|
*/
|
|
|
|
|
2011-04-15 19:44:06 +02:00
|
|
|
#include <cmath>
|
2011-03-22 03:51:58 +01:00
|
|
|
#include <iomanip>
|
|
|
|
#include <set>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "base/misc.hh"
|
2014-09-03 13:42:54 +02:00
|
|
|
#include "base/random.hh"
|
2011-03-22 03:51:58 +01:00
|
|
|
#include "base/statistics.hh"
|
|
|
|
#include "cpu/testers/networktest/networktest.hh"
|
2011-04-15 19:44:32 +02:00
|
|
|
#include "debug/NetworkTest.hh"
|
2011-03-22 03:51:58 +01:00
|
|
|
#include "mem/mem_object.hh"
|
|
|
|
#include "mem/packet.hh"
|
2011-04-15 19:44:06 +02:00
|
|
|
#include "mem/port.hh"
|
2011-03-22 03:51:58 +01:00
|
|
|
#include "mem/request.hh"
|
|
|
|
#include "sim/sim_events.hh"
|
|
|
|
#include "sim/stats.hh"
|
2012-02-12 23:07:38 +01:00
|
|
|
#include "sim/system.hh"
|
2011-03-22 03:51:58 +01:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
int TESTER_NETWORK=0;
|
|
|
|
|
|
|
|
bool
|
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.
2012-05-01 19:40:42 +02:00
|
|
|
NetworkTest::CpuPort::recvTimingResp(PacketPtr pkt)
|
2011-03-22 03:51:58 +01:00
|
|
|
{
|
MEM: Separate snoops and normal memory requests/responses
This patch introduces port access methods that separates snoop
request/responses from normal memory request/responses. The
differentiation is made for functional, atomic and timing accesses and
builds on the introduction of master and slave ports.
Before the introduction of this patch, the packets belonging to the
different phases of the protocol (request -> [forwarded snoop request
-> snoop response]* -> response) all use the same port access
functions, even though the snoop packets flow in the opposite
direction to the normal packet. That is, a coherent master sends
normal request and receives responses, but receives snoop requests and
sends snoop responses (vice versa for the slave). These two distinct
phases now use different access functions, as described below.
Starting with the functional access, a master sends a request to a
slave through sendFunctional, and the request packet is turned into a
response before the call returns. In a system without cache coherence,
this is all that is needed from the functional interface. For the
cache-coherent scenario, a slave also sends snoop requests to coherent
masters through sendFunctionalSnoop, with responses returned within
the same packet pointer. This is currently used by the bus and caches,
and the LSQ of the O3 CPU. The send/recvFunctional and
send/recvFunctionalSnoop are moved from the Port super class to the
appropriate subclass.
Atomic accesses follow the same flow as functional accesses, with
request being sent from master to slave through sendAtomic. In the
case of cache-coherent ports, a slave can send snoop requests to a
master through sendAtomicSnoop. Just as for the functional access
methods, the atomic send and receive member functions are moved to the
appropriate subclasses.
The timing access methods are different from the functional and atomic
in that requests and responses are separated in time and
send/recvTiming are used for both directions. Hence, a master uses
sendTiming to send a request to a slave, and a slave uses sendTiming
to send a response back to a master, at a later point in time. Snoop
requests and responses travel in the opposite direction, similar to
what happens in functional and atomic accesses. With the introduction
of this patch, it is possible to determine the direction of packets in
the bus, and no longer necessary to look for both a master and a slave
port with the requested port id.
In contrast to the normal recvFunctional, recvAtomic and recvTiming
that are pure virtual functions, the recvFunctionalSnoop,
recvAtomicSnoop and recvTimingSnoop have a default implementation that
calls panic. This is to allow non-coherent master and slave ports to
not implement these functions.
2012-04-14 11:45:07 +02:00
|
|
|
networktest->completeRequest(pkt);
|
2011-03-22 03:51:58 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-03-02 10:00:35 +01:00
|
|
|
NetworkTest::CpuPort::recvReqRetry()
|
2011-03-22 03:51:58 +01:00
|
|
|
{
|
|
|
|
networktest->doRetry();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NetworkTest::sendPkt(PacketPtr pkt)
|
|
|
|
{
|
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.
2012-05-01 19:40:42 +02:00
|
|
|
if (!cachePort.sendTimingReq(pkt)) {
|
2011-05-07 23:43:30 +02:00
|
|
|
retryPkt = pkt; // RubyPort will retry sending
|
2011-03-22 03:51:58 +01:00
|
|
|
}
|
2011-05-07 23:43:30 +02:00
|
|
|
numPacketsSent++;
|
2011-03-22 03:51:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
NetworkTest::NetworkTest(const Params *p)
|
|
|
|
: MemObject(p),
|
|
|
|
tickEvent(this),
|
|
|
|
cachePort("network-test", this),
|
|
|
|
retryPkt(NULL),
|
|
|
|
size(p->memory_size),
|
|
|
|
blockSizeBits(p->block_offset),
|
|
|
|
numMemories(p->num_memories),
|
2011-05-07 23:43:30 +02:00
|
|
|
simCycles(p->sim_cycles),
|
2011-03-22 03:51:58 +01:00
|
|
|
fixedPkts(p->fixed_pkts),
|
|
|
|
maxPackets(p->max_packets),
|
2014-09-09 10:36:31 +02:00
|
|
|
numPacketsSent(0),
|
2011-03-22 03:51:58 +01:00
|
|
|
trafficType(p->traffic_type),
|
|
|
|
injRate(p->inj_rate),
|
2012-02-12 23:07:38 +01:00
|
|
|
precision(p->precision),
|
|
|
|
masterId(p->system->getMasterId(name()))
|
2011-03-22 03:51:58 +01:00
|
|
|
{
|
|
|
|
// set up counters
|
|
|
|
noResponseCycles = 0;
|
|
|
|
schedule(tickEvent, 0);
|
|
|
|
|
|
|
|
id = TESTER_NETWORK++;
|
|
|
|
DPRINTF(NetworkTest,"Config Created: Name = %s , and id = %d\n",
|
|
|
|
name(), id);
|
|
|
|
}
|
|
|
|
|
2012-10-15 14:12:35 +02:00
|
|
|
BaseMasterPort &
|
|
|
|
NetworkTest::getMasterPort(const std::string &if_name, PortID idx)
|
2011-03-22 03:51:58 +01:00
|
|
|
{
|
|
|
|
if (if_name == "test")
|
MEM: Introduce the master/slave port sub-classes in C++
This patch introduces the notion of a master and slave port in the C++
code, thus bringing the previous classification from the Python
classes into the corresponding simulation objects and memory objects.
The patch enables us to classify behaviours into the two bins and add
assumptions and enfore compliance, also simplifying the two
interfaces. As a starting point, isSnooping is confined to a master
port, and getAddrRanges to slave ports. More of these specilisations
are to come in later patches.
The getPort function is not getMasterPort and getSlavePort, and
returns a port reference rather than a pointer as NULL would never be
a valid return value. The default implementation of these two
functions is placed in MemObject, and calls fatal.
The one drawback with this specific patch is that it requires some
code duplication, e.g. QueuedPort becomes QueuedMasterPort and
QueuedSlavePort, and BusPort becomes BusMasterPort and BusSlavePort
(avoiding multiple inheritance). With the later introduction of the
port interfaces, moving the functionality outside the port itself, a
lot of the duplicated code will disappear again.
2012-03-30 15:40:11 +02:00
|
|
|
return cachePort;
|
2011-03-22 03:51:58 +01:00
|
|
|
else
|
MEM: Introduce the master/slave port sub-classes in C++
This patch introduces the notion of a master and slave port in the C++
code, thus bringing the previous classification from the Python
classes into the corresponding simulation objects and memory objects.
The patch enables us to classify behaviours into the two bins and add
assumptions and enfore compliance, also simplifying the two
interfaces. As a starting point, isSnooping is confined to a master
port, and getAddrRanges to slave ports. More of these specilisations
are to come in later patches.
The getPort function is not getMasterPort and getSlavePort, and
returns a port reference rather than a pointer as NULL would never be
a valid return value. The default implementation of these two
functions is placed in MemObject, and calls fatal.
The one drawback with this specific patch is that it requires some
code duplication, e.g. QueuedPort becomes QueuedMasterPort and
QueuedSlavePort, and BusPort becomes BusMasterPort and BusSlavePort
(avoiding multiple inheritance). With the later introduction of the
port interfaces, moving the functionality outside the port itself, a
lot of the duplicated code will disappear again.
2012-03-30 15:40:11 +02:00
|
|
|
return MemObject::getMasterPort(if_name, idx);
|
2011-03-22 03:51:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NetworkTest::init()
|
|
|
|
{
|
|
|
|
numPacketsSent = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
NetworkTest::completeRequest(PacketPtr pkt)
|
|
|
|
{
|
|
|
|
Request *req = pkt->req;
|
|
|
|
|
|
|
|
DPRINTF(NetworkTest, "Completed injection of %s packet for address %x\n",
|
|
|
|
pkt->isWrite() ? "write" : "read\n",
|
|
|
|
req->getPaddr());
|
|
|
|
|
|
|
|
assert(pkt->isResponse());
|
|
|
|
noResponseCycles = 0;
|
2011-03-23 04:38:09 +01:00
|
|
|
delete req;
|
2011-03-22 03:51:58 +01:00
|
|
|
delete pkt;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
NetworkTest::tick()
|
|
|
|
{
|
|
|
|
if (++noResponseCycles >= 500000) {
|
|
|
|
cerr << name() << ": deadlocked at cycle " << curTick() << endl;
|
|
|
|
fatal("");
|
|
|
|
}
|
|
|
|
|
|
|
|
// make new request based on injection rate
|
|
|
|
// (injection rate's range depends on precision)
|
|
|
|
// - generate a random number between 0 and 10^precision
|
|
|
|
// - send pkt if this number is < injRate*(10^precision)
|
|
|
|
bool send_this_cycle;
|
2011-03-23 04:38:09 +01:00
|
|
|
double injRange = pow((double) 10, (double) precision);
|
2014-09-03 13:42:54 +02:00
|
|
|
unsigned trySending = random_mt.random<unsigned>(0, (int) injRange);
|
2011-03-22 03:51:58 +01:00
|
|
|
if (trySending < injRate*injRange)
|
|
|
|
send_this_cycle = true;
|
|
|
|
else
|
|
|
|
send_this_cycle = false;
|
|
|
|
|
|
|
|
// always generatePkt unless fixedPkts is enabled
|
|
|
|
if (send_this_cycle) {
|
|
|
|
if (fixedPkts) {
|
|
|
|
if (numPacketsSent < maxPackets) {
|
|
|
|
generatePkt();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
generatePkt();
|
|
|
|
}
|
|
|
|
}
|
2011-05-07 23:43:30 +02:00
|
|
|
|
|
|
|
// Schedule wakeup
|
|
|
|
if (curTick() >= simCycles)
|
|
|
|
exitSimLoop("Network Tester completed simCycles");
|
|
|
|
else {
|
|
|
|
if (!tickEvent.scheduled())
|
2012-08-28 20:30:33 +02:00
|
|
|
schedule(tickEvent, clockEdge(Cycles(1)));
|
2011-05-07 23:43:30 +02:00
|
|
|
}
|
2011-03-22 03:51:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NetworkTest::generatePkt()
|
|
|
|
{
|
|
|
|
unsigned destination = id;
|
|
|
|
if (trafficType == 0) { // Uniform Random
|
2014-09-03 13:42:54 +02:00
|
|
|
destination = random_mt.random<unsigned>(0, numMemories - 1);
|
2011-03-22 03:51:58 +01:00
|
|
|
} else if (trafficType == 1) { // Tornado
|
|
|
|
int networkDimension = (int) sqrt(numMemories);
|
|
|
|
int my_x = id%networkDimension;
|
|
|
|
int my_y = id/networkDimension;
|
|
|
|
|
|
|
|
int dest_x = my_x + (int) ceil(networkDimension/2) - 1;
|
|
|
|
dest_x = dest_x%networkDimension;
|
|
|
|
int dest_y = my_y;
|
|
|
|
|
|
|
|
destination = dest_y*networkDimension + dest_x;
|
|
|
|
} else if (trafficType == 2) { // Bit Complement
|
|
|
|
int networkDimension = (int) sqrt(numMemories);
|
|
|
|
int my_x = id%networkDimension;
|
|
|
|
int my_y = id/networkDimension;
|
|
|
|
|
|
|
|
int dest_x = networkDimension - my_x - 1;
|
|
|
|
int dest_y = networkDimension - my_y - 1;
|
|
|
|
|
|
|
|
destination = dest_y*networkDimension + dest_x;
|
|
|
|
}
|
|
|
|
|
|
|
|
// The source of the packets is a cache.
|
|
|
|
// The destination of the packets is a directory.
|
|
|
|
// The destination bits are embedded in the address after byte-offset.
|
|
|
|
Addr paddr = destination;
|
|
|
|
paddr <<= blockSizeBits;
|
|
|
|
unsigned access_size = 1; // Does not affect Ruby simulation
|
|
|
|
|
|
|
|
// Modeling different coherence msg types over different msg classes.
|
|
|
|
//
|
2016-02-07 02:21:18 +01:00
|
|
|
// networktest assumes the Network_test coherence protocol
|
2011-03-22 03:51:58 +01:00
|
|
|
// which models three message classes/virtual networks.
|
|
|
|
// These are: request, forward, response.
|
|
|
|
// requests and forwards are "control" packets (typically 8 bytes),
|
|
|
|
// while responses are "data" packets (typically 72 bytes).
|
|
|
|
//
|
|
|
|
// Life of a packet from the tester into the network:
|
2016-02-07 02:21:18 +01:00
|
|
|
// (1) This function generatePkt() generates packets of one of the
|
2011-03-22 03:51:58 +01:00
|
|
|
// following 3 types (randomly) : ReadReq, INST_FETCH, WriteReq
|
|
|
|
// (2) mem/ruby/system/RubyPort.cc converts these to RubyRequestType_LD,
|
|
|
|
// RubyRequestType_IFETCH, RubyRequestType_ST respectively
|
|
|
|
// (3) mem/ruby/system/Sequencer.cc sends these to the cache controllers
|
|
|
|
// in the coherence protocol.
|
|
|
|
// (4) Network_test-cache.sm tags RubyRequestType:LD,
|
|
|
|
// RubyRequestType:IFETCH and RubyRequestType:ST as
|
2016-02-07 02:21:18 +01:00
|
|
|
// Request, Forward, and Response events respectively;
|
2011-03-22 03:51:58 +01:00
|
|
|
// and injects them into virtual networks 0, 1 and 2 respectively.
|
|
|
|
// It immediately calls back the sequencer.
|
|
|
|
// (5) The packet traverses the network (simple/garnet) and reaches its
|
|
|
|
// destination (Directory), and network stats are updated.
|
|
|
|
// (6) Network_test-dir.sm simply drops the packet.
|
2016-02-07 02:21:18 +01:00
|
|
|
//
|
2011-03-22 03:51:58 +01:00
|
|
|
MemCmd::Command requestType;
|
|
|
|
|
2015-01-22 11:00:53 +01:00
|
|
|
Request *req = nullptr;
|
|
|
|
Request::Flags flags;
|
|
|
|
|
2014-09-03 13:42:54 +02:00
|
|
|
unsigned randomReqType = random_mt.random(0, 2);
|
2011-03-22 03:51:58 +01:00
|
|
|
if (randomReqType == 0) {
|
|
|
|
// generate packet for virtual network 0
|
|
|
|
requestType = MemCmd::ReadReq;
|
2015-01-22 11:00:53 +01:00
|
|
|
req = new Request(paddr, access_size, flags, masterId);
|
2011-03-22 03:51:58 +01:00
|
|
|
} else if (randomReqType == 1) {
|
|
|
|
// generate packet for virtual network 1
|
|
|
|
requestType = MemCmd::ReadReq;
|
|
|
|
flags.set(Request::INST_FETCH);
|
2016-04-05 19:39:21 +02:00
|
|
|
req = new Request(0, 0x0, access_size, flags, masterId, 0x0, 0);
|
2011-03-22 03:51:58 +01:00
|
|
|
req->setPaddr(paddr);
|
|
|
|
} else { // if (randomReqType == 2)
|
|
|
|
// generate packet for virtual network 2
|
|
|
|
requestType = MemCmd::WriteReq;
|
2015-01-22 11:00:53 +01:00
|
|
|
req = new Request(paddr, access_size, flags, masterId);
|
2011-03-22 03:51:58 +01:00
|
|
|
}
|
|
|
|
|
2016-04-05 19:39:21 +02:00
|
|
|
req->setContext(id);
|
2011-03-22 03:51:58 +01:00
|
|
|
|
|
|
|
//No need to do functional simulation
|
|
|
|
//We just do timing simulation of the network
|
|
|
|
|
|
|
|
DPRINTF(NetworkTest,
|
|
|
|
"Generated packet with destination %d, embedded in address %x\n",
|
|
|
|
destination, req->getPaddr());
|
|
|
|
|
MEM: Remove the Broadcast destination from the packet
This patch simplifies the packet by removing the broadcast flag and
instead more firmly relying on (and enforcing) the semantics of
transactions in the classic memory system, i.e. request packets are
routed from a master to a slave based on the address, and when they
are created they have neither a valid source, nor destination. On
their way to the slave, the request packet is updated with a source
field for all modules that multiplex packets from multiple master
(e.g. a bus). When a request packet is turned into a response packet
(at the final slave), it moves the potentially populated source field
to the destination field, and the response packet is routed through
any multiplexing components back to the master based on the
destination field.
Modules that connect multiplexing components, such as caches and
bridges store any existing source and destination field in the sender
state as a stack (just as before).
The packet constructor is simplified in that there is no longer a need
to pass the Packet::Broadcast as the destination (this was always the
case for the classic memory system). In the case of Ruby, rather than
using the parameter to the constructor we now rely on setDest, as
there is already another three-argument constructor in the packet
class.
In many places where the packet information was printed as part of
DPRINTFs, request packets would be printed with a numeric "dest" that
would always be -1 (Broadcast) and that field is now removed from the
printing.
2012-04-14 11:45:55 +02:00
|
|
|
PacketPtr pkt = new Packet(req, requestType);
|
2014-12-02 12:07:43 +01:00
|
|
|
pkt->dataDynamic(new uint8_t[req->getSize()]);
|
2012-04-05 23:51:26 +02:00
|
|
|
pkt->senderState = NULL;
|
2011-03-22 03:51:58 +01:00
|
|
|
|
|
|
|
sendPkt(pkt);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NetworkTest::doRetry()
|
|
|
|
{
|
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.
2012-05-01 19:40:42 +02:00
|
|
|
if (cachePort.sendTimingReq(retryPkt)) {
|
2011-03-22 03:51:58 +01:00
|
|
|
retryPkt = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NetworkTest::printAddr(Addr a)
|
|
|
|
{
|
|
|
|
cachePort.printAddr(a);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NetworkTest *
|
|
|
|
NetworkTestParams::create()
|
|
|
|
{
|
|
|
|
return new NetworkTest(this);
|
|
|
|
}
|