changeset 74834c49fbbe in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=74834c49fbbe
description:
        config: Expose the DRAM ranks as a command-line option

        This patch gives the user direct influence over the number of DRAM
        ranks to make it easier to tune the memory density without affecting
        the bandwidth (previously the only means of scaling the device count
        was through the number of channels).

        The patch also adds some basic sanity checks to ensure that the number
        of ranks is a power of two (since we rely on bit slices in the address
        decoding).

diffstat:

 configs/common/MemConfig.py |  12 +++++++++---
 configs/common/Options.py   |   2 ++
 src/mem/dram_ctrl.cc        |   5 +++++
 3 files changed, 16 insertions(+), 3 deletions(-)

diffs (49 lines):

diff -r 6dd27a0e0d23 -r 74834c49fbbe configs/common/MemConfig.py
--- a/configs/common/MemConfig.py       Tue Dec 23 09:31:18 2014 -0500
+++ b/configs/common/MemConfig.py       Tue Dec 23 09:31:18 2014 -0500
@@ -197,9 +197,15 @@
     # address mapping in the case of a DRAM
     for r in system.mem_ranges:
         for i in xrange(nbr_mem_ctrls):
-            mem_ctrls.append(create_mem_ctrl(cls, r, i, nbr_mem_ctrls,
-                                             intlv_bits,
-                                             system.cache_line_size.value))
+            mem_ctrl = create_mem_ctrl(cls, r, i, nbr_mem_ctrls, intlv_bits,
+                                       system.cache_line_size.value)
+            # Set the number of ranks based on the command-line
+            # options if it was explicitly set
+            if issubclass(cls, m5.objects.DRAMCtrl) and \
+                    options.mem_ranks:
+                mem_ctrl.ranks_per_channel = options.mem_ranks
+
+            mem_ctrls.append(mem_ctrl)
 
     system.mem_ctrls = mem_ctrls
 
diff -r 6dd27a0e0d23 -r 74834c49fbbe configs/common/Options.py
--- a/configs/common/Options.py Tue Dec 23 09:31:18 2014 -0500
+++ b/configs/common/Options.py Tue Dec 23 09:31:18 2014 -0500
@@ -90,6 +90,8 @@
                       help = "type of memory to use")
     parser.add_option("--mem-channels", type="int", default=1,
                       help = "number of memory channels")
+    parser.add_option("--mem-ranks", type="int", default=None,
+                      help = "number of memory ranks per channel")
     parser.add_option("--mem-size", action="store", type="string",
                       default="512MB",
                       help="Specify the physical memory size (single memory)")
diff -r 6dd27a0e0d23 -r 74834c49fbbe src/mem/dram_ctrl.cc
--- a/src/mem/dram_ctrl.cc      Tue Dec 23 09:31:18 2014 -0500
+++ b/src/mem/dram_ctrl.cc      Tue Dec 23 09:31:18 2014 -0500
@@ -92,6 +92,11 @@
     busBusyUntil(0), prevArrival(0),
     nextReqTime(0), activeRank(0), timeStampOffset(0)
 {
+    // sanity check the ranks since we rely on bit slicing for the
+    // address decoding
+    fatal_if(!isPowerOf2(ranksPerChannel), "DRAM rank count of %d is not "
+             "allowed, must be a power of two\n", ranksPerChannel);
+
     for (int i = 0; i < ranksPerChannel; i++) {
         Rank* rank = new Rank(*this, p);
         ranks.push_back(rank);
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to