summaryrefslogtreecommitdiff
path: root/src/mem/bus.cc
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2006-10-05 16:26:16 -0400
committerGabe Black <gblack@eecs.umich.edu>2006-10-05 16:26:16 -0400
commitd9172c8f462511cde474040581063180be18540a (patch)
tree9bff3f3dc9e1ea6d5ee18398d8ca543feb0eb4dc /src/mem/bus.cc
parent51c8eab7b336a6c83e545b741cb975883fe56440 (diff)
downloadgem5-d9172c8f462511cde474040581063180be18540a.tar.xz
Partial reimplementation of the bus. The "clock" and "width" parameters have been added, and the HasData flag has been partially added to packets.
--HG-- extra : convert_revision : abb2a259fcf843457abbc0bd36f9504fbe6d7d39
Diffstat (limited to 'src/mem/bus.cc')
-rw-r--r--src/mem/bus.cc41
1 files changed, 38 insertions, 3 deletions
diff --git a/src/mem/bus.cc b/src/mem/bus.cc
index cf9e54e62..e3b395afc 100644
--- a/src/mem/bus.cc
+++ b/src/mem/bus.cc
@@ -78,6 +78,16 @@ Bus::recvTiming(Packet *pkt)
pkt->getSrc(), pkt->getDest(), pkt->getAddr(), pkt->cmdString());
short dest = pkt->getDest();
+ //if (pkt->isRequest() && curTick < tickAddrLastUsed ||
+ // (pkt->isResponse() || pkt->hasData()) && curTick < tickDataLastUsed) {
+ //We're going to need resources that have already been committed
+ //Send this guy to the back of the line
+ //We don't need to worry about scheduling an event to deal with when the
+ //bus is freed because that's handled when tick*LastUsed is incremented.
+ // retryList.push_back(interfaces[pkt->getSrc()]);
+ // return false;
+ //}
+
if (dest == Packet::Broadcast) {
if ( timingSnoopPhase1(pkt) )
{
@@ -95,8 +105,29 @@ Bus::recvTiming(Packet *pkt)
assert(dest != pkt->getSrc()); // catch infinite loops
port = interfaces[dest];
}
+
+
if (port->sendTiming(pkt)) {
- // packet was successfully sent, just return true.
+ // Packet was successfully sent.
+ // Figure out what resources were used, and then return true.
+ //if (pkt->isRequest()) {
+ // The address bus will be used for one cycle
+ // while (tickAddrLastUsed <= curTick)
+ // tickAddrLastUsed += clock;
+ //}
+ //if (pkt->isResponse() || pkt->hasData()) {
+ // Use up the data bus for at least one bus cycle
+ // while (tickDataLastUsed <= curTick)
+ // tickDataLastUsed += clock;
+ // Use up the data bus for however many cycles remain
+ // if (pkt->hasData()) {
+ // int dataSize = pkt->getSize();
+ // for (int transmitted = width; transmitted < dataSize;
+ // transmitted += width) {
+ // tickDataLastUsed += clock;
+ // }
+ // }
+ //}
return true;
}
@@ -380,16 +411,20 @@ Bus::addressRanges(AddrRangeList &resp, AddrRangeList &snoop, int id)
BEGIN_DECLARE_SIM_OBJECT_PARAMS(Bus)
Param<int> bus_id;
+ Param<int> clock;
+ Param<int> width;
END_DECLARE_SIM_OBJECT_PARAMS(Bus)
BEGIN_INIT_SIM_OBJECT_PARAMS(Bus)
- INIT_PARAM(bus_id, "a globally unique bus id")
+ INIT_PARAM(bus_id, "a globally unique bus id"),
+ INIT_PARAM(clock, "bus clock speed"),
+ INIT_PARAM(width, "width of the bus (bits)")
END_INIT_SIM_OBJECT_PARAMS(Bus)
CREATE_SIM_OBJECT(Bus)
{
- return new Bus(getInstanceName(), bus_id);
+ return new Bus(getInstanceName(), bus_id, clock, width);
}
REGISTER_SIM_OBJECT("Bus", Bus)