summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2010-02-26 18:14:48 -0800
committerNathan Binkert <nate@binkert.org>2010-02-26 18:14:48 -0800
commitf0b4259e98773bee04cd0af5dda7bcfba5032589 (patch)
tree6507a2f53b7e645d7ab30fd43384afa4b6b98b48 /SConstruct
parentac106767c86e58af623c81ed04521ea40ad7b8a9 (diff)
downloadgem5-f0b4259e98773bee04cd0af5dda7bcfba5032589.tar.xz
cpu_models: get rid of cpu_models.py and move the stuff into SCons
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct38
1 files changed, 31 insertions, 7 deletions
diff --git a/SConstruct b/SConstruct
index 6ca3d6a14..55cf71876 100644
--- a/SConstruct
+++ b/SConstruct
@@ -612,10 +612,34 @@ main = conf.Finish()
all_isa_list = [ ]
Export('all_isa_list')
-# Define the universe of supported CPU models
-all_cpu_list = [ ]
-default_cpus = [ ]
-Export('all_cpu_list', 'default_cpus')
+class CpuModel(object):
+ '''The CpuModel class encapsulates everything the ISA parser needs to
+ know about a particular CPU model.'''
+
+ # Dict of available CPU model objects. Accessible as CpuModel.dict.
+ dict = {}
+ list = []
+ defaults = []
+
+ # Constructor. Automatically adds models to CpuModel.dict.
+ def __init__(self, name, filename, includes, strings, default=False):
+ self.name = name # name of model
+ self.filename = filename # filename for output exec code
+ self.includes = includes # include files needed in exec file
+ # The 'strings' dict holds all the per-CPU symbols we can
+ # substitute into templates etc.
+ self.strings = strings
+
+ # This cpu is enabled by default
+ self.default = default
+
+ # Add self to dict
+ if name in CpuModel.dict:
+ raise AttributeError, "CpuModel '%s' already registered" % name
+ CpuModel.dict[name] = self
+ CpuModel.list.append(name)
+
+Export('CpuModel')
# Sticky variables get saved in the variables file so they persist from
# one invocation to the next (unless overridden, in which case the new
@@ -640,13 +664,13 @@ for bdir in [ base_dir ] + extras_dir_list:
SConscript(joinpath(root, 'SConsopts'))
all_isa_list.sort()
-all_cpu_list.sort()
-default_cpus.sort()
sticky_vars.AddVariables(
EnumVariable('TARGET_ISA', 'Target ISA', 'alpha', all_isa_list),
BoolVariable('FULL_SYSTEM', 'Full-system support', False),
- ListVariable('CPU_MODELS', 'CPU models', default_cpus, all_cpu_list),
+ ListVariable('CPU_MODELS', 'CPU models',
+ sorted(n for n,m in CpuModel.dict.iteritems() if m.default),
+ sorted(CpuModel.list)),
BoolVariable('NO_FAST_ALLOC', 'Disable fast object allocator', False),
BoolVariable('FAST_ALLOC_DEBUG', 'Enable fast object allocator debugging',
False),