coherent_xbar.cc (10713:eddb533708cb) coherent_xbar.cc (10719:b4fc9ad648aa)
1/*
1/*
2 * Copyright (c) 2011-2014 ARM Limited
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)
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)
58 : BaseXBar(p), system(p->system), snoopFilter(p->snoop_filter),
59 snoopResponseLatency(p->snoop_response_latency)
59{
60 // create the ports based on the size of the master and slave
61 // vector ports, and the presence of the default port, the ports
62 // are enumerated starting from zero
63 for (int i = 0; i < p->port_master_connection_count; ++i) {
64 std::string portName = csprintf("%s.master[%d]", name(), i);
65 MasterPort* bp = new CoherentXBarMasterPort(portName, *this, i);
66 masterPorts.push_back(bp);

--- 95 unchanged lines hidden (view full) ---

162 src_port->name(), pkt->cmdString(), is_express_snoop,
163 pkt->getAddr());
164
165 // store size and command as they might be modified when
166 // forwarding the packet
167 unsigned int pkt_size = pkt->hasData() ? pkt->getSize() : 0;
168 unsigned int pkt_cmd = pkt->cmdToIndex();
169
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
170 calcPacketTiming(pkt);
171 Tick packetFinishTime = curTick() + pkt->payloadDelay;
171 // store the old header delay so we can restore it if needed
172 Tick old_header_delay = pkt->headerDelay;
172
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
173 // uncacheable requests need never be snooped
174 if (!pkt->req->isUncacheable() && !system->bypassCaches()) {
175 // the packet is a memory-mapped request and should be
176 // broadcasted to our snoopers but the source
177 if (snoopFilter) {
178 // check with the snoop filter where to forward this packet
179 auto sf_res = snoopFilter->lookupRequest(pkt, *src_port);
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();
180 packetFinishTime += sf_res.second * clockPeriod();
181 DPRINTF(CoherentXBar, "recvTimingReq: src %s %s 0x%x"\
182 " SF size: %i lat: %i\n", src_port->name(),
183 pkt->cmdString(), pkt->getAddr(), sf_res.first.size(),
184 sf_res.second);
185 forwardTiming(pkt, slave_port_id, sf_res.first);
186 } else {
187 forwardTiming(pkt, slave_port_id);

--- 28 unchanged lines hidden (view full) ---

216
217 // check if we were successful in sending the packet onwards
218 if (!success) {
219 // express snoops and inhibited packets should never be forced
220 // to retry
221 assert(!is_express_snoop);
222 assert(!pkt->memInhibitAsserted());
223
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
224 // undo the calculation so we can check for 0 again
225 pkt->headerDelay = pkt->payloadDelay = 0;
238 // restore the header delay
239 pkt->headerDelay = old_header_delay;
226
227 DPRINTF(CoherentXBar, "recvTimingReq: src %s %s 0x%x RETRY\n",
228 src_port->name(), pkt->cmdString(), pkt->getAddr());
229
230 // update the layer state and schedule an idle event
231 reqLayers[master_port_id]->failedTiming(src_port,
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,
232 clockEdge(headerCycles));
246 clockEdge(Cycles(1)));
233 } else {
234 // express snoops currently bypass the crossbar state entirely
235 if (!is_express_snoop) {
236 // if this particular request will generate a snoop
237 // response
238 if (expect_snoop_resp) {
239 // we should never have an exsiting request outstanding
240 assert(outstandingSnoop.find(pkt->req) ==

--- 54 unchanged lines hidden (view full) ---

295 DPRINTF(CoherentXBar, "recvTimingResp: src %s %s 0x%x\n",
296 src_port->name(), pkt->cmdString(), pkt->getAddr());
297
298 // store size and command as they might be modified when
299 // forwarding the packet
300 unsigned int pkt_size = pkt->hasData() ? pkt->getSize() : 0;
301 unsigned int pkt_cmd = pkt->cmdToIndex();
302
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
303 calcPacketTiming(pkt);
304 Tick packetFinishTime = curTick() + pkt->payloadDelay;
317 // a response sees the response latency
318 Tick xbar_delay = responseLatency * clockPeriod();
305
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
306 if (snoopFilter && !pkt->req->isUncacheable() && !system->bypassCaches()) {
307 // let the snoop filter inspect the response and update its state
308 snoopFilter->updateResponse(pkt, *slavePorts[slave_port_id]);
309 }
310
311 // send the packet through the destination slave port
312 bool success M5_VAR_USED = slavePorts[slave_port_id]->sendTimingResp(pkt);
313

--- 107 unchanged lines hidden (view full) ---

421 // store size and command as they might be modified when
422 // forwarding the packet
423 unsigned int pkt_size = pkt->hasData() ? pkt->getSize() : 0;
424 unsigned int pkt_cmd = pkt->cmdToIndex();
425
426 // responses are never express snoops
427 assert(!pkt->isExpressSnoop());
428
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
429 calcPacketTiming(pkt);
430 Tick packetFinishTime = curTick() + pkt->payloadDelay;
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();
431
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
432 // forward it either as a snoop response or a normal response
433 if (forwardAsSnoop) {
434 // this is a snoop response to a snoop request we forwarded,
435 // e.g. coming from the L1 and going to the L2, and it should
436 // be forwarded as a snoop response
437
438 if (snoopFilter) {
439 // update the probe filter so that it can properly track the line

--- 393 unchanged lines hidden ---
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 ---