From d789b75a98a9c84775cdb4bf8319045c0338104b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tiago=20M=C3=BCck?= Date: Mon, 28 Sep 2020 19:15:33 -0500 Subject: [PATCH] mem-ruby: add andMask to WriteMask MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Change-Id: Ieeb68b405a68226077a2ffee231408f554e758a5 Signed-off-by: Tiago Mück Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41154 Reviewed-by: Matt Sinclair Maintainer: Matt Sinclair Tested-by: kokoro --- src/mem/ruby/common/WriteMask.hh | 16 +++++++++++++++- src/mem/ruby/protocol/RubySlicc_Exports.sm | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/mem/ruby/common/WriteMask.hh b/src/mem/ruby/common/WriteMask.hh index f1e5f371d..895584a5d 100644 --- a/src/mem/ruby/common/WriteMask.hh +++ b/src/mem/ruby/common/WriteMask.hh @@ -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) { diff --git a/src/mem/ruby/protocol/RubySlicc_Exports.sm b/src/mem/ruby/protocol/RubySlicc_Exports.sm index 1b67dc603..e48cca524 100644 --- a/src/mem/ruby/protocol/RubySlicc_Exports.sm +++ b/src/mem/ruby/protocol/RubySlicc_Exports.sm @@ -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(); -- 2.30.2