} else
fatal("Default port already set\n");
}
+ int id;
+ if (if_name == "functional") {
+ if (!funcPort) {
+ id = maxId++;
+ funcPort = new BusPort(csprintf("%s-p%d-func", name(), id), this, id);
+ funcPortId = id;
+ interfaces[id] = funcPort;
+ }
+ return funcPort;
+ }
// if_name ignored? forced to be empty?
- int id = maxId++;
+ id = maxId++;
assert(maxId < std::numeric_limits<typeof(maxId)>::max());
BusPort *bp = new BusPort(csprintf("%s-p%d", name(), id), this, id);
interfaces[id] = bp;
void
Bus::deletePortRefs(Port *p)
{
+
BusPort *bp = dynamic_cast<BusPort*>(p);
if (bp == NULL)
panic("Couldn't convert Port* to BusPort*\n");
+ // If this is our one functional port
+ if (funcPort == bp)
+ return;
interfaces.erase(bp->getId());
+ delete bp;
}
/** Get the ranges of anyone other buses that we are connected to. */
m5::hash_map<short,BusPort*>::iterator intIter;
for (intIter = interfaces.begin(); intIter != interfaces.end(); intIter++)
- if (intIter->first != id)
+ if (intIter->first != id && intIter->first != funcPortId)
intIter->second->sendStatusChange(Port::RangeChange);
if (id != defaultId && defaultPort)
Event * drainEvent;
+
static const int defaultId = -3; //Make it unique from Broadcast
struct DevMap {
/** Port that handles requests that don't match any of the interfaces.*/
BusPort *defaultPort;
+ BusPort *funcPort;
+ int funcPortId;
+
/** Has the user specified their own default responder? */
bool responderSet;
bool responder_set)
: MemObject(n), busId(bus_id), clock(_clock), width(_width),
tickNextIdle(0), drainEvent(NULL), busIdle(this), inRetry(false),
- maxId(0), defaultPort(NULL), responderSet(responder_set)
+ maxId(0), defaultPort(NULL), funcPort(NULL), funcPortId(-4),
+ responderSet(responder_set)
{
//Both the width and clock period must be positive
if (width <= 0)