1/* |
2 * Copyright (c) 2011-2015 ARM Limited |
3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software 9 * licensed hereunder. You may use the software subject to the license 10 * terms below provided that you ensure that this notice is replicated --- 39 unchanged lines hidden (view full) --- 50#include "base/misc.hh" 51#include "base/trace.hh" 52#include "debug/AddrRanges.hh" 53#include "debug/CoherentXBar.hh" 54#include "mem/coherent_xbar.hh" 55#include "sim/system.hh" 56 57CoherentXBar::CoherentXBar(const CoherentXBarParams *p) |
58 : BaseXBar(p), system(p->system), snoopFilter(p->snoop_filter), 59 snoopResponseLatency(p->snoop_response_latency) |
60{ 61 // create the ports based on the size of the master and slave 62 // vector ports, and the presence of the default port, the ports 63 // are enumerated starting from zero 64 for (int i = 0; i < p->port_master_connection_count; ++i) { 65 std::string portName = csprintf("%s.master[%d]", name(), i); 66 MasterPort* bp = new CoherentXBarMasterPort(portName, *this, i); 67 masterPorts.push_back(bp); --- 95 unchanged lines hidden (view full) --- 163 src_port->name(), pkt->cmdString(), is_express_snoop, 164 pkt->getAddr()); 165 166 // store size and command as they might be modified when 167 // forwarding the packet 168 unsigned int pkt_size = pkt->hasData() ? pkt->getSize() : 0; 169 unsigned int pkt_cmd = pkt->cmdToIndex(); 170 |
171 // store the old header delay so we can restore it if needed 172 Tick old_header_delay = pkt->headerDelay; |
173 |
174 // a request sees the frontend and forward latency 175 Tick xbar_delay = (frontendLatency + forwardLatency) * clockPeriod(); 176 177 // set the packet header and payload delay 178 calcPacketTiming(pkt, xbar_delay); 179 180 // determine how long to be crossbar layer is busy 181 Tick packetFinishTime = clockEdge(Cycles(1)) + pkt->payloadDelay; 182 |
183 // uncacheable requests need never be snooped 184 if (!pkt->req->isUncacheable() && !system->bypassCaches()) { 185 // the packet is a memory-mapped request and should be 186 // broadcasted to our snoopers but the source 187 if (snoopFilter) { 188 // check with the snoop filter where to forward this packet 189 auto sf_res = snoopFilter->lookupRequest(pkt, *src_port); |
190 // If SnoopFilter is enabled, the total time required by a packet 191 // to be delivered through the xbar has to be charged also with 192 // to lookup latency of the snoop filter (sf_res.second). 193 pkt->headerDelay += sf_res.second * clockPeriod(); |
194 packetFinishTime += sf_res.second * clockPeriod(); 195 DPRINTF(CoherentXBar, "recvTimingReq: src %s %s 0x%x"\ 196 " SF size: %i lat: %i\n", src_port->name(), 197 pkt->cmdString(), pkt->getAddr(), sf_res.first.size(), 198 sf_res.second); 199 forwardTiming(pkt, slave_port_id, sf_res.first); 200 } else { 201 forwardTiming(pkt, slave_port_id); --- 28 unchanged lines hidden (view full) --- 230 231 // check if we were successful in sending the packet onwards 232 if (!success) { 233 // express snoops and inhibited packets should never be forced 234 // to retry 235 assert(!is_express_snoop); 236 assert(!pkt->memInhibitAsserted()); 237 |
238 // restore the header delay 239 pkt->headerDelay = old_header_delay; |
240 241 DPRINTF(CoherentXBar, "recvTimingReq: src %s %s 0x%x RETRY\n", 242 src_port->name(), pkt->cmdString(), pkt->getAddr()); 243 244 // update the layer state and schedule an idle event 245 reqLayers[master_port_id]->failedTiming(src_port, |
246 clockEdge(Cycles(1))); |
247 } else { 248 // express snoops currently bypass the crossbar state entirely 249 if (!is_express_snoop) { 250 // if this particular request will generate a snoop 251 // response 252 if (expect_snoop_resp) { 253 // we should never have an exsiting request outstanding 254 assert(outstandingSnoop.find(pkt->req) == --- 54 unchanged lines hidden (view full) --- 309 DPRINTF(CoherentXBar, "recvTimingResp: src %s %s 0x%x\n", 310 src_port->name(), pkt->cmdString(), pkt->getAddr()); 311 312 // store size and command as they might be modified when 313 // forwarding the packet 314 unsigned int pkt_size = pkt->hasData() ? pkt->getSize() : 0; 315 unsigned int pkt_cmd = pkt->cmdToIndex(); 316 |
317 // a response sees the response latency 318 Tick xbar_delay = responseLatency * clockPeriod(); |
319 |
320 // set the packet header and payload delay 321 calcPacketTiming(pkt, xbar_delay); 322 323 // determine how long to be crossbar layer is busy 324 Tick packetFinishTime = clockEdge(Cycles(1)) + pkt->payloadDelay; 325 |
326 if (snoopFilter && !pkt->req->isUncacheable() && !system->bypassCaches()) { 327 // let the snoop filter inspect the response and update its state 328 snoopFilter->updateResponse(pkt, *slavePorts[slave_port_id]); 329 } 330 331 // send the packet through the destination slave port 332 bool success M5_VAR_USED = slavePorts[slave_port_id]->sendTimingResp(pkt); 333 --- 107 unchanged lines hidden (view full) --- 441 // store size and command as they might be modified when 442 // forwarding the packet 443 unsigned int pkt_size = pkt->hasData() ? pkt->getSize() : 0; 444 unsigned int pkt_cmd = pkt->cmdToIndex(); 445 446 // responses are never express snoops 447 assert(!pkt->isExpressSnoop()); 448 |
449 // a snoop response sees the snoop response latency, and if it is 450 // forwarded as a normal response, the response latency 451 Tick xbar_delay = 452 (forwardAsSnoop ? snoopResponseLatency : responseLatency) * 453 clockPeriod(); |
454 |
455 // set the packet header and payload delay 456 calcPacketTiming(pkt, xbar_delay); 457 458 // determine how long to be crossbar layer is busy 459 Tick packetFinishTime = clockEdge(Cycles(1)) + pkt->payloadDelay; 460 |
461 // forward it either as a snoop response or a normal response 462 if (forwardAsSnoop) { 463 // this is a snoop response to a snoop request we forwarded, 464 // e.g. coming from the L1 and going to the L2, and it should 465 // be forwarded as a snoop response 466 467 if (snoopFilter) { 468 // update the probe filter so that it can properly track the line --- 393 unchanged lines hidden --- |