summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2013-05-30 12:53:59 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2013-05-30 12:53:59 -0400
commitcb62d39835f4764562e74b0e113437e76e8949ff (patch)
tree063f91c94bc172d1de2feb6d598febf3efdbbacd /src
parent91f7b065a9b34ce0d3951001e30a9372d9b9dba9 (diff)
downloadgem5-cb62d39835f4764562e74b0e113437e76e8949ff.tar.xz
mem: Tidy up a few variables in the bus
This patch does some minor housekeeping on the bus code, removing redundant code, and moving the extraction of the destination id to the top of the functions using it.
Diffstat (limited to 'src')
-rw-r--r--src/mem/coherent_bus.cc10
-rw-r--r--src/mem/noncoherent_bus.cc12
2 files changed, 11 insertions, 11 deletions
diff --git a/src/mem/coherent_bus.cc b/src/mem/coherent_bus.cc
index 1edd63b09..aa0f2797d 100644
--- a/src/mem/coherent_bus.cc
+++ b/src/mem/coherent_bus.cc
@@ -199,7 +199,7 @@ CoherentBus::recvTimingReq(PacketPtr pkt, PortID slave_port_id)
// update the bus state and schedule an idle event
reqLayer.failedTiming(src_port, master_port_id,
- clockEdge(Cycles(headerCycles)));
+ clockEdge(headerCycles));
} else {
// update the bus state and schedule an idle event
reqLayer.succeededTiming(packetFinishTime);
@@ -223,9 +223,12 @@ CoherentBus::recvTimingResp(PacketPtr pkt, PortID master_port_id)
// determine the source port based on the id
MasterPort *src_port = masterPorts[master_port_id];
+ // determine the destination based on what is stored in the packet
+ PortID slave_port_id = pkt->getDest();
+
// test if the bus should be considered occupied for the current
// port
- if (!respLayer.tryTiming(src_port, pkt->getDest())) {
+ if (!respLayer.tryTiming(src_port, slave_port_id)) {
DPRINTF(CoherentBus, "recvTimingResp: src %s %s 0x%x BUSY\n",
src_port->name(), pkt->cmdString(), pkt->getAddr());
return false;
@@ -249,9 +252,6 @@ CoherentBus::recvTimingResp(PacketPtr pkt, PortID master_port_id)
// remove it as outstanding
outstandingReq.erase(pkt->req);
- // determine the destination based on what is stored in the packet
- PortID slave_port_id = pkt->getDest();
-
// send the packet through the destination slave port
bool success M5_VAR_USED = slavePorts[slave_port_id]->sendTimingResp(pkt);
diff --git a/src/mem/noncoherent_bus.cc b/src/mem/noncoherent_bus.cc
index 5bf5cfd88..cc5d49cab 100644
--- a/src/mem/noncoherent_bus.cc
+++ b/src/mem/noncoherent_bus.cc
@@ -138,7 +138,7 @@ NoncoherentBus::recvTimingReq(PacketPtr pkt, PortID slave_port_id)
// occupy until the header is sent
reqLayer.failedTiming(src_port, master_port_id,
- clockEdge(Cycles(headerCycles)));
+ clockEdge(headerCycles));
return false;
}
@@ -160,9 +160,12 @@ NoncoherentBus::recvTimingResp(PacketPtr pkt, PortID master_port_id)
// determine the source port based on the id
MasterPort *src_port = masterPorts[master_port_id];
+ // determine the destination based on what is stored in the packet
+ PortID slave_port_id = pkt->getDest();
+
// test if the bus should be considered occupied for the current
// port
- if (!respLayer.tryTiming(src_port, pkt->getDest())) {
+ if (!respLayer.tryTiming(src_port, slave_port_id)) {
DPRINTF(NoncoherentBus, "recvTimingResp: src %s %s 0x%x BUSY\n",
src_port->name(), pkt->cmdString(), pkt->getAddr());
return false;
@@ -179,11 +182,8 @@ NoncoherentBus::recvTimingResp(PacketPtr pkt, PortID master_port_id)
calcPacketTiming(pkt);
Tick packetFinishTime = pkt->busLastWordDelay + curTick();
- // determine the destination based on what is stored in the packet
- PortID slave_port_id = pkt->getDest();
-
// send the packet through the destination slave port
- bool success M5_VAR_USED = slavePorts[pkt->getDest()]->sendTimingResp(pkt);
+ bool success M5_VAR_USED = slavePorts[slave_port_id]->sendTimingResp(pkt);
// currently it is illegal to block responses... can lead to
// deadlock