diff --git a/configs/example/arm/baremetal.py b/configs/example/arm/baremetal.py index 0072c1d629..4af1ff17c9 100644 --- a/configs/example/arm/baremetal.py +++ b/configs/example/arm/baremetal.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016-2017,2019-2021 ARM Limited +# Copyright (c) 2016-2017,2019-2022 Arm Limited # All rights reserved. # # The license below extends only to copyright in the software and shall @@ -123,7 +123,13 @@ def create(args): # Add CPU clusters to the system system.cpu_cluster = [ devices.ArmCpuCluster( - system, args.num_cores, args.cpu_freq, "1.0V", *cpu_types[args.cpu] + system, + args.num_cores, + args.cpu_freq, + "1.0V", + *cpu_types[args.cpu], + tarmac_gen=args.tarmac_gen, + tarmac_dest=args.tarmac_dest, ) ] @@ -230,6 +236,17 @@ def main(): ) parser.add_argument("--checkpoint", action="store_true") parser.add_argument("--restore", type=str, default=None) + parser.add_argument( + "--tarmac-gen", + action="store_true", + help="Write a Tarmac trace.", + ) + parser.add_argument( + "--tarmac-dest", + choices=TarmacDump.vals, + default="stdoutput", + help="Destination for the Tarmac trace output. [Default: stdoutput]", + ) parser.add_argument( "--dtb-gen", action="store_true", diff --git a/configs/example/arm/devices.py b/configs/example/arm/devices.py index 3f005a49aa..02574d2802 100644 --- a/configs/example/arm/devices.py +++ b/configs/example/arm/devices.py @@ -106,6 +106,8 @@ class ArmCpuCluster(CpuCluster): l1i_type, l1d_type, l2_type, + tarmac_gen=False, + tarmac_dest=None, ): super().__init__() self._cpu_type = cpu_type @@ -122,6 +124,12 @@ class ArmCpuCluster(CpuCluster): self.generate_cpus(cpu_type, num_cpus) + for cpu in self.cpus: + if tarmac_gen: + cpu.tracer = TarmacTracer() + if tarmac_dest is not None: + cpu.tracer.outfile = tarmac_dest + system.addCpuCluster(self) def addL1(self): @@ -177,23 +185,54 @@ class ArmCpuCluster(CpuCluster): class AtomicCluster(ArmCpuCluster): - def __init__(self, system, num_cpus, cpu_clock, cpu_voltage="1.0V"): - cpu_config = [ - ObjectList.cpu_list.get("AtomicSimpleCPU"), - None, - None, - None, - ] - super().__init__(system, num_cpus, cpu_clock, cpu_voltage, *cpu_config) + def __init__( + self, + system, + num_cpus, + cpu_clock, + cpu_voltage="1.0V", + tarmac_gen=False, + tarmac_dest=None, + ): + super().__init__( + system, + num_cpus, + cpu_clock, + cpu_voltage, + cpu_type=ObjectList.cpu_list.get("AtomicSimpleCPU"), + l1i_type=None, + l1d_type=None, + l2_type=None, + tarmac_gen=tarmac_gen, + tarmac_dest=tarmac_dest, + ) def addL1(self): pass class KvmCluster(ArmCpuCluster): - def __init__(self, system, num_cpus, cpu_clock, cpu_voltage="1.0V"): - cpu_config = [ObjectList.cpu_list.get("ArmV8KvmCPU"), None, None, None] - super().__init__(system, num_cpus, cpu_clock, cpu_voltage, *cpu_config) + def __init__( + self, + system, + num_cpus, + cpu_clock, + cpu_voltage="1.0V", + tarmac_gen=False, + tarmac_dest=None, + ): + super().__init__( + system, + num_cpus, + cpu_clock, + cpu_voltage, + cpu_type=ObjectList.cpu_list.get("ArmV8KvmCPU"), + l1i_type=None, + l1d_type=None, + l2_type=None, + tarmac_gen=tarmac_gen, + tarmac_dest=tarmac_dest, + ) def addL1(self): pass diff --git a/configs/example/arm/starter_fs.py b/configs/example/arm/starter_fs.py index 48cbbdb3e6..cc5f63f554 100644 --- a/configs/example/arm/starter_fs.py +++ b/configs/example/arm/starter_fs.py @@ -129,7 +129,13 @@ def create(args): # Add CPU clusters to the system system.cpu_cluster = [ devices.ArmCpuCluster( - system, args.num_cores, args.cpu_freq, "1.0V", *cpu_types[args.cpu] + system, + args.num_cores, + args.cpu_freq, + "1.0V", + *cpu_types[args.cpu], + tarmac_gen=args.tarmac_gen, + tarmac_dest=args.tarmac_dest, ) ] @@ -257,6 +263,17 @@ def main(): default="2GB", help="Specify the physical memory size", ) + parser.add_argument( + "--tarmac-gen", + action="store_true", + help="Write a Tarmac trace.", + ) + parser.add_argument( + "--tarmac-dest", + choices=TarmacDump.vals, + default="stdoutput", + help="Destination for the Tarmac trace output. [Default: stdoutput]", + ) parser.add_argument("--checkpoint", action="store_true") parser.add_argument("--restore", type=str, default=None) diff --git a/configs/example/arm/starter_se.py b/configs/example/arm/starter_se.py index 6b4dce9d64..33514c7b78 100644 --- a/configs/example/arm/starter_se.py +++ b/configs/example/arm/starter_se.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016-2017, 2023 ARM Limited +# Copyright (c) 2016-2017, 2022-2023 Arm Limited # All rights reserved. # # The license below extends only to copyright in the software and shall @@ -96,7 +96,13 @@ class SimpleSeSystem(System): # Add CPUs to the system. A cluster of CPUs typically have # private L1 caches and a shared L2 cache. self.cpu_cluster = devices.ArmCpuCluster( - self, args.num_cores, args.cpu_freq, "1.2V", *cpu_types[args.cpu] + self, + args.num_cores, + args.cpu_freq, + "1.2V", + *cpu_types[args.cpu], + tarmac_gen=args.tarmac_gen, + tarmac_dest=args.tarmac_dest, ) # Create a cache hierarchy (unless we are simulating a @@ -215,6 +221,17 @@ def main(): default="2GB", help="Specify the physical memory size", ) + parser.add_argument( + "--tarmac-gen", + action="store_true", + help="Write a Tarmac trace.", + ) + parser.add_argument( + "--tarmac-dest", + choices=TarmacDump.vals, + default="stdoutput", + help="Destination for the Tarmac trace output. [Default: stdoutput]", + ) args = parser.parse_args()