mem: Add Request::isMasked to check for byte strobing
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Wed, 27 Nov 2019 19:16:26 +0000 (19:16 +0000)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Mon, 9 Dec 2019 13:18:48 +0000 (13:18 +0000)
This is trying to overcome the following problem: At the moment a memory
request with a non empty byteEnable mask will be considered masking even
if all elements in the vector are true.

Change-Id: I16ae2c0ea8c3f3370e397bab9d79d6d60c3784bd
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23284
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/mem/packet.hh
src/mem/request.hh

index 4aee81f9ba33dd712260bdfef887b55dcf5d84d1..cf31fa53df7a1f3bf059fdf7044a473125be3ecb 100644 (file)
@@ -1305,7 +1305,7 @@ class Packet : public Printable
     bool
     isMaskedWrite() const
     {
-        return (cmd == MemCmd::WriteReq && !req->getByteEnable().empty());
+        return (cmd == MemCmd::WriteReq && req->isMasked());
     }
 
     /**
index 90d1ee3dd5668fb8cd0daa4588668e284dae83cf..b3268e02e65e3c3a1adc51eb04afd7452f1375bf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013,2017-2018 ARM Limited
+ * Copyright (c) 2012-2013,2017-2019 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
@@ -650,6 +650,20 @@ class Request
         _byteEnable = be;
     }
 
+    /**
+     * Returns true if the memory request is masked, which means
+     * there is at least one byteEnable element which is false
+     * (byte is masked)
+     */
+    bool
+    isMasked() const
+    {
+        return std::find(
+            _byteEnable.begin(),
+            _byteEnable.end(),
+            false) != _byteEnable.end();
+    }
+
     /** Accessor for time. */
     Tick
     time() const