summaryrefslogtreecommitdiff
path: root/configs
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2017-07-04 11:12:24 +0100
committerAndreas Sandberg <andreas.sandberg@arm.com>2017-07-28 12:55:41 +0000
commitdcb9334b94d14ccdc4ce42e1082e53d6d600e570 (patch)
tree5bef3ac628f6603ac1e7ead6cdc498f1fcb440fd /configs
parent662d2cde83d3ea10b3d189d0bcb6a1ef5a4349c1 (diff)
downloadgem5-dcb9334b94d14ccdc4ce42e1082e53d6d600e570.tar.xz
config: Discover CPU timing models based on target ISA
The CpuConfig helper currently assumes that all timing models live in the cores.arm package. This ignores the potential mismatch between the target ISA and the ISA assumptions made by the timing models. Instead of unconditionally listing all CPU models in cores.arm, list timing models from cores.generic and cores.${TARGET_ISA}. This ensures that the listed timing models support the ISA that gem5 is targeting. Change-Id: If6235af2118889638f56ac4151003f38edfe9485 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/3947 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'configs')
-rw-r--r--configs/common/CpuConfig.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/configs/common/CpuConfig.py b/configs/common/CpuConfig.py
index 731ba4f26..327c4318d 100644
--- a/configs/common/CpuConfig.py
+++ b/configs/common/CpuConfig.py
@@ -114,7 +114,16 @@ def config_etrace(cpu_cls, cpu_list, options):
for name, cls in inspect.getmembers(m5.objects, is_cpu_class):
_cpu_classes[name] = cls
-import cores.arm
-for mod_name, module in inspect.getmembers(cores.arm, inspect.ismodule):
- for name, cls in inspect.getmembers(module, is_cpu_class):
- _cpu_classes[name] = cls
+
+from m5.defines import buildEnv
+from importlib import import_module
+for package in [ "generic", buildEnv['TARGET_ISA']]:
+ try:
+ package = import_module(".cores." + package, package=__package__)
+ except ImportError:
+ # No timing models for this ISA
+ continue
+
+ for mod_name, module in inspect.getmembers(package, inspect.ismodule):
+ for name, cls in inspect.getmembers(module, is_cpu_class):
+ _cpu_classes[name] = cls