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 <bbruce@ucdavis.edu>
Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Matthew Poremba
2020-07-14 10:57:07 -05:00
parent a5b3a36bf3
commit 33f3659825

View File

@@ -40,6 +40,8 @@
class WriteMask
{
public:
typedef std::vector<std::pair<int, AtomicOpFunctor* >> 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<bool> &mask,
std::vector<std::pair<int, AtomicOpFunctor*> > atomicOp)
WriteMask(int size, std::vector<bool> &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<bool> mMask;
bool mAtomic;
std::vector<std::pair<int, AtomicOpFunctor*> > mAtomicOp;
AtomicOpVector mAtomicOp;
};
inline std::ostream&