base: Add addIntlvBits to AddrRange
This method performs the opposite operation of removeIntlvBits and can be used to transform a channel-local address to a global PA. Change-Id: I2fab587d7c094597e52422305775ac7f31efba34 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/21599 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -121,6 +121,16 @@ class AddrRangeBase : public testing::Test {
|
||||
}
|
||||
}
|
||||
|
||||
void testAddRemoveIntlvBits()
|
||||
{
|
||||
for (Addr addr = start; addr <= end; addr++) {
|
||||
AddrRange &r = range[getIndex(addr)];
|
||||
Addr ch_addr = r.removeIntlvBits(addr);
|
||||
Addr pa = r.addIntlvBits(ch_addr);
|
||||
ASSERT_EQ(addr, pa);
|
||||
}
|
||||
}
|
||||
|
||||
static const Addr end = 0x1ffff;
|
||||
static const Addr start = 0x0;
|
||||
static const int intlvSize = 4;
|
||||
@@ -162,6 +172,11 @@ TEST_F(AddrRangeCont, AddrRangeGetOffset)
|
||||
testGetOffset();
|
||||
}
|
||||
|
||||
TEST_F(AddrRangeCont, AddrRangeAddRemoveIntlvBits)
|
||||
{
|
||||
testAddRemoveIntlvBits();
|
||||
}
|
||||
|
||||
|
||||
class AddrRangeContLegacy : public AddrRangeCont {
|
||||
protected:
|
||||
@@ -185,6 +200,10 @@ TEST_F(AddrRangeContLegacy, AddrRangeGetOffset)
|
||||
testGetOffset();
|
||||
}
|
||||
|
||||
TEST_F(AddrRangeContLegacy, AddrRangeAddRemoveIntlvBits)
|
||||
{
|
||||
testAddRemoveIntlvBits();
|
||||
}
|
||||
|
||||
class AddrRangeArb : public AddrRangeBase {
|
||||
protected:
|
||||
@@ -218,3 +237,8 @@ TEST_F(AddrRangeArb, AddrRangeGetOffset)
|
||||
{
|
||||
testGetOffset();
|
||||
}
|
||||
|
||||
TEST_F(AddrRangeArb, AddrRangeAddRemoveIntlvBits)
|
||||
{
|
||||
testAddRemoveIntlvBits();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user