mem-ruby: additional WriteMask methods
Change-Id: Ib5d5f892075b38f46d1d802c043853f56e19ea12 Signed-off-by: Tiago Mück <tiago.muck@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31257 Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -1,4 +1,16 @@
|
||||
/*
|
||||
* Copyright (c) 2020 ARM Limited
|
||||
* All rights reserved.
|
||||
*
|
||||
* The license below extends only to copyright in the software and shall
|
||||
* not be construed as granting a license to any other intellectual
|
||||
* property including but not limited to intellectual property relating
|
||||
* to a hardware implementation of the functionality of the software
|
||||
* licensed hereunder. You may use the software subject to the license
|
||||
* terms below provided that you ensure that this notice is replicated
|
||||
* unmodified and in its entirety in all distributions of the software,
|
||||
* modified or unmodified, in source code or in binary form.
|
||||
*
|
||||
* Copyright (c) 2012-15 Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -69,18 +81,18 @@ class WriteMask
|
||||
}
|
||||
|
||||
bool
|
||||
test(int offset)
|
||||
test(int offset) const
|
||||
{
|
||||
assert(offset < mSize);
|
||||
return mMask[offset];
|
||||
}
|
||||
|
||||
void
|
||||
setMask(int offset, int len)
|
||||
setMask(int offset, int len, bool val = true)
|
||||
{
|
||||
assert(mSize >= (offset + len));
|
||||
for (int i = 0; i < len; i++) {
|
||||
mMask[offset + i] = true;
|
||||
mMask[offset + i] = val;
|
||||
}
|
||||
}
|
||||
void
|
||||
@@ -163,6 +175,33 @@ class WriteMask
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
setInvertedMask(const WriteMask & writeMask)
|
||||
{
|
||||
assert(mSize == writeMask.mSize);
|
||||
for (int i = 0; i < mSize; i++) {
|
||||
mMask[i] = !writeMask.mMask.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
firstBitSet(bool val, int offset = 0) const
|
||||
{
|
||||
for (int i = offset; i < mSize; ++i)
|
||||
if (mMask[i] == val)
|
||||
return i;
|
||||
return mSize;
|
||||
}
|
||||
|
||||
int
|
||||
count(int offset = 0) const
|
||||
{
|
||||
int count = 0;
|
||||
for (int i = offset; i < mSize; ++i)
|
||||
count += mMask[i];
|
||||
return count;
|
||||
}
|
||||
|
||||
void print(std::ostream& out) const;
|
||||
|
||||
void
|
||||
|
||||
@@ -58,7 +58,16 @@ structure(WriteMask, external="yes", desc="...") {
|
||||
bool isFull();
|
||||
bool isOverlap(WriteMask);
|
||||
void orMask(WriteMask);
|
||||
void setInvertedMask(WriteMask);
|
||||
void fillMask();
|
||||
void setMask(int,int);
|
||||
bool getMask(int,int);
|
||||
void setMask(int,int,bool);
|
||||
int firstBitSet(bool);
|
||||
int firstBitSet(bool,int);
|
||||
int count();
|
||||
int count(int);
|
||||
bool test(int);
|
||||
}
|
||||
|
||||
structure(DataBlock, external = "yes", desc="..."){
|
||||
|
||||
Reference in New Issue
Block a user