tests: Enable test running outside of gem5's source tree
[gem5.git] / tests / configs / arm_generic.py
index 1b0e8ee8b6e16dfbf05cb66cc347c767187525e9..04823973d96de40409e8ff086d9feeabb4ddae57 100644 (file)
@@ -43,6 +43,26 @@ m5.util.addToPath('../configs/common')
 import FSConfig
 from Caches import *
 from base_config import *
+from O3_ARM_v7a import *
+from Benchmarks import SysConfig
+
+class ArmSESystemUniprocessor(BaseSESystemUniprocessor):
+    """Syscall-emulation builder for ARM uniprocessor systems.
+
+    A small tweak of the syscall-emulation builder to use more
+    representative cache configurations.
+    """
+
+    def __init__(self, **kwargs):
+        BaseSESystem.__init__(self, **kwargs)
+
+    def create_caches_private(self, cpu):
+        # The atomic SE configurations do not use caches
+        if self.mem_mode == "timing":
+            # Use the more representative cache configuration
+            cpu.addTwoLevelCacheHierarchy(O3_ARM_v7a_ICache(),
+                                          O3_ARM_v7a_DCache(),
+                                          O3_ARM_v7aL2())
 
 class LinuxArmSystemBuilder(object):
     """Mix-in that implements create_system.
@@ -51,17 +71,21 @@ class LinuxArmSystemBuilder(object):
     ARM-specific create_system method to a class deriving from one of
     the generic base systems.
     """
-    def __init__(self, machine_type):
+    def __init__(self, machine_type, **kwargs):
         """
         Arguments:
           machine_type -- String describing the platform to simulate
+          num_cpus -- integer number of CPUs in the system
         """
         self.machine_type = machine_type
+        self.num_cpus = kwargs.get('num_cpus', 1)
+        self.mem_size = kwargs.get('mem_size', '256MB')
 
     def create_system(self):
+        sc = SysConfig(None, self.mem_size, None)
         system = FSConfig.makeArmSystem(self.mem_mode,
-                                        self.machine_type,
-                                        None, False)
+                                        self.machine_type, self.num_cpus,
+                                        sc, False)
 
         # We typically want the simulator to panic if the kernel
         # panics or oopses. This prevents the simulator from running
@@ -76,7 +100,7 @@ class LinuxArmFSSystem(LinuxArmSystemBuilder,
                        BaseFSSystem):
     """Basic ARM full system builder."""
 
-    def __init__(self, machine_type='RealView_PBX', **kwargs):
+    def __init__(self, machine_type='VExpress_EMM', **kwargs):
         """Initialize an ARM system that supports full system simulation.
 
         Note: Keyword arguments that are not listed below will be
@@ -86,7 +110,13 @@ class LinuxArmFSSystem(LinuxArmSystemBuilder,
           machine_type -- String describing the platform to simulate
         """
         BaseSystem.__init__(self, **kwargs)
-        LinuxArmSystemBuilder.__init__(self, machine_type)
+        LinuxArmSystemBuilder.__init__(self, machine_type, **kwargs)
+
+    def create_caches_private(self, cpu):
+        # Use the more representative cache configuration
+        cpu.addTwoLevelCacheHierarchy(O3_ARM_v7a_ICache(),
+                                      O3_ARM_v7a_DCache(),
+                                      O3_ARM_v7aL2())
 
 class LinuxArmFSSystemUniprocessor(LinuxArmSystemBuilder,
                                    BaseFSSystemUniprocessor):
@@ -97,14 +127,13 @@ class LinuxArmFSSystemUniprocessor(LinuxArmSystemBuilder,
     test cases.
     """
 
-    def __init__(self, machine_type='RealView_PBX', **kwargs):
+    def __init__(self, machine_type='VExpress_EMM', **kwargs):
         BaseFSSystemUniprocessor.__init__(self, **kwargs)
-        LinuxArmSystemBuilder.__init__(self, machine_type)
-
+        LinuxArmSystemBuilder.__init__(self, machine_type, **kwargs)
 
 class LinuxArmFSSwitcheroo(LinuxArmSystemBuilder, BaseFSSwitcheroo):
     """Uniprocessor ARM system prepared for CPU switching"""
 
-    def __init__(self, machine_type='RealView_PBX', **kwargs):
+    def __init__(self, machine_type='VExpress_EMM', **kwargs):
         BaseFSSwitcheroo.__init__(self, **kwargs)
-        LinuxArmSystemBuilder.__init__(self, machine_type)
+        LinuxArmSystemBuilder.__init__(self, machine_type, **kwargs)