X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmem%2Fnoncoherent_bus.cc;h=237e8726b8d7dc6288c43b10a76f01dafad9a53d;hb=01f1430833f194cecbef043ba500f2b8173ea29d;hp=718bbebdd0fe8effeac91bc01af274d54f447eda;hpb=14f9c77dd36fef8ab509bc17ecbe422555daa9c6;p=gem5.git diff --git a/src/mem/noncoherent_bus.cc b/src/mem/noncoherent_bus.cc index 718bbebdd..237e8726b 100644 --- a/src/mem/noncoherent_bus.cc +++ b/src/mem/noncoherent_bus.cc @@ -55,13 +55,14 @@ #include "mem/noncoherent_bus.hh" NoncoherentBus::NoncoherentBus(const NoncoherentBusParams *p) - : BaseBus(p) + : BaseBus(p), reqLayer(*this, ".reqLayer", p->clock), + respLayer(*this, ".respLayer", p->clock) { // create the ports based on the size of the master and slave // vector ports, and the presence of the default port, the ports // are enumerated starting from zero for (int i = 0; i < p->port_master_connection_count; ++i) { - std::string portName = csprintf("%s-p%d", name(), i); + std::string portName = csprintf("%s.master[%d]", name(), i); MasterPort* bp = new NoncoherentBusMasterPort(portName, *this, i); masterPorts.push_back(bp); } @@ -70,7 +71,7 @@ NoncoherentBus::NoncoherentBus(const NoncoherentBusParams *p) // our corresponding master port if (p->port_default_connection_count) { defaultPortID = masterPorts.size(); - std::string portName = csprintf("%s-default", name()); + std::string portName = name() + ".default"; MasterPort* bp = new NoncoherentBusMasterPort(portName, *this, defaultPortID); masterPorts.push_back(bp); @@ -78,7 +79,7 @@ NoncoherentBus::NoncoherentBus(const NoncoherentBusParams *p) // create the slave ports, once again starting at zero for (int i = 0; i < p->port_slave_connection_count; ++i) { - std::string portName = csprintf("%s-p%d", name(), i); + std::string portName = csprintf("%s.slave[%d]", name(), i); SlavePort* bp = new NoncoherentBusSlavePort(portName, *this, i); slavePorts.push_back(bp); } @@ -97,7 +98,7 @@ NoncoherentBus::recvTimingReq(PacketPtr pkt, PortID slave_port_id) // test if the bus should be considered occupied for the current // port - if (!tryTiming(src_port)) { + if (!reqLayer.tryTiming(src_port)) { DPRINTF(NoncoherentBus, "recvTimingReq: src %s %s 0x%x BUSY\n", src_port->name(), pkt->cmdString(), pkt->getAddr()); return false; @@ -123,12 +124,12 @@ NoncoherentBus::recvTimingReq(PacketPtr pkt, PortID slave_port_id) DPRINTF(NoncoherentBus, "recvTimingReq: src %s %s 0x%x RETRY\n", src_port->name(), pkt->cmdString(), pkt->getAddr()); - failedTiming(src_port, headerFinishTime); + reqLayer.failedTiming(src_port, headerFinishTime); return false; } - succeededTiming(packetFinishTime); + reqLayer.succeededTiming(packetFinishTime); return true; } @@ -141,7 +142,7 @@ NoncoherentBus::recvTimingResp(PacketPtr pkt, PortID master_port_id) // test if the bus should be considered occupied for the current // port - if (!tryTiming(src_port)) { + if (!respLayer.tryTiming(src_port)) { DPRINTF(NoncoherentBus, "recvTimingResp: src %s %s 0x%x BUSY\n", src_port->name(), pkt->cmdString(), pkt->getAddr()); return false; @@ -161,11 +162,20 @@ NoncoherentBus::recvTimingResp(PacketPtr pkt, PortID master_port_id) // deadlock assert(success); - succeededTiming(packetFinishTime); + respLayer.succeededTiming(packetFinishTime); return true; } +void +NoncoherentBus::recvRetry() +{ + // responses never block on forwarding them, so the retry will + // always be coming from a port to which we tried to forward a + // request + reqLayer.recvRetry(); +} + Tick NoncoherentBus::recvAtomic(PacketPtr pkt, PortID slave_port_id) { @@ -201,6 +211,13 @@ NoncoherentBus::recvFunctional(PacketPtr pkt, PortID slave_port_id) masterPorts[dest_id]->sendFunctional(pkt); } +unsigned int +NoncoherentBus::drain(Event *de) +{ + // sum up the individual layers + return reqLayer.drain(de) + respLayer.drain(de); +} + NoncoherentBus* NoncoherentBusParams::create() {