summaryrefslogtreecommitdiff
path: root/src/mem/bus.cc
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2012-04-14 05:45:55 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2012-04-14 05:45:55 -0400
commit750f33a90194f3f827ef887fb7e151235e61c919 (patch)
tree0146b730df44c6be8a77ac6ab86795558e394d22 /src/mem/bus.cc
parentdccca0d3a9c985972d3d603190e62899d03825e8 (diff)
downloadgem5-750f33a90194f3f827ef887fb7e151235e61c919.tar.xz
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.
Diffstat (limited to 'src/mem/bus.cc')
-rw-r--r--src/mem/bus.cc56
1 files changed, 25 insertions, 31 deletions
diff --git a/src/mem/bus.cc b/src/mem/bus.cc
index eb26e268b..daf69c6df 100644
--- a/src/mem/bus.cc
+++ b/src/mem/bus.cc
@@ -213,24 +213,21 @@ Bus::recvTiming(PacketPtr pkt)
// test if the bus should be considered occupied for the current
// packet, and exclude express snoops from the check
if (!pkt->isExpressSnoop() && isOccupied(pkt, src_port)) {
- DPRINTF(Bus, "recvTiming: src %d dst %d %s 0x%x BUSY\n",
- src_id, pkt->getDest(), pkt->cmdString(), pkt->getAddr());
+ DPRINTF(Bus, "recvTiming: src %s %s 0x%x BUSY\n",
+ src_port->name(), pkt->cmdString(), pkt->getAddr());
return false;
}
- DPRINTF(Bus, "recvTiming: src %d dst %d %s 0x%x\n",
- src_id, pkt->getDest(), pkt->cmdString(), pkt->getAddr());
+ DPRINTF(Bus, "recvTiming: src %s %s 0x%x\n",
+ src_port->name(), pkt->cmdString(), pkt->getAddr());
Tick headerFinishTime = pkt->isExpressSnoop() ? 0 : calcPacketTiming(pkt);
Tick packetFinishTime = pkt->isExpressSnoop() ? 0 : pkt->finishTime;
// decide what to do based on the direction
if (pkt->isRequest()) {
- // the packet is a memory-mapped request and should be broadcasted to
- // our snoopers
- assert(pkt->getDest() == Packet::Broadcast);
-
- // forward to all snoopers but the source
+ // the packet is a memory-mapped request and should be
+ // broadcasted to our snoopers but the source
forwardTiming(pkt, src_id);
// remember if we add an outstanding req so we can undo it if
@@ -262,8 +259,8 @@ Bus::recvTiming(PacketPtr pkt)
if (add_outstanding)
outstandingReq.erase(pkt->req);
- DPRINTF(Bus, "recvTiming: src %d dst %d %s 0x%x RETRY\n",
- src_id, pkt->getDest(), pkt->cmdString(), pkt->getAddr());
+ DPRINTF(Bus, "recvTiming: src %s %s 0x%x RETRY\n",
+ src_port->name(), pkt->cmdString(), pkt->getAddr());
addToRetryList(src_port);
occupyBus(headerFinishTime);
@@ -299,12 +296,11 @@ Bus::recvTimingSnoop(PacketPtr pkt)
Packet::NodeID src_id = pkt->getSrc();
if (pkt->isRequest()) {
- DPRINTF(Bus, "recvTimingSnoop: src %d dst %d %s 0x%x\n",
- src_id, pkt->getDest(), pkt->cmdString(), pkt->getAddr());
+ DPRINTF(Bus, "recvTimingSnoop: src %d %s 0x%x\n",
+ src_id, pkt->cmdString(), pkt->getAddr());
// the packet is an express snoop request and should be
// broadcasted to our snoopers
- assert(pkt->getDest() == Packet::Broadcast);
assert(pkt->isExpressSnoop());
// forward to all snoopers
@@ -326,13 +322,13 @@ Bus::recvTimingSnoop(PacketPtr pkt)
SlavePort* src_port = slavePorts[src_id];
if (isOccupied(pkt, src_port)) {
- DPRINTF(Bus, "recvTimingSnoop: src %d dst %d %s 0x%x BUSY\n",
- src_id, pkt->getDest(), pkt->cmdString(), pkt->getAddr());
+ DPRINTF(Bus, "recvTimingSnoop: src %s %s 0x%x BUSY\n",
+ src_port->name(), pkt->cmdString(), pkt->getAddr());
return false;
}
- DPRINTF(Bus, "recvTimingSnoop: src %d dst %d %s 0x%x\n",
- src_id, pkt->getDest(), pkt->cmdString(), pkt->getAddr());
+ DPRINTF(Bus, "recvTimingSnoop: src %s %s 0x%x\n",
+ src_port->name(), pkt->cmdString(), pkt->getAddr());
// get the destination from the packet
Packet::NodeID dest = pkt->getDest();
@@ -532,11 +528,11 @@ Bus::findPort(Addr addr)
Tick
Bus::recvAtomic(PacketPtr pkt)
{
- DPRINTF(Bus, "recvAtomic: packet src %d dest %d addr 0x%x cmd %s\n",
- pkt->getSrc(), pkt->getDest(), pkt->getAddr(), pkt->cmdString());
+ DPRINTF(Bus, "recvAtomic: packet src %s addr 0x%x cmd %s\n",
+ slavePorts[pkt->getSrc()]->name(), pkt->getAddr(),
+ pkt->cmdString());
// we should always see a request routed based on the address
- assert(pkt->getDest() == Packet::Broadcast);
assert(pkt->isRequest());
// forward to all snoopers but the source
@@ -566,11 +562,11 @@ Bus::recvAtomic(PacketPtr pkt)
Tick
Bus::recvAtomicSnoop(PacketPtr pkt)
{
- DPRINTF(Bus, "recvAtomicSnoop: packet src %d dest %d addr 0x%x cmd %s\n",
- pkt->getSrc(), pkt->getDest(), pkt->getAddr(), pkt->cmdString());
+ DPRINTF(Bus, "recvAtomicSnoop: packet src %s addr 0x%x cmd %s\n",
+ masterPorts[pkt->getSrc()]->name(), pkt->getAddr(),
+ pkt->cmdString());
// we should always see a request routed based on the address
- assert(pkt->getDest() == Packet::Broadcast);
assert(pkt->isRequest());
// forward to all snoopers
@@ -621,7 +617,7 @@ Bus::forwardAtomic(PacketPtr pkt, int exclude_slave_port_id)
// restore original packet state for remaining snoopers
pkt->cmd = orig_cmd;
pkt->setSrc(orig_src_id);
- pkt->setDest(Packet::Broadcast);
+ pkt->clearDest();
}
}
}
@@ -637,13 +633,12 @@ Bus::recvFunctional(PacketPtr pkt)
if (!pkt->isPrint()) {
// don't do DPRINTFs on PrintReq as it clutters up the output
DPRINTF(Bus,
- "recvFunctional: packet src %d dest %d addr 0x%x cmd %s\n",
- pkt->getSrc(), pkt->getDest(), pkt->getAddr(),
+ "recvFunctional: packet src %s addr 0x%x cmd %s\n",
+ slavePorts[pkt->getSrc()]->name(), pkt->getAddr(),
pkt->cmdString());
}
// we should always see a request routed based on the address
- assert(pkt->getDest() == Packet::Broadcast);
assert(pkt->isRequest());
// forward to all snoopers but the source
@@ -664,13 +659,12 @@ Bus::recvFunctionalSnoop(PacketPtr pkt)
if (!pkt->isPrint()) {
// don't do DPRINTFs on PrintReq as it clutters up the output
DPRINTF(Bus,
- "recvFunctionalSnoop: packet src %d dest %d addr 0x%x cmd %s\n",
- pkt->getSrc(), pkt->getDest(), pkt->getAddr(),
+ "recvFunctionalSnoop: packet src %s addr 0x%x cmd %s\n",
+ masterPorts[pkt->getSrc()]->name(), pkt->getAddr(),
pkt->cmdString());
}
// we should always see a request routed based on the address
- assert(pkt->getDest() == Packet::Broadcast);
assert(pkt->isRequest());
// forward to all snoopers