bus changes
src/mem/bus.cc: src/mem/bus.hh: minor fix and some formatting changes src/python/m5/objects/Bus.py: changed bits to bytes --HG-- extra : convert_revision : dcd22205604b7a2727eaf2094084c4858f3589c5
This commit is contained in:
parent
63023ba4c2
commit
a82f017591
3 changed files with 17 additions and 9 deletions
|
@ -68,7 +68,9 @@ Bus::init()
|
||||||
}
|
}
|
||||||
|
|
||||||
Bus::BusFreeEvent::BusFreeEvent(Bus *_bus) : Event(&mainEventQueue), bus(_bus)
|
Bus::BusFreeEvent::BusFreeEvent(Bus *_bus) : Event(&mainEventQueue), bus(_bus)
|
||||||
{}
|
{
|
||||||
|
assert(!scheduled());
|
||||||
|
}
|
||||||
|
|
||||||
void Bus::BusFreeEvent::process()
|
void Bus::BusFreeEvent::process()
|
||||||
{
|
{
|
||||||
|
@ -104,6 +106,7 @@ Bus::occupyBus(int numCycles)
|
||||||
} else {
|
} else {
|
||||||
busIdle.reschedule(tickNextIdle);
|
busIdle.reschedule(tickNextIdle);
|
||||||
}
|
}
|
||||||
|
DPRINTF(Bus, "The bus is now occupied from tick %d to %d\n", curTick, tickNextIdle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Function called by the port when the bus is receiving a Timing
|
/** Function called by the port when the bus is receiving a Timing
|
||||||
|
@ -155,6 +158,11 @@ Bus::recvTiming(Packet *pkt)
|
||||||
|
|
||||||
if (port->sendTiming(pkt)) {
|
if (port->sendTiming(pkt)) {
|
||||||
// Packet was successfully sent. Return true.
|
// Packet was successfully sent. Return true.
|
||||||
|
// Also take care of retries
|
||||||
|
if (retryingPort) {
|
||||||
|
retryList.pop_front();
|
||||||
|
retryingPort = NULL;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,15 +174,15 @@ Bus::recvTiming(Packet *pkt)
|
||||||
void
|
void
|
||||||
Bus::recvRetry(int id)
|
Bus::recvRetry(int id)
|
||||||
{
|
{
|
||||||
//If there's anything waiting...
|
// If there's anything waiting...
|
||||||
if (retryList.size()) {
|
if (retryList.size()) {
|
||||||
retryingPort = retryList.front();
|
retryingPort = retryList.front();
|
||||||
retryingPort->sendRetry();
|
retryingPort->sendRetry();
|
||||||
//If the retryingPort pointer isn't null, either sendTiming wasn't
|
// If the retryingPort pointer isn't null, sendTiming wasn't called
|
||||||
//called, or it was and the packet was successfully sent.
|
|
||||||
if (retryingPort) {
|
if (retryingPort) {
|
||||||
|
warn("sendRetry didn't call sendTiming\n");
|
||||||
retryList.pop_front();
|
retryList.pop_front();
|
||||||
retryingPort = 0;
|
retryingPort = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ class Bus : public MemObject
|
||||||
int busId;
|
int busId;
|
||||||
/** the clock speed for the bus */
|
/** the clock speed for the bus */
|
||||||
int clock;
|
int clock;
|
||||||
/** the width of the bus in bits */
|
/** the width of the bus in bytes */
|
||||||
int width;
|
int width;
|
||||||
/** the next tick at which the bus will be idle */
|
/** the next tick at which the bus will be idle */
|
||||||
Tick tickNextIdle;
|
Tick tickNextIdle;
|
||||||
|
@ -230,7 +230,7 @@ class Bus : public MemObject
|
||||||
} else {
|
} else {
|
||||||
// The device was retrying a packet. It didn't work, so we'll leave
|
// The device was retrying a packet. It didn't work, so we'll leave
|
||||||
// it at the head of the retry list.
|
// it at the head of the retry list.
|
||||||
retryingPort = 0;
|
retryingPort = NULL;
|
||||||
|
|
||||||
// We shouldn't be receiving a packet from one port when a different
|
// We shouldn't be receiving a packet from one port when a different
|
||||||
// one is retrying.
|
// one is retrying.
|
||||||
|
@ -250,7 +250,7 @@ class Bus : public MemObject
|
||||||
|
|
||||||
Bus(const std::string &n, int bus_id, int _clock, int _width)
|
Bus(const std::string &n, int bus_id, int _clock, int _width)
|
||||||
: MemObject(n), busId(bus_id), clock(_clock), width(_width),
|
: MemObject(n), busId(bus_id), clock(_clock), width(_width),
|
||||||
tickNextIdle(0), busIdle(this), retryingPort(0), defaultPort(NULL)
|
tickNextIdle(0), busIdle(this), retryingPort(NULL), defaultPort(NULL)
|
||||||
{
|
{
|
||||||
//Both the width and clock period must be positive
|
//Both the width and clock period must be positive
|
||||||
assert(width);
|
assert(width);
|
||||||
|
|
|
@ -7,4 +7,4 @@ class Bus(MemObject):
|
||||||
default = Port("Default port for requests that aren't handeled by a device.")
|
default = Port("Default port for requests that aren't handeled by a device.")
|
||||||
bus_id = Param.Int(0, "blah")
|
bus_id = Param.Int(0, "blah")
|
||||||
clock = Param.Clock("1GHz", "bus clock speed")
|
clock = Param.Clock("1GHz", "bus clock speed")
|
||||||
width = Param.Int(64, "bus width (bits)")
|
width = Param.Int(64, "bus width (bytes)")
|
||||||
|
|
Loading…
Reference in a new issue