summaryrefslogtreecommitdiff
path: root/src/mem/bus.cc
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2013-01-07 13:05:38 -0500
committerAndreas Hansson <andreas.hansson@arm.com>2013-01-07 13:05:38 -0500
commit71da1d21578b6f9cf5b43bd4648f313326849533 (patch)
tree639972c7c05b28380952bc655b4dd170d888599d /src/mem/bus.cc
parentcfdaf53104625a04d504972c76545bf869c6a476 (diff)
downloadgem5-71da1d21578b6f9cf5b43bd4648f313326849533.tar.xz
base: Encapsulate the underlying fields in AddrRange
This patch makes the start and end address private in a move to prevent direct manipulation and matching of ranges based on these fields. This is done so that a transition to ranges with interleaving support is possible. As a result of hiding the start and end, a number of member functions are needed to perform the comparisons and manipulations that previously took place directly on the members. An accessor function is provided for the start address, and a function is added to test if an address is within a range. As a result of the latter the != and == operator is also removed in favour of the member function. A member function that returns a string representation is also created to allow debug printing. In general, this patch does not add any functionality, but it does take us closer to a situation where interleaving (and more cleverness) can be added under the bonnet without exposing it to the user. More on that in a later patch.
Diffstat (limited to 'src/mem/bus.cc')
-rw-r--r--src/mem/bus.cc20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/mem/bus.cc b/src/mem/bus.cc
index ddbdcb136..e8a7084b0 100644
--- a/src/mem/bus.cc
+++ b/src/mem/bus.cc
@@ -357,7 +357,7 @@ BaseBus::findPort(Addr addr)
// Check if this matches the default range
if (useDefaultRange) {
- if (defaultRange == addr) {
+ if (defaultRange.contains(addr)) {
DPRINTF(BusAddrRanges, " found addr %#llx on default\n",
addr);
return defaultPortID;
@@ -430,8 +430,8 @@ BaseBus::recvRangeChange(PortID master_port_id)
AddrRangeList ranges = masterPorts[master_port_id]->getAddrRanges();
for (AddrRangeConstIter r = ranges.begin(); r != ranges.end(); ++r) {
- DPRINTF(BusAddrRanges, "Adding range %#llx : %#llx for id %d\n",
- r->start, r->end, master_port_id);
+ DPRINTF(BusAddrRanges, "Adding range %s for id %d\n",
+ r->to_string(), master_port_id);
if (portMap.insert(*r, master_port_id) == portMap.end()) {
PortID conflict_id = portMap.find(*r)->second;
fatal("%s has two ports with same range:\n\t%s\n\t%s\n",
@@ -466,9 +466,9 @@ BaseBus::recvRangeChange(PortID master_port_id)
// overlapping the default range
if (r->intersects(defaultRange) &&
!r->isSubset(defaultRange))
- fatal("Range %#llx : %#llx intersects the " \
+ fatal("Range %s intersects the " \
"default range of %s but is not a " \
- "subset\n", r->start, r->end, name());
+ "subset\n", r->to_string(), name());
}
}
}
@@ -497,18 +497,16 @@ BaseBus::getAddrRanges() const
// start out with the default range
AddrRangeList ranges;
ranges.push_back(defaultRange);
- DPRINTF(BusAddrRanges, " -- %#llx : %#llx DEFAULT\n",
- defaultRange.start, defaultRange.end);
+ DPRINTF(BusAddrRanges, " -- %s DEFAULT\n", defaultRange.to_string());
// add any range that is not a subset of the default range
for (PortMapConstIter p = portMap.begin(); p != portMap.end(); ++p) {
if (useDefaultRange && p->first.isSubset(defaultRange)) {
- DPRINTF(BusAddrRanges, " -- %#llx : %#llx is a SUBSET\n",
- p->first.start, p->first.end);
+ DPRINTF(BusAddrRanges, " -- %s is a SUBSET\n",
+ p->first.to_string());
} else {
ranges.push_back(p->first);
- DPRINTF(BusAddrRanges, " -- %#llx : %#llx\n",
- p->first.start, p->first.end);
+ DPRINTF(BusAddrRanges, " -- %s\n", p->first.to_string());
}
}