base,tests: Expanded GTests for addr_range.hh

These tests assume the "end address" is not included in the range. This
exposed some bugs in addr_range.hh which have been fixed. Where
appropriate code comments in addr_range.hh have been extended to improve
understanding of the class's behavior.

Hard-coded AddrRange values in the project have been updated to take
into account that end address is now exclusive. The python params.py
interface has been updated to conform to this new standard.

Change-Id: Idd1e75d5771d198c4b8142b28de0f3a6e9007a52
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22427
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Brandon Potter
2019-10-18 14:43:14 -04:00
committed by Bobby R. Bruce
parent 1c4d64fb10
commit b4c9996d89
9 changed files with 1026 additions and 227 deletions

View File

@@ -768,7 +768,7 @@ class AddrRange(ParamValue):
if 'end' in kwargs:
self.end = Addr(kwargs.pop('end'))
elif 'size' in kwargs:
self.end = self.start + Addr(kwargs.pop('size')) - 1
self.end = self.start + Addr(kwargs.pop('size'))
else:
raise TypeError("Either end or size must be specified")
@@ -810,7 +810,7 @@ class AddrRange(ParamValue):
self.end = Addr(args[0][1])
else:
self.start = Addr(0)
self.end = Addr(args[0]) - 1
self.end = Addr(args[0])
elif len(args) == 2:
self.start = Addr(args[0])
@@ -830,7 +830,7 @@ class AddrRange(ParamValue):
def size(self):
# Divide the size by the size of the interleaving slice
return (long(self.end) - long(self.start) + 1) >> self.intlvBits
return (long(self.end) - long(self.start)) >> self.intlvBits
@classmethod
def cxx_predecls(cls, code):