From 683f411dcab4bb2275902f79f32eeee7c2e0b00a Mon Sep 17 00:00:00 2001 From: Nikos Nikoleris Date: Wed, 18 Apr 2018 11:56:08 +0100 Subject: 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 Maintainer: Nikos Nikoleris --- src/unittest/rangemaptest.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/unittest') 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; -- cgit v1.2.3