Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/48963 )
Change subject: scons: Simplify the CpuModel class into a function.
......................................................................
scons: Simplify the CpuModel class into a function.
The CpuModel class looks like it was originally intended to hold a lot
more information that it does now, which is just the name of a CPU, and
whether it should be enabled by default. All the built in configs in
build_opts already explicitly list a set of CPUs, and CPUs should not,
generally speaking, be enabled by default, since they almost always need
to be specifically supported by an ISA. This is mutual, since usually
ISAs definitions are not quite correct or complete, and this is often
exposed by plugging them into different, and/or more complex CPU models
which stress those short comings.
This change drops the idea of a "default" CPU, and since the only thing
being tracked at this point is a list of CPUs, it turns CpuModel() into
a simple function which adds a name to a set of supported CPUs.
Change-Id: Id7475d5dc8548802b5253f79839da8c76ef4d165
---
M src/cpu/SConsopts
M src/cpu/minor/SConsopts
M src/cpu/o3/SConsopts
M src/cpu/simple/SConsopts
4 files changed, 8 insertions(+), 25 deletions(-)
diff --git a/src/cpu/SConsopts b/src/cpu/SConsopts
index 6a182f1..2dec0d5 100644
--- a/src/cpu/SConsopts
+++ b/src/cpu/SConsopts
@@ -25,29 +25,12 @@
Import('*')
-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 = {}
-
- # Constructor. Automatically adds models to CpuModel.dict.
- def __init__(self, name, default=False):
- self.name = name # name of model
-
- # 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
+all_cpus = set()
+def CpuModel(name):
+ all_cpus.add(name)
Export('CpuModel')
def add_cpu_models_var():
- sticky_vars.Add(ListVariable('CPU_MODELS', 'CPU models',
- sorted(n for n,m in CpuModel.dict.items() if m.default),
- sorted(CpuModel.dict.keys())))
+ sticky_vars.Add(ListVariable('CPU_MODELS', 'CPU models', [], all_cpus))
AfterSConsopts(add_cpu_models_var)
diff --git a/src/cpu/minor/SConsopts b/src/cpu/minor/SConsopts
index 1038bfa..9169ee9 100644
--- a/src/cpu/minor/SConsopts
+++ b/src/cpu/minor/SConsopts
@@ -37,4 +37,4 @@
Import('*')
-CpuModel('MinorCPU', default=True)
+CpuModel('MinorCPU')
diff --git a/src/cpu/o3/SConsopts b/src/cpu/o3/SConsopts
index 49ab3bb..0c0c56c 100644
--- a/src/cpu/o3/SConsopts
+++ b/src/cpu/o3/SConsopts
@@ -28,4 +28,4 @@
Import('*')
-CpuModel('O3CPU', default=True)
+CpuModel('O3CPU')
diff --git a/src/cpu/simple/SConsopts b/src/cpu/simple/SConsopts
index 2f3b2ed..5ebdf30 100644
--- a/src/cpu/simple/SConsopts
+++ b/src/cpu/simple/SConsopts
@@ -28,5 +28,5 @@
Import('*')
-CpuModel('AtomicSimpleCPU', default=True)
-CpuModel('TimingSimpleCPU', default=True)
+CpuModel('AtomicSimpleCPU')
+CpuModel('TimingSimpleCPU')
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/48963
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Id7475d5dc8548802b5253f79839da8c76ef4d165
Gerrit-Change-Number: 48963
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s