From 33f36598256565b623f7c9ac1428fe39df6cd23b Mon Sep 17 00:00:00 2001 From: Matthew Poremba Date: Tue, 14 Jul 2020 10:57:07 -0500 Subject: [PATCH] mem-ruby: Getter/setter for atomic ops in WriteMask Adding getter and setter methods for getting and setting the atomic ops in the WriteMask class. This allows for message types with WriteMasks to get or set the atomic ops without explicitly modifying the constructor for the message type. This will beused by the DMASequencer which uses the SequencerMsg type where the constructor is auto generated via SLICC. Change-Id: I71787d294c1b89547618e9a13e386b65bb3e1021 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31474 Reviewed-by: Bobby R. Bruce Reviewed-by: Anthony Gutierrez Maintainer: Jason Lowe-Power Tested-by: kokoro --- src/mem/ruby/common/WriteMask.hh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/mem/ruby/common/WriteMask.hh b/src/mem/ruby/common/WriteMask.hh index 0ba69891a..6a0a041e7 100644 --- a/src/mem/ruby/common/WriteMask.hh +++ b/src/mem/ruby/common/WriteMask.hh @@ -40,6 +40,8 @@ class WriteMask { public: + typedef std::vector> AtomicOpVector; + WriteMask() : mSize(RubySystem::getBlockSizeBytes()), mMask(mSize, false), mAtomic(false) @@ -53,8 +55,7 @@ class WriteMask : mSize(size), mMask(mask), mAtomic(false) {} - WriteMask(int size, std::vector &mask, - std::vector > atomicOp) + WriteMask(int size, std::vector &mask, AtomicOpVector atomicOp) : mSize(size), mMask(mask), mAtomic(true), mAtomicOp(atomicOp) {} @@ -184,11 +185,25 @@ class WriteMask (*fnctr)(p); } } + + const AtomicOpVector& + getAtomicOps() const + { + return mAtomicOp; + } + + void + setAtomicOps(const AtomicOpVector& atomicOps) + { + mAtomic = true; + mAtomicOp = std::move(atomicOps); + } + private: int mSize; std::vector mMask; bool mAtomic; - std::vector > mAtomicOp; + AtomicOpVector mAtomicOp; }; inline std::ostream& -- 2.30.2