Hi everybody. I just checked in a change which modifies the port API and
may affect code you have which isn't checked in to the main gem5
repository. If you're implementing something which exposes ports and have
implemented the getMasterPort or getSlavePort methods on a MemObject,
porting to the new API should be simple. All you'll need to do is replace
those methods with a new method called getPort with this signature:

Port &getPort(const std::string &if_name, PortID idx=InvalidPortID)
override;

If there's only one of getMasterPort or getSlavePort, you should be able to
just rename the function. If there are both, you can just combine the two
so that if a name either function would recognize is passed in, getPort
returns the same port as the corresponding old function did.

Example:

BaseMasterPort &
getMasterPort(const std::string &if_name, PortID idx=InvalidPortID)
{
    if (if_name == "master")
        return masterPort;
    return ParentClass::getMasterPort(if_name, idx);
}

BaseSlavePort &
getSlavePort(const std::string &if_name, PortID idx=InvalidPortID)
{
    if (if_name == "slave")
        return slavePort;
    return ParentClass::getSlavePort(if_name, idx);
}

Would become:

Port &
getPort(const std::string &if_name, PortID idx=InvalidPortID)
{
    if (if_name == "master")
        return masterPort;
    else if (if_name == "slave")
        return slavePort;
    return ParentClass::getPort(if_name, idx);
}
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to