summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2015-04-20 12:46:29 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2015-04-20 12:46:29 -0400
commit076ea249ae47b935bea424954174f33fdecb7fcc (patch)
treef57b66ec35776515b82bc5f640780f3c0c3e5031
parent803e75cb079f981392bb75feae05dfa343013446 (diff)
downloadgem5-076ea249ae47b935bea424954174f33fdecb7fcc.tar.xz
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.
-rw-r--r--configs/common/MemConfig.py46
-rw-r--r--configs/common/Options.py2
-rw-r--r--configs/dram/sweep.py2
3 files changed, 6 insertions, 44 deletions
diff --git a/configs/common/MemConfig.py b/configs/common/MemConfig.py
index 5266667ec..cf0fb1632 100644
--- a/configs/common/MemConfig.py
+++ b/configs/common/MemConfig.py
@@ -45,24 +45,6 @@ from textwrap import TextWrapper
# 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 @@ def is_mem_class(cls):
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 @@ def print_mem_list():
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 --git a/configs/common/Options.py b/configs/common/Options.py
index a383b40ca..45292b249 100644
--- a/configs/common/Options.py
+++ b/configs/common/Options.py
@@ -87,7 +87,7 @@ def addCommonOptions(parser):
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 --git a/configs/dram/sweep.py b/configs/dram/sweep.py
index 01896da0f..06f3dc76d 100644
--- a/configs/dram/sweep.py
+++ b/configs/dram/sweep.py
@@ -54,7 +54,7 @@ import MemConfig
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")