changeset 0937a00d3f68 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=0937a00d3f68
description:
        mem: Merge ranges that are part of the conf table

        This patch adds basic merging of address ranges when determining which
        address ranges should be reported in the configuration table. By
        performing this merging it is possible to distribute an address range
        across many memory channels (controllers). This is essential to enable
        address interleaving.

diffstat:

 src/mem/physical.cc |  29 +++++++++++++++++++++++++----
 src/mem/physical.hh |   4 +++-
 2 files changed, 28 insertions(+), 5 deletions(-)

diffs (56 lines):

diff -r 190fd0e285f6 -r 0937a00d3f68 src/mem/physical.cc
--- a/src/mem/physical.cc       Mon Jan 07 13:05:38 2013 -0500
+++ b/src/mem/physical.cc       Mon Jan 07 13:05:38 2013 -0500
@@ -203,13 +203,34 @@
     // this could be done once in the constructor, but since it is unlikely to
     // be called more than once the iteration should not be a problem
     AddrRangeList ranges;
-    for (vector<AbstractMemory*>::const_iterator m = memories.begin();
-         m != memories.end(); ++m) {
-        if ((*m)->isConfReported()) {
-            ranges.push_back((*m)->getAddrRange());
+    vector<AddrRange> intlv_ranges;
+    for (AddrRangeMap<AbstractMemory*>::const_iterator r = addrMap.begin();
+         r != addrMap.end(); ++r) {
+        if (r->second->isConfReported()) {
+            // if the range is interleaved then save it for now
+            if (r->first.interleaved()) {
+                // if we already got interleaved ranges that are not
+                // part of the same range, then first do a merge
+                // before we add the new one
+                if (!intlv_ranges.empty() &&
+                    !intlv_ranges.back().mergesWith(r->first)) {
+                    ranges.push_back(AddrRange(intlv_ranges));
+                    intlv_ranges.clear();
+                }
+                intlv_ranges.push_back(r->first);
+            } else {
+                // keep the current range
+                ranges.push_back(r->first);
+            }
         }
     }
 
+    // if there is still interleaved ranges waiting to be merged,
+    // go ahead and do it
+    if (!intlv_ranges.empty()) {
+        ranges.push_back(AddrRange(intlv_ranges));
+    }
+
     return ranges;
 }
 
diff -r 190fd0e285f6 -r 0937a00d3f68 src/mem/physical.hh
--- a/src/mem/physical.hh       Mon Jan 07 13:05:38 2013 -0500
+++ b/src/mem/physical.hh       Mon Jan 07 13:05:38 2013 -0500
@@ -135,7 +135,9 @@
 
     /**
      * Get the memory ranges for all memories that are to be reported
-     * to the configuration table.
+     * to the configuration table. The ranges are merged before they
+     * are returned such that any interleaved ranges appear as a
+     * single range.
      *
      * @return All configuration table memory ranges
      */
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to