coherent_xbar.cc (10883:9294c4a60251) coherent_xbar.cc (10888:85a001f2193b)
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

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

84 snoopLayers.push_back(new SnoopRespLayer(*bp, *this,
85 csprintf(".snoopLayer%d",
86 defaultPortID)));
87 }
88
89 // create the slave ports, once again starting at zero
90 for (int i = 0; i < p->port_slave_connection_count; ++i) {
91 std::string portName = csprintf("%s.slave[%d]", name(), i);
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

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

84 snoopLayers.push_back(new SnoopRespLayer(*bp, *this,
85 csprintf(".snoopLayer%d",
86 defaultPortID)));
87 }
88
89 // create the slave ports, once again starting at zero
90 for (int i = 0; i < p->port_slave_connection_count; ++i) {
91 std::string portName = csprintf("%s.slave[%d]", name(), i);
92 SlavePort* bp = new CoherentXBarSlavePort(portName, *this, i);
92 QueuedSlavePort* bp = new CoherentXBarSlavePort(portName, *this, i);
93 slavePorts.push_back(bp);
94 respLayers.push_back(new RespLayer(*bp, *this,
95 csprintf(".respLayer%d", i)));
96 snoopRespPorts.push_back(new SnoopRespPort(*bp, *this));
97 }
98
99 if (snoopFilter)
100 snoopFilter->setSlavePorts(slavePorts);

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

340 // determine how long to be crossbar layer is busy
341 Tick packetFinishTime = clockEdge(Cycles(1)) + pkt->payloadDelay;
342
343 if (snoopFilter && !system->bypassCaches()) {
344 // let the snoop filter inspect the response and update its state
345 snoopFilter->updateResponse(pkt, *slavePorts[slave_port_id]);
346 }
347
93 slavePorts.push_back(bp);
94 respLayers.push_back(new RespLayer(*bp, *this,
95 csprintf(".respLayer%d", i)));
96 snoopRespPorts.push_back(new SnoopRespPort(*bp, *this));
97 }
98
99 if (snoopFilter)
100 snoopFilter->setSlavePorts(slavePorts);

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

340 // determine how long to be crossbar layer is busy
341 Tick packetFinishTime = clockEdge(Cycles(1)) + pkt->payloadDelay;
342
343 if (snoopFilter && !system->bypassCaches()) {
344 // let the snoop filter inspect the response and update its state
345 snoopFilter->updateResponse(pkt, *slavePorts[slave_port_id]);
346 }
347
348 // send the packet through the destination slave port
349 bool success M5_VAR_USED = slavePorts[slave_port_id]->sendTimingResp(pkt);
348 // send the packet through the destination slave port and pay for
349 // any outstanding header delay
350 Tick latency = pkt->headerDelay;
351 pkt->headerDelay = 0;
352 slavePorts[slave_port_id]->schedTimingResp(pkt, curTick() + latency);
350
353
351 // currently it is illegal to block responses... can lead to
352 // deadlock
353 assert(success);
354
355 // remove the request from the routing table
356 routeTo.erase(route_lookup);
357
358 respLayers[slave_port_id]->succeededTiming(packetFinishTime);
359
360 // stats updates
361 pktCount[slave_port_id][master_port_id]++;
362 pktSize[slave_port_id][master_port_id] += pkt_size;

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

512 *slavePorts[dest_port_id]);
513 }
514
515 DPRINTF(CoherentXBar, "recvTimingSnoopResp: src %s %s 0x%x"\
516 " FWD RESP\n", src_port->name(), pkt->cmdString(),
517 pkt->getAddr());
518
519 // as a normal response, it should go back to a master through
354 // remove the request from the routing table
355 routeTo.erase(route_lookup);
356
357 respLayers[slave_port_id]->succeededTiming(packetFinishTime);
358
359 // stats updates
360 pktCount[slave_port_id][master_port_id]++;
361 pktSize[slave_port_id][master_port_id] += pkt_size;

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

511 *slavePorts[dest_port_id]);
512 }
513
514 DPRINTF(CoherentXBar, "recvTimingSnoopResp: src %s %s 0x%x"\
515 " FWD RESP\n", src_port->name(), pkt->cmdString(),
516 pkt->getAddr());
517
518 // as a normal response, it should go back to a master through
520 // one of our slave ports, at this point we are ignoring the
521 // fact that the response layer could be busy and do not touch
522 // its state
523 bool success M5_VAR_USED =
524 slavePorts[dest_port_id]->sendTimingResp(pkt);
519 // one of our slave ports, we also pay for any outstanding
520 // header latency
521 Tick latency = pkt->headerDelay;
522 pkt->headerDelay = 0;
523 slavePorts[dest_port_id]->schedTimingResp(pkt, curTick() + latency);
525
524
526 // @todo Put the response in an internal FIFO and pass it on
527 // to the response layer from there
528
529 // currently it is illegal to block responses... can lead
530 // to deadlock
531 assert(success);
532
533 respLayers[dest_port_id]->succeededTiming(packetFinishTime);
534 }
535
536 // remove the request from the routing table
537 routeTo.erase(route_lookup);
538
539 // stats updates
540 transDist[pkt_cmd]++;
541 snoops++;
542
543 return true;
544}
545
546
547void
548CoherentXBar::forwardTiming(PacketPtr pkt, PortID exclude_slave_port_id,
525 respLayers[dest_port_id]->succeededTiming(packetFinishTime);
526 }
527
528 // remove the request from the routing table
529 routeTo.erase(route_lookup);
530
531 // stats updates
532 transDist[pkt_cmd]++;
533 snoops++;
534
535 return true;
536}
537
538
539void
540CoherentXBar::forwardTiming(PacketPtr pkt, PortID exclude_slave_port_id,
549 const std::vector& dests)
541 const std::vector<QueuedSlavePort*>& dests)
550{
551 DPRINTF(CoherentXBar, "%s for %s address %x size %d\n", __func__,
552 pkt->cmdString(), pkt->getAddr(), pkt->getSize());
553
554 // snoops should only happen if the system isn't bypassing caches
555 assert(!system->bypassCaches());
556
557 unsigned fanout = 0;

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

695 // @todo: Not setting header time
696 pkt->payloadDelay = snoop_response_latency;
697 return snoop_response_latency;
698}
699
700std::pair<MemCmd, Tick>
701CoherentXBar::forwardAtomic(PacketPtr pkt, PortID exclude_slave_port_id,
702 PortID source_master_port_id,
542{
543 DPRINTF(CoherentXBar, "%s for %s address %x size %d\n", __func__,
544 pkt->cmdString(), pkt->getAddr(), pkt->getSize());
545
546 // snoops should only happen if the system isn't bypassing caches
547 assert(!system->bypassCaches());
548
549 unsigned fanout = 0;

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

687 // @todo: Not setting header time
688 pkt->payloadDelay = snoop_response_latency;
689 return snoop_response_latency;
690}
691
692std::pair<MemCmd, Tick>
693CoherentXBar::forwardAtomic(PacketPtr pkt, PortID exclude_slave_port_id,
694 PortID source_master_port_id,
703 const std::vector& dests)
695 const std::vector<QueuedSlavePort*>& dests)
704{
705 // the packet may be changed on snoops, record the original
706 // command to enable us to restore it between snoops so that
707 // additional snoops can take place properly
708 MemCmd orig_cmd = pkt->cmd;
709 MemCmd snoop_response_cmd = MemCmd::InvalidCmd;
710 Tick snoop_response_latency = 0;
711

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

782 if (!system->bypassCaches()) {
783 // forward to all snoopers but the source
784 forwardFunctional(pkt, slave_port_id);
785 }
786
787 // there is no need to continue if the snooping has found what we
788 // were looking for and the packet is already a response
789 if (!pkt->isResponse()) {
696{
697 // the packet may be changed on snoops, record the original
698 // command to enable us to restore it between snoops so that
699 // additional snoops can take place properly
700 MemCmd orig_cmd = pkt->cmd;
701 MemCmd snoop_response_cmd = MemCmd::InvalidCmd;
702 Tick snoop_response_latency = 0;
703

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

774 if (!system->bypassCaches()) {
775 // forward to all snoopers but the source
776 forwardFunctional(pkt, slave_port_id);
777 }
778
779 // there is no need to continue if the snooping has found what we
780 // were looking for and the packet is already a response
781 if (!pkt->isResponse()) {
782 // since our slave ports are queued ports we need to check them as well
783 for (const auto& p : slavePorts) {
784 // if we find a response that has the data, then the
785 // downstream caches/memories may be out of date, so simply stop
786 // here
787 if (p->checkFunctional(pkt)) {
788 if (pkt->needsResponse())
789 pkt->makeResponse();
790 return;
791 }
792 }
793
790 PortID dest_id = findPort(pkt->getAddr());
791
792 masterPorts[dest_id]->sendFunctional(pkt);
793 }
794}
795
796void
797CoherentXBar::recvFunctionalSnoop(PacketPtr pkt, PortID master_port_id)

--- 78 unchanged lines hidden ---
794 PortID dest_id = findPort(pkt->getAddr());
795
796 masterPorts[dest_id]->sendFunctional(pkt);
797 }
798}
799
800void
801CoherentXBar::recvFunctionalSnoop(PacketPtr pkt, PortID master_port_id)

--- 78 unchanged lines hidden ---