summaryrefslogtreecommitdiff
path: root/src/mem/bus.cc
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2007-08-13 23:44:26 -0400
committerAli Saidi <saidi@eecs.umich.edu>2007-08-13 23:44:26 -0400
commit27ddf0b40e9b0bea1d75d825c7339c9fb9411bc9 (patch)
treec6dea0a58fec9d5efecfb5559e3e1eaa24b33878 /src/mem/bus.cc
parentb069b81acf498a538b1ce4b30ff8b2d96b2ec8de (diff)
parent9b4be6532741a511ca8f9e1d051269245814be8b (diff)
downloadgem5-27ddf0b40e9b0bea1d75d825c7339c9fb9411bc9.tar.xz
Merge IGNORE_STYLE change and my change.
--HG-- extra : convert_revision : 13880ec6df17b0317d4097243bb24add753a098a
Diffstat (limited to 'src/mem/bus.cc')
-rw-r--r--src/mem/bus.cc43
1 files changed, 19 insertions, 24 deletions
diff --git a/src/mem/bus.cc b/src/mem/bus.cc
index 9fa61a76d..620e2ac60 100644
--- a/src/mem/bus.cc
+++ b/src/mem/bus.cc
@@ -148,10 +148,7 @@ void Bus::occupyBus(PacketPtr pkt)
// The first word will be delivered after the current tick, the delivery
// of the address if any, and one bus cycle to deliver the data
- pkt->firstWordTime =
- tickNextIdle +
- pkt->isRequest() ? clock : 0 +
- clock;
+ pkt->firstWordTime = tickNextIdle + (pkt->isRequest() ? clock : 0) + clock;
//Advance it numCycles bus cycles.
//XXX Should this use the repeated addition trick as well?
@@ -211,19 +208,13 @@ Bus::recvTiming(PacketPtr pkt)
dest_port_id = findPort(pkt->getAddr());
dest_port = (dest_port_id == defaultId) ?
defaultPort : interfaces[dest_port_id];
- for (SnoopIter s_iter = snoopPorts.begin();
- s_iter != snoopPorts.end();
- s_iter++) {
+ SnoopIter s_end = snoopPorts.end();
+ for (SnoopIter s_iter = snoopPorts.begin(); s_iter != s_end; s_iter++) {
BusPort *p = *s_iter;
if (p != dest_port && p != src_port) {
-#ifndef NDEBUG
// cache is not allowed to refuse snoop
- bool success = p->sendTiming(pkt);
+ bool success M5_VAR_USED = p->sendTiming(pkt);
assert(success);
-#else
- // avoid unused variable warning
- p->sendTiming(pkt);
-#endif
}
}
} else {
@@ -320,9 +311,9 @@ Bus::findPort(Addr addr)
// Check if this matches the default range
if (dest_id == -1) {
- for (AddrRangeIter iter = defaultRange.begin();
- iter != defaultRange.end(); iter++) {
- if (*iter == addr) {
+ AddrRangeIter a_end = defaultRange.end();
+ for (AddrRangeIter i = defaultRange.begin(); i != a_end; i++) {
+ if (*i == addr) {
DPRINTF(Bus, " found addr %#llx on default\n", addr);
return defaultId;
}
@@ -437,9 +428,8 @@ Bus::recvFunctional(PacketPtr pkt)
assert(pkt->isRequest()); // hasn't already been satisfied
- for (SnoopIter s_iter = snoopPorts.begin();
- s_iter != snoopPorts.end();
- s_iter++) {
+ SnoopIter s_end = snoopPorts.end();
+ for (SnoopIter s_iter = snoopPorts.begin(); s_iter != s_end; s_iter++) {
BusPort *p = *s_iter;
if (p != port && p->getId() != src_id) {
p->sendFunctional(pkt);
@@ -464,6 +454,10 @@ Bus::recvStatusChange(Port::Status status, int id)
bool snoops;
AddrRangeIter iter;
+ if (inRecvStatusChange.count(id))
+ return;
+ inRecvStatusChange.insert(id);
+
assert(status == Port::RangeChange &&
"The other statuses need to be implemented.");
@@ -531,6 +525,7 @@ Bus::recvStatusChange(Port::Status status, int id)
if (id != defaultId && defaultPort)
defaultPort->sendStatusChange(Port::RangeChange);
+ inRecvStatusChange.erase(id);
}
void
@@ -589,14 +584,14 @@ Bus::findBlockSize(int id)
int max_bs = -1;
- for (PortIter portIter = portMap.begin();
- portIter != portMap.end(); portIter++) {
- int tmp_bs = interfaces[portIter->second]->peerBlockSize();
+ PortIter p_end = portMap.end();
+ for (PortIter p_iter = portMap.begin(); p_iter != p_end; p_iter++) {
+ int tmp_bs = interfaces[p_iter->second]->peerBlockSize();
if (tmp_bs > max_bs)
max_bs = tmp_bs;
}
- for (SnoopIter s_iter = snoopPorts.begin();
- s_iter != snoopPorts.end(); s_iter++) {
+ SnoopIter s_end = snoopPorts.end();
+ for (SnoopIter s_iter = snoopPorts.begin(); s_iter != s_end; s_iter++) {
int tmp_bs = (*s_iter)->peerBlockSize();
if (tmp_bs > max_bs)
max_bs = tmp_bs;