Daniel Carvalho has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/17533

Change subject: mem: Add non-block-aligned packet matching functions
......................................................................

mem: Add non-block-aligned packet matching functions

Add non-block-aligned packet matching functions, so that both
address and secure bits are checked when checking whether a
packet matches a request.

Change-Id: Id0069befb925d112e06f250741cb47d9dfa249cc
Signed-off-by: Daniel R. Carvalho <[email protected]>
---
M src/mem/cache/cache.cc
M src/mem/packet.cc
M src/mem/packet.hh
M src/mem/packet_queue.cc
M src/mem/simple_mem.cc
5 files changed, 39 insertions(+), 10 deletions(-)



diff --git a/src/mem/cache/cache.cc b/src/mem/cache/cache.cc
index 139c8a1..193ac4b 100644
--- a/src/mem/cache/cache.cc
+++ b/src/mem/cache/cache.cc
@@ -383,7 +383,7 @@
pkt->req->masterId());
             pf = new Packet(req, pkt->cmd);
             pf->allocate();
-            assert(pf->getAddr() == pkt->getAddr());
+            assert(pf->match(pkt));
             assert(pf->getSize() == pkt->getSize());
         }

@@ -781,7 +781,7 @@
                     pkt->payloadDelay;
                 if (pkt->isRead() && !is_error) {
                     // sanity check
-                    assert(pkt->getAddr() == tgt_pkt->getAddr());
+                    assert(pkt->match(tgt_pkt));
                     assert(pkt->getSize() >= tgt_pkt->getSize());

                     tgt_pkt->setData(pkt->getConstPtr<uint8_t>());
diff --git a/src/mem/packet.cc b/src/mem/packet.cc
index 7e04a05..07c0578 100644
--- a/src/mem/packet.cc
+++ b/src/mem/packet.cc
@@ -402,6 +402,18 @@
     return match(pkt->getBlockAddr(blk_size), pkt->isSecure(), blk_size);
 }

+bool
+Packet::match(const Addr addr, const bool is_secure) const
+{
+    return (getAddr() == addr) && (isSecure() == is_secure);
+}
+
+bool
+Packet::match(const PacketPtr pkt) const
+{
+    return match(pkt->getAddr(), pkt->isSecure());
+}
+
 Packet::PrintReqState::PrintReqState(std::ostream &_os, int _verbosity)
     : curPrefixPtr(new std::string("")), os(_os), verbosity(_verbosity)
 {
diff --git a/src/mem/packet.hh b/src/mem/packet.hh
index 2705d46..ca13d46 100644
--- a/src/mem/packet.hh
+++ b/src/mem/packet.hh
@@ -973,7 +973,8 @@
     }

     /**
-     * Check if packet corresponds to a given address and address space.
+     * Check if packet corresponds to a given block-aligned address and
+     * address space.
      *
      * @param addr The address to compare against.
      * @param is_secure Whether addr belongs to the secure address space.
@@ -984,16 +985,33 @@
                                                                    const;

     /**
-     * Check if this packet refers to the same address-secure bit as the
-     * given packet.
+     * Check if this packet refers to the same block-aligned address and
+     * address space as another packet.
      *
-     * @param addr The address to compare against.
-     * @param is_secure Whether addr belongs to the secure address space.
+     * @param pkt The packet to compare against.
      * @param blk_size Block size in bytes.
      * @return Whether packet matches description.
      */
     bool match(const PacketPtr pkt, const int blk_size) const;

+    /**
+     * Check if packet corresponds to a given address and address space.
+     *
+     * @param addr The address to compare against.
+     * @param is_secure Whether addr belongs to the secure address space.
+     * @return Whether packet matches description.
+     */
+    bool match(const Addr addr, const bool is_secure) const;
+
+    /**
+     * Check if this packet refers to the same address and address space as
+     * another packet.
+     *
+     * @param pkt The packet to compare against.
+     * @return Whether packet matches description.
+     */
+    bool match(const PacketPtr pkt) const;
+
   public:
     /**
      * @{
diff --git a/src/mem/packet_queue.cc b/src/mem/packet_queue.cc
index 282625a..7371871 100644
--- a/src/mem/packet_queue.cc
+++ b/src/mem/packet_queue.cc
@@ -138,8 +138,7 @@
     auto it = transmitList.end();
     while (it != transmitList.begin()) {
         --it;
-        if ((forceOrder && it->pkt->getAddr() == pkt->getAddr()) ||
-            it->tick <= when) {
+        if ((forceOrder && it->pkt->match(pkt)) || it->tick <= when) {
// emplace inserts the element before the position pointed to by
             // the iterator, so advance it one step
             transmitList.emplace(++it, when, pkt);
diff --git a/src/mem/simple_mem.cc b/src/mem/simple_mem.cc
index 32fea1e..cade8ba 100644
--- a/src/mem/simple_mem.cc
+++ b/src/mem/simple_mem.cc
@@ -164,7 +164,7 @@
         auto i = packetQueue.end();
         --i;
         while (i != packetQueue.begin() && when_to_send < i->tick &&
-               i->pkt->getAddr() != pkt->getAddr())
+               !i->pkt->match(pkt))
             --i;

         // emplace inserts the element before the position pointed to by

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

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Id0069befb925d112e06f250741cb47d9dfa249cc
Gerrit-Change-Number: 17533
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Carvalho <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to