changeset 73eeda352933 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=73eeda352933
description:
        Port: Add isSnooping to slave port (asking master port)

        This patch adds isSnooping to the slave port, and thus avoids going
        through getMasterPort to be able to ask the master. Over the course of
        the next few patches, all getMasterPort/getSlavePort in Port and
        MemObject are to be protocol agnostic, and the snooping is part of the
        protocol layer.

        The function is already present on the master port, where it is
        implemented by the module itself, e.g. a cache. On the slave side, it
        is merely asking the connected master port. The same name is used by
        both functions despite their difference in behaviour. The initial
        design used isMasterSnooping on the slave port side, but the more
        verbose function name was later changed.

diffstat:

 src/mem/cache/cache_impl.hh     |  2 +-
 src/mem/coherent_bus.cc         |  3 ++-
 src/mem/comm_monitor.cc         |  3 ++-
 src/mem/port.hh                 |  7 +++++++
 src/mem/ruby/system/RubyPort.cc |  3 ++-
 5 files changed, 14 insertions(+), 4 deletions(-)

diffs (68 lines):

diff -r b5a084a6159b -r 73eeda352933 src/mem/cache/cache_impl.hh
--- a/src/mem/cache/cache_impl.hh       Mon Jul 09 12:35:31 2012 -0400
+++ b/src/mem/cache/cache_impl.hh       Mon Jul 09 12:35:32 2012 -0400
@@ -795,7 +795,7 @@
         // continues towards the memory side
         if (fromCpuSide) {
             memSidePort->sendFunctional(pkt);
-        } else if (forwardSnoops && cpuSidePort->getMasterPort().isSnooping()) 
{
+        } else if (forwardSnoops && cpuSidePort->isSnooping()) {
             // if it came from the memory side, it must be a snoop request
             // and we should only forward it if we are forwarding snoops
             cpuSidePort->sendFunctionalSnoop(pkt);
diff -r b5a084a6159b -r 73eeda352933 src/mem/coherent_bus.cc
--- a/src/mem/coherent_bus.cc   Mon Jul 09 12:35:31 2012 -0400
+++ b/src/mem/coherent_bus.cc   Mon Jul 09 12:35:32 2012 -0400
@@ -92,7 +92,8 @@
     // neighbouring master ports are snooping and add them as snoopers
     for (SlavePortConstIter p = slavePorts.begin(); p != slavePorts.end();
          ++p) {
-        if ((*p)->getMasterPort().isSnooping()) {
+        // check if the connected master port is snooping
+        if ((*p)->isSnooping()) {
             DPRINTF(BusAddrRanges, "Adding snooping master %s\n",
                     (*p)->getMasterPort().name());
             snoopPorts.push_back(*p);
diff -r b5a084a6159b -r 73eeda352933 src/mem/comm_monitor.cc
--- a/src/mem/comm_monitor.cc   Mon Jul 09 12:35:31 2012 -0400
+++ b/src/mem/comm_monitor.cc   Mon Jul 09 12:35:32 2012 -0400
@@ -328,7 +328,8 @@
 bool
 CommMonitor::isSnooping() const
 {
-    return slavePort.getMasterPort().isSnooping();
+    // check if the connected master port is snooping
+    return slavePort.isSnooping();
 }
 
 unsigned
diff -r b5a084a6159b -r 73eeda352933 src/mem/port.hh
--- a/src/mem/port.hh   Mon Jul 09 12:35:31 2012 -0400
+++ b/src/mem/port.hh   Mon Jul 09 12:35:32 2012 -0400
@@ -356,6 +356,13 @@
     unsigned peerBlockSize() const;
 
     /**
+     * Find out if the peer master port is snooping or not.
+     *
+     * @return true if the peer master port is snooping
+     */
+    bool isSnooping() const { return _masterPort->isSnooping(); }
+
+    /**
      * Called by the owner to send a range change
      */
     void sendRangeChange() const { _masterPort->recvRangeChange(); }
diff -r b5a084a6159b -r 73eeda352933 src/mem/ruby/system/RubyPort.cc
--- a/src/mem/ruby/system/RubyPort.cc   Mon Jul 09 12:35:31 2012 -0400
+++ b/src/mem/ruby/system/RubyPort.cc   Mon Jul 09 12:35:32 2012 -0400
@@ -695,7 +695,8 @@
     // should this really be using funcMasterId?
     Request req(address.getAddress(), 0, 0, Request::funcMasterId);
     for (CpuPortIter p = slave_ports.begin(); p != slave_ports.end(); ++p) {
-        if ((*p)->getMasterPort().isSnooping()) {
+        // check if the connected master port is snooping
+        if ((*p)->isSnooping()) {
             Packet *pkt = new Packet(&req, MemCmd::InvalidationReq);
             // send as a snoop request
             (*p)->sendTimingSnoopReq(pkt);
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to