Tiago Mück has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/22019 )

Change subject: mem-ruby: Allow MessageBuffer functional reads
......................................................................

mem-ruby: Allow MessageBuffer functional reads

Valid lines withing unhandled messages may need to be checked when the
line is in a transient state.

Change-Id: I433e9bb960680348c25bf19ace2d405109380241
Signed-off-by: Tiago Mück <tiago.m...@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22019
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Bradford Beckmann <brad.beckm...@amd.com>
Maintainer: Jason Lowe-Power <power...@gmail.com>
---
M src/mem/ruby/network/MessageBuffer.cc
M src/mem/ruby/network/MessageBuffer.hh
2 files changed, 53 insertions(+), 11 deletions(-)

Approvals:
  Bradford Beckmann: Looks good to me, approved
  Jason Lowe-Power: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/mem/ruby/network/MessageBuffer.cc b/src/mem/ruby/network/MessageBuffer.cc
index f8cab3c..f5562dc 100644
--- a/src/mem/ruby/network/MessageBuffer.cc
+++ b/src/mem/ruby/network/MessageBuffer.cc
@@ -1,4 +1,16 @@
 /*
+ * Copyright (c) 2019 ARM Limited
+ * All rights reserved.
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder.  You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
  * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
  * All rights reserved.
  *
@@ -438,17 +450,21 @@
 }

 uint32_t
-MessageBuffer::functionalWrite(Packet *pkt)
+MessageBuffer::functionalAccess(Packet *pkt, bool is_read)
 {
-    uint32_t num_functional_writes = 0;
+    DPRINTF(RubyQueue, "functional %s for %#x\n",
+            is_read ? "read" : "write", pkt->getAddr());
+
+    uint32_t num_functional_accesses = 0;

     // Check the priority heap and write any messages that may
     // correspond to the address in the packet.
     for (unsigned int i = 0; i < m_prio_heap.size(); ++i) {
         Message *msg = m_prio_heap[i].get();
-        if (msg->functionalWrite(pkt)) {
-            num_functional_writes++;
-        }
+        if (is_read && msg->functionalRead(pkt))
+            return 1;
+        else if (!is_read && msg->functionalWrite(pkt))
+            num_functional_accesses++;
     }

     // Check the stall queue and write any messages that may
@@ -461,13 +477,14 @@
             it != (map_iter->second).end(); ++it) {

             Message *msg = (*it).get();
-            if (msg->functionalWrite(pkt)) {
-                num_functional_writes++;
-            }
+            if (is_read && msg->functionalRead(pkt))
+                return 1;
+            else if (!is_read && msg->functionalWrite(pkt))
+                num_functional_accesses++;
         }
     }

-    return num_functional_writes;
+    return num_functional_accesses;
 }

 MessageBuffer *
diff --git a/src/mem/ruby/network/MessageBuffer.hh b/src/mem/ruby/network/MessageBuffer.hh
index f92d565..0e11529 100644
--- a/src/mem/ruby/network/MessageBuffer.hh
+++ b/src/mem/ruby/network/MessageBuffer.hh
@@ -1,4 +1,16 @@
 /*
+ * Copyright (c) 2019 ARM Limited
+ * All rights reserved.
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder.  You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
  * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
  * All rights reserved.
  *
@@ -133,12 +145,25 @@
     // Function for figuring out if any of the messages in the buffer need
     // to be updated with the data from the packet.
     // Return value indicates the number of messages that were updated.
-    // This required for debugging the code.
-    uint32_t functionalWrite(Packet *pkt);
+    uint32_t functionalWrite(Packet *pkt)
+    {
+        return functionalAccess(pkt, false);
+    }
+
+    // Function for figuring if message in the buffer has valid data for
+    // the packet.
+    // Returns true only if a message was found with valid data and the
+    // read was performed.
+    bool functionalRead(Packet *pkt)
+    {
+        return functionalAccess(pkt, true) == 1;
+    }

   private:
     void reanalyzeList(std::list<MsgPtr> &, Tick);

+    uint32_t functionalAccess(Packet *pkt, bool is_read);
+
   private:
     // Data Members (m_ prefix)
     //! Consumer to signal a wakeup(), can be NULL

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/22019
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I433e9bb960680348c25bf19ace2d405109380241
Gerrit-Change-Number: 22019
Gerrit-PatchSet: 4
Gerrit-Owner: Tiago Mück <tiago.m...@arm.com>
Gerrit-Reviewer: Bradford Beckmann <brad.beckm...@amd.com>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: Tiago Mück <tiago.m...@arm.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-CC: Nikos Nikoleris <nikos.nikole...@arm.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to