Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/2862
Change subject: config: cpu: Don't rely on hardcoded lists of info in
CpuConfig.py.
......................................................................
config: cpu: Don't rely on hardcoded lists of info in CpuConfig.py.
All of the information that's needed can now be collected dynamically from
the
SimObjects that are compiled in. If a CPU model is defined in the config
post
build and doesn't end up in m5.objects, then the person defining it knows
about
it enough to explicitly included it in the config without having to look it
up
based on a nickname or list of class names. It's also not "official" enough
to
be universally advertised by generic scripts like config/example/fs.py.
Change-Id: I0cd71c71401892b7d4d7091530c0196274f1baeb
---
M configs/common/CpuConfig.py
1 file changed, 6 insertions(+), 37 deletions(-)
diff --git a/configs/common/CpuConfig.py b/configs/common/CpuConfig.py
index 757ec2d..e19a2bd 100644
--- a/configs/common/CpuConfig.py
+++ b/configs/common/CpuConfig.py
@@ -42,25 +42,9 @@
# Dictionary of mapping names of real CPU models to classes.
_cpu_classes = {}
-
-# CPU aliases. The CPUs listed here might not be compiled, we make
-# sure they exist before we add them to the CPU list. A target may be
-# specified as a tuple, in which case the first available CPU model in
-# the tuple will be used as the target.
-_cpu_aliases_all = [
- ("timing", "TimingSimpleCPU"),
- ("atomic", "AtomicSimpleCPU"),
- ("minor", "MinorCPU"),
- ("detailed", "DerivO3CPU"),
- ("kvm", ("ArmKvmCPU", "ArmV8KvmCPU", "X86KvmCPU")),
- ("trace", "TraceCPU"),
- ]
-
-# Filtered list of aliases. Only aliases for existing CPUs exist in
-# this list.
+# Dictionary of CPU nicknames to their real CPU class names.
_cpu_aliases = {}
-
def is_cpu_class(cls):
"""Determine if a class is a CPU that can be instantiated"""
@@ -133,26 +117,11 @@
fatal("%s does not support data dependency tracing. Use a CPU
model of"
" type or inherited from DerivO3CPU.", cpu_cls)
-# The ARM detailed CPU is special in the sense that it doesn't exist
-# in the normal object hierarchy, so we have to add it manually.
-try:
- from O3_ARM_v7a import O3_ARM_v7a_3
- _cpu_classes["arm_detailed"] = O3_ARM_v7a_3
-except:
- pass
-
# Add all CPUs in the object hierarchy.
for name, cls in inspect.getmembers(m5.objects, is_cpu_class):
_cpu_classes[name] = cls
-
-for alias, target in _cpu_aliases_all:
- if isinstance(target, tuple):
- # Some aliases contain a list of CPU model sorted in priority
- # order. Use the first target that's available.
- for t in target:
- if t in _cpu_classes:
- _cpu_aliases[alias] = t
- break
- elif target in _cpu_classes:
- # Normal alias
- _cpu_aliases[alias] = target
+ nickname = cls.nickname()
+ if nickname:
+ if nickname in _cpu_aliases:
+ fatal("Multiple CPUs have the nickname '%s'." % (nickname,))
+ _cpu_aliases[nickname] = name
--
To view, visit https://gem5-review.googlesource.com/2862
To unsubscribe, visit https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0cd71c71401892b7d4d7091530c0196274f1baeb
Gerrit-Change-Number: 2862
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev