arch-arm: Add arm demo board (#1478)
This demo board is a preset arm board, that can be used to run example gem5 simulations. This board doesnt simulate any known hardware. The board will be used to run benchmarks such as gapbs and npb to collect stats. The plan is to show these stats on the gem5 resources website to provide more details about the resources.
This commit is contained in:
92
configs/example/gem5_library/arm-demo-ubuntu-run.py
Normal file
92
configs/example/gem5_library/arm-demo-ubuntu-run.py
Normal file
@@ -0,0 +1,92 @@
|
||||
# Copyright (c) 2024 The Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met: redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer;
|
||||
# redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution;
|
||||
# neither the name of the copyright holders nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
"""
|
||||
This script further shows an example of booting an ARM based full system Ubuntu
|
||||
disk image. This simulation boots the disk image using the ArmDemoBoard.
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
```bash
|
||||
scons build/ARM/gem5.opt -j $(nproc)
|
||||
./build/ARM/gem5.opt configs/example/gem5_library/arm-demo-ubuntu-run.py
|
||||
```
|
||||
"""
|
||||
import argparse
|
||||
|
||||
from gem5.isas import ISA
|
||||
from gem5.prebuilt.demo.arm_demo_board import ArmDemoBoard
|
||||
from gem5.resources.resource import obtain_resource
|
||||
from gem5.simulate.exit_event import ExitEvent
|
||||
from gem5.simulate.simulator import Simulator
|
||||
from gem5.utils.requires import requires
|
||||
|
||||
# This runs a check to ensure the gem5 binary interpreting this file is compiled to include the ARM ISA.
|
||||
requires(isa_required=ISA.ARM)
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description="An example configuration script to run the ArmDemoBoard."
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--use-kvm",
|
||||
action="store_true",
|
||||
help="Use KVM cores instead of Timing.",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
board = ArmDemoBoard(use_kvm=args.use_kvm)
|
||||
|
||||
board.set_workload(
|
||||
obtain_resource(
|
||||
"arm-ubuntu-24.04-boot-with-systemd", resource_version="2.0.0"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def exit_event_handler():
|
||||
print("First exit: kernel booted")
|
||||
yield False # gem5 is now executing systemd startup
|
||||
print("Second exit: Started `after_boot.sh` script")
|
||||
# The after_boot.sh script is executed after the kernel and systemd have
|
||||
# booted.
|
||||
yield False # gem5 is now executing the `after_boot.sh` script
|
||||
print("Third exit: Finished `after_boot.sh` script")
|
||||
# The after_boot.sh script will run a script if it is passed via
|
||||
# m5 readfile. This is the last exit event before the simulation exits.
|
||||
yield True
|
||||
|
||||
|
||||
# We define the system with the aforementioned system defined.
|
||||
simulator = Simulator(
|
||||
board=board,
|
||||
on_exit_event={
|
||||
ExitEvent.EXIT: exit_event_handler(),
|
||||
},
|
||||
)
|
||||
|
||||
simulator.run()
|
||||
Reference in New Issue
Block a user