summaryrefslogtreecommitdiff
path: root/src/unittest
diff options
context:
space:
mode:
authorNikos Nikoleris <nikos.nikoleris@arm.com>2018-04-18 11:56:08 +0100
committerNikos Nikoleris <nikos.nikoleris@arm.com>2018-06-19 14:24:25 +0000
commit683f411dcab4bb2275902f79f32eeee7c2e0b00a (patch)
tree0e390a261dbab91766f881bd4330e4ee14d4ee3c /src/unittest
parent699ef82eba4ffe4ba49645968d2969b56599b617 (diff)
downloadgem5-683f411dcab4bb2275902f79f32eeee7c2e0b00a.tar.xz
base, mem: Disambiguate if an addr range is contained or overlaps
We need to determined whether an address range is fully contained or it overlaps with an address range in the address range in the mmap. As an example, we use address range maps to associate ports to address ranges and we determine which port we will forward the request based on which address range contains the addresses accessed by the request. We also need to make sure that when we add a new port to the address range map, its address range does not overlap with any of the existing ports. This patch splits the function find() into two functions contains() and intersects() to implement this distinct functionality. It also changes the xbar and the physical memory to use the right function. Change-Id: If3fd3f774a16b27db2df76dc04f1d61824938008 Reviewed-on: https://gem5-review.googlesource.com/11115 Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Diffstat (limited to 'src/unittest')
-rw-r--r--src/unittest/rangemaptest.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/unittest/rangemaptest.cc b/src/unittest/rangemaptest.cc
index 6975f66ef..88e1c4d66 100644
--- a/src/unittest/rangemaptest.cc
+++ b/src/unittest/rangemaptest.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012 ARM Limited
+ * Copyright (c) 2012, 2018 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -59,11 +59,14 @@ main()
i = r.insert(RangeIn(60, 90), 3);
assert(i != r.end());
- i = r.find(RangeIn(20, 30));
+ i = r.intersects(RangeIn(20, 30));
assert(i != r.end());
cout << i->first.to_string() << " " << i->second << endl;
- i = r.find(RangeIn(55, 55));
+ i = r.contains(RangeIn(55, 55));
+ assert(i == r.end());
+
+ i = r.intersects(RangeIn(55, 55));
assert(i == r.end());
i = r.insert(RangeIn(0, 12), 1);
@@ -72,7 +75,7 @@ main()
i = r.insert(RangeIn(0, 9), 1);
assert(i != r.end());
- i = r.find(RangeIn(20, 30));
+ i = r.contains(RangeIn(20, 30));
assert(i != r.end());
cout << i->first.to_string() << " " << i->second << endl;