
The X86Board’s set_kernel_disk_workload function requires a kernel and disk_image to be set.īoth these are obtainable from the gem5 resources repository. set_kernel_disk_workload ( kernel = Resource ( "x86-linux-kernel-5.4.49" ,), disk_image = Resource ( "x86-ubuntu-18.04-img" ), readfile_contents = command, ) + "echo 'This is running on Timing CPU cores.' " \ Next we add these components to the board: With this processor a user can call processor.switch() to switch to and from the starting cores and the switch cores, which we will demonstrate later on in this tutorial. The final parameter, num_cores, specifies the number of cores within the processor. In this case we’ll be switching from KVM cores to a TIMING cores. The switch_core_type parameter specifies which CPU type to switch to in a simulation. You must change this to another CPU type, such as CPUTypes.ATOMIC) (Note: If your host system does not support KVM, this simulation will not run. The starting_core_type parameter specifies which CPU type to start a simulation with. This processor can be used for simulations in which a user wants to switch out one type of core for another during a simulation. Here we are utilizing the gem5 standard library’s special SimpleSwitchableProcessor. Processor = SimpleSwitchableProcessor ( starting_core_type = CPUTypes. Here, we will demonstrate how simple this task can be with using the gem5 standard library.Īs we focus on X86, we must must build the gem5 X86 binary: Without using the gem5 library this would take several hundred lines of Python, forcing the user to specify details such as every IO component and exactly how the cache hierarchy is setup. This system will utilize gem5’s ability to switch cores, allowing booting of the operating system in KVM fast-forward mode and switching to a detailed CPU model to run the benchmark, and use a MESI Two Level Ruby cache hierarchy in a dual-core setup. In this tutorial we will build an X86 simulation, capable of running a full-system simulation, booting an Ubuntu operating system, and running a benchmark. The overarching philosophy is to make the common case simple.

While this takes away some flexibility, it massively simplifies simulating typical hardware setups in gem5. This is done by making sensible assumptions about the nature of the system to simulate and connecting components in a manner which “makes sense.”


One of the key ideas behind the gem5 standard library is to allow users to simulate, big, complex systems, with minimal effort. Building an x86 full-system simulation with the gem5 standard library
