summaryrefslogtreecommitdiff
path: root/mem/bus.cc
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2006-04-28 15:37:48 -0400
committerAli Saidi <saidi@eecs.umich.edu>2006-04-28 15:37:48 -0400
commit53d93ef9182aade99faa5996dece522d9aba88d1 (patch)
tree53edf6abec2b845dfad7ce70f8b96dafc353895a /mem/bus.cc
parentc819a1c0e188a388cd1891fa5a36e81adcd6c279 (diff)
downloadgem5-53d93ef9182aade99faa5996dece522d9aba88d1.tar.xz
add a bridge object, modify bus object to be able to connect to other buses or bridges without panicing
SConscript: add new cc files to scons mem/bus.cc: mem/bus.hh: implement addressRanges() on the bus. propigate address ranges to anyone who is interested stripping out ranges of who your propigating to (to avoid livelock) mem/packet.hh: add intersect function that returns true if two packets touch at least one byte of the same data (for functional access) add fixPacket() that will eventually take the correct action giving a timing and functional packet, right now it panics mem/physical.cc: Don't panic if the physical memory recieves a status change, just ignore. --HG-- extra : convert_revision : d470d51f2fb1db2700ad271e09792315ef33ba01
Diffstat (limited to 'mem/bus.cc')
-rw-r--r--mem/bus.cc45
1 files changed, 38 insertions, 7 deletions
diff --git a/mem/bus.cc b/mem/bus.cc
index 86e834894..acc941434 100644
--- a/mem/bus.cc
+++ b/mem/bus.cc
@@ -35,13 +35,22 @@
#include "mem/bus.hh"
#include "sim/builder.hh"
+/** Get the ranges of anyone that we are connected to. */
+void
+Bus::init()
+{
+ std::vector<Port*>::iterator intIter;
+ for (intIter = interfaces.begin(); intIter != interfaces.end(); intIter++)
+ (*intIter)->sendStatusChange(Port::RangeChange);
+}
+
+
/** Function called by the port when the bus is recieving a Timing
* transaction.*/
bool
Bus::recvTiming(Packet &pkt, int id)
{
-
- panic("I need to be implemented, but not right now.");
+ return findPort(pkt.addr, id)->sendTiming(pkt);
}
Port *
@@ -90,10 +99,13 @@ Bus::recvFunctional(Packet &pkt, int id)
void
Bus::recvStatusChange(Port::Status status, int id)
{
+ DPRINTF(Bus, "Bus %d recieved status change from device id %d\n",
+ busId, id);
assert(status == Port::RangeChange &&
"The other statuses need to be implemented.");
assert(id < interfaces.size() && id >= 0);
+ int x;
Port *port = interfaces[id];
AddrRangeList ranges;
AddrRangeList snoops;
@@ -122,12 +134,31 @@ Bus::recvStatusChange(Port::Status status, int id)
portList.push_back(dm);
}
DPRINTF(MMU, "port list has %d entries\n", portList.size());
+
+ // tell all our peers that our address range has changed.
+ // Don't tell the device that caused this change, it already knows
+ for (x = 0; x < interfaces.size(); x++)
+ if (x != id)
+ interfaces[x]->sendStatusChange(Port::RangeChange);
}
void
-Bus::BusPort::addressRanges(AddrRangeList &resp, AddrRangeList &snoop)
+Bus::addressRanges(AddrRangeList &resp, AddrRangeList &snoop, int id)
{
- panic("I'm not implemented.\n");
+ std::vector<DevMap>::iterator portIter;
+
+ resp.clear();
+ snoop.clear();
+
+ DPRINTF(Bus, "Bus id %d recieved address range request returning\n",
+ busId);
+ for (portIter = portList.begin(); portIter != portList.end(); portIter++) {
+ if (portIter->portId != id) {
+ resp.push_back(portIter->range);
+ DPRINTF(Bus, "-- %#llX : %#llX\n", portIter->range.start,
+ portIter->range.end);
+ }
+ }
}
BEGIN_DECLARE_SIM_OBJECT_PARAMS(Bus)
@@ -137,12 +168,12 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(Bus)
END_DECLARE_SIM_OBJECT_PARAMS(Bus)
BEGIN_INIT_SIM_OBJECT_PARAMS(Bus)
- INIT_PARAM(bus_id, "junk bus id")
-END_INIT_SIM_OBJECT_PARAMS(PhysicalMemory)
+ INIT_PARAM(bus_id, "a globally unique bus id")
+END_INIT_SIM_OBJECT_PARAMS(Bus)
CREATE_SIM_OBJECT(Bus)
{
- return new Bus(getInstanceName());
+ return new Bus(getInstanceName(), bus_id);
}
REGISTER_SIM_OBJECT("Bus", Bus)