mem-ruby: add andMask to WriteMask
authorTiago Mück <tiago.muck@arm.com>
Tue, 29 Sep 2020 00:15:33 +0000 (19:15 -0500)
committerTiago Mück <tiago.muck@arm.com>
Thu, 11 Feb 2021 22:16:29 +0000 (22:16 +0000)
Change-Id: Ieeb68b405a68226077a2ffee231408f554e758a5
Signed-off-by: Tiago Mück <tiago.muck@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41154
Reviewed-by: Matt Sinclair <mattdsinclair@gmail.com>
Maintainer: Matt Sinclair <mattdsinclair@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/mem/ruby/common/WriteMask.hh
src/mem/ruby/protocol/RubySlicc_Exports.sm

index f1e5f371de569543e8b4095eec7fb6220526e827..895584a5d2cc0ca0b79d3c254381ea39e49909b9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 ARM Limited
+ * Copyright (c) 2020,2021 ARM Limited
  * All rights reserved.
  *
  * The license below extends only to copyright in the software and shall
@@ -159,6 +159,20 @@ class WriteMask
         return true;
     }
 
+    void
+    andMask(const WriteMask & writeMask)
+    {
+        assert(mSize == writeMask.mSize);
+        for (int i = 0; i < mSize; i++) {
+            mMask[i] = (mMask.at(i)) & (writeMask.mMask.at(i));
+        }
+
+        if (writeMask.mAtomic) {
+            mAtomic = true;
+            mAtomicOp = writeMask.mAtomicOp;
+        }
+    }
+
     void
     orMask(const WriteMask & writeMask)
     {
index 1b67dc6033141f857f2664254264ec39c5f4d87f..e48cca524e11dca1d15198e8516e902253f67e5a 100644 (file)
@@ -57,6 +57,7 @@ structure(WriteMask, external="yes", desc="...") {
   bool isEmpty();
   bool isFull();
   bool isOverlap(WriteMask);
+  void andMask(WriteMask);
   void orMask(WriteMask);
   void setInvertedMask(WriteMask);
   void fillMask();