changeset e94c22bd9ef1 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=e94c22bd9ef1
description:
        config: Remove memory aliases and rely on class name

        Instead of maintaining two lists, rely entirely on the class
        name. There is really no point in causing unecessary confusion.

diffstat:

 configs/common/MemConfig.py |  46 +++-----------------------------------------
 configs/common/Options.py   |   2 +-
 configs/dram/sweep.py       |   2 +-
 3 files changed, 6 insertions(+), 44 deletions(-)

diffs (109 lines):

diff -r d1df075f3b71 -r e94c22bd9ef1 configs/common/MemConfig.py
--- a/configs/common/MemConfig.py       Wed Apr 15 16:04:37 2015 -0500
+++ b/configs/common/MemConfig.py       Mon Apr 20 12:46:29 2015 -0400
@@ -45,24 +45,6 @@
 # classes.
 _mem_classes = {}
 
-# Memory aliases. We make sure they exist before we add them to the
-# fina; list. A target may be specified as a tuple, in which case the
-# first available memory controller model in the tuple will be used.
-_mem_aliases_all = [
-    ("simple_mem", "SimpleMemory"),
-    ("ddr3_1600_x64", "DDR3_1600_x64"),
-    ("lpddr2_s4_1066_x32", "LPDDR2_S4_1066_x32"),
-    ("lpddr3_1600_x32", "LPDDR3_1600_x32"),
-    ("wio_200_x128", "WideIO_200_x128"),
-    ("dramsim2", "DRAMSim2"),
-    ("ruby_memory", "RubyMemoryControl")
-    ]
-
-# Filtered list of aliases. Only aliases for existing memory
-# controllers exist in this list.
-_mem_aliases = {}
-
-
 def is_mem_class(cls):
     """Determine if a class is a memory controller that can be instantiated"""
 
@@ -75,19 +57,17 @@
         return False
 
 def get(name):
-    """Get a memory class from a user provided class name or alias."""
-
-    real_name = _mem_aliases.get(name, name)
+    """Get a memory class from a user provided class name."""
 
     try:
-        mem_class = _mem_classes[real_name]
+        mem_class = _mem_classes[name]
         return mem_class
     except KeyError:
         print "%s is not a valid memory controller." % (name,)
         sys.exit(1)
 
 def print_mem_list():
-    """Print a list of available memory classes including their aliases."""
+    """Print a list of available memory classes."""
 
     print "Available memory classes:"
     doc_wrapper = TextWrapper(initial_indent="\t\t", subsequent_indent="\t\t")
@@ -101,32 +81,14 @@
             for line in doc_wrapper.wrap(doc):
                 print line
 
-    if _mem_aliases:
-        print "\nMemory aliases:"
-        for alias, target in _mem_aliases.items():
-            print "\t%s => %s" % (alias, target)
-
 def mem_names():
     """Return a list of valid memory names."""
-    return _mem_classes.keys() + _mem_aliases.keys()
+    return _mem_classes.keys()
 
 # Add all memory controllers in the object hierarchy.
 for name, cls in inspect.getmembers(m5.objects, is_mem_class):
     _mem_classes[name] = cls
 
-for alias, target in _mem_aliases_all:
-    if isinstance(target, tuple):
-        # Some aliases contain a list of memory controller models
-        # sorted in priority order. Use the first target that's
-        # available.
-        for t in target:
-            if t in _mem_classes:
-                _mem_aliases[alias] = t
-                break
-    elif target in _mem_classes:
-        # Normal alias
-        _mem_aliases[alias] = target
-
 def create_mem_ctrl(cls, r, i, nbr_mem_ctrls, intlv_bits, intlv_size):
     """
     Helper function for creating a single memoy controller from the given
diff -r d1df075f3b71 -r e94c22bd9ef1 configs/common/Options.py
--- a/configs/common/Options.py Wed Apr 15 16:04:37 2015 -0500
+++ b/configs/common/Options.py Mon Apr 20 12:46:29 2015 -0400
@@ -87,7 +87,7 @@
     parser.add_option("--list-mem-types",
                       action="callback", callback=_listMemTypes,
                       help="List available memory types")
-    parser.add_option("--mem-type", type="choice", default="ddr3_1600_x64",
+    parser.add_option("--mem-type", type="choice", default="DDR3_1600_x64",
                       choices=MemConfig.mem_names(),
                       help = "type of memory to use")
     parser.add_option("--mem-channels", type="int", default=1,
diff -r d1df075f3b71 -r e94c22bd9ef1 configs/dram/sweep.py
--- a/configs/dram/sweep.py     Wed Apr 15 16:04:37 2015 -0500
+++ b/configs/dram/sweep.py     Mon Apr 20 12:46:29 2015 -0400
@@ -54,7 +54,7 @@
 parser = optparse.OptionParser()
 
 # Use a single-channel DDR3-1600 x64 by default
-parser.add_option("--mem-type", type="choice", default="ddr3_1600_x64",
+parser.add_option("--mem-type", type="choice", default="DDR3_1600_x64",
                   choices=MemConfig.mem_names(),
                   help = "type of memory to use")
 
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to