Bobby R. Bruce has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/49553 )


20 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
Change subject: configs,python: Update simple_binary_run.py for testing
......................................................................

configs,python: Update simple_binary_run.py for testing

This allows us to test the running of bare-metal binaries on gem5. The
current design assumes the binaries to run are part of gem5 Resources.

Change-Id: I4f0f40a4628fd5f5951d89079824369a219d6e91
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49553
Tested-by: kokoro <[email protected]>
Reviewed-by: Jason Lowe-Power <[email protected]>
Maintainer: Jason Lowe-Power <[email protected]>
---
M configs/example/components-library/simple_binary_run.py
1 file changed, 56 insertions(+), 30 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass




diff --git a/configs/example/components-library/simple_binary_run.py b/configs/example/components-library/simple_binary_run.py
index 2906429..e886cb7 100644
--- a/configs/example/components-library/simple_binary_run.py
+++ b/configs/example/components-library/simple_binary_run.py
@@ -25,10 +25,9 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 """
-A run script for a very simple Syscall-Execution running a hello world program.
-The system has no cache heirarchy.
-
-This is as simple a setup as gem5 will allow.
+A run script for a very simple Syscall-Execution running simple binaries.
+The system has no cache heirarchy and is as "bare-bones" as you can get in
+gem5 while still being functinal.
 """

 import m5
@@ -48,27 +47,66 @@
     )
 )

-from components_library.resources.resource import CustomResource
+from components_library.resources.resource import Resource
 from components_library.boards.simple_board import SimpleBoard
 from components_library.cachehierarchies.classic.no_cache import NoCache
 from components_library.memory.single_channel import SingleChannelDDR3_1600
 from components_library.processors.simple_processor import SimpleProcessor
 from components_library.processors.cpu_types import CPUTypes
-from components_library.runtime import (
-    get_runtime_coherence_protocol,
-    get_runtime_isa,
-)
-from components_library.utils.requires import requires
-from components_library.isas import ISA

-requires(isa_required=ISA.X86)
+import argparse
+
+parser = argparse.ArgumentParser(
+    description="A script to run the gem5 boot test. This test boots the "
+    "linux kernel."
+)
+
+parser.add_argument(
+    "resource",
+    type=str,
+    help="The gem5 resource binary to run.",
+)
+
+parser.add_argument(
+    "cpu",
+    type=str,
+    choices=("kvm", "timing", "atomic", "o3"),
+    help="The CPU type used.",
+)
+
+parser.add_argument(
+    "-r",
+    "--resource-directory",
+    type=str,
+    required=False,
+    help="The directory in which resources will be downloaded or exist.",
+)
+
+parser.add_argument(
+    "-o",
+    "--override-download",
+    action="store_true",
+    help="Override a local resource if the hashes do not match.",
+)
+
+args = parser.parse_args()
+
+def input_to_cputype(input: str) -> CPUTypes:
+    if input == "kvm":
+        return CPUTypes.KVM
+    elif input == "timing":
+        return CPUTypes.TIMING
+    elif input == "atomic":
+        return CPUTypes.ATOMIC
+    elif input == "o3":
+        return CPUTypes.O3
+    else:
+        raise NotADirectoryError("Unknown CPU type '{}'.".format(input))

 # Setup the system.
 cache_hierarchy = NoCache()
-
 memory = SingleChannelDDR3_1600()
-
-processor = SimpleProcessor(cpu_type=CPUTypes.ATOMIC, num_cores=1)
+processor = SimpleProcessor(cpu_type=input_to_cputype(args.cpu), num_cores=1)

 motherboard = SimpleBoard(
     clk_freq="3GHz",
@@ -80,23 +118,11 @@
 motherboard.connect_things()

 # Set the workload
-thispath = os.path.dirname(os.path.realpath(__file__))
-binary = CustomResource(
-    os.path.join(
-        thispath,
-        "../../../tests/test-progs/hello/bin/x86/linux/hello",
-    )
-)
+binary = Resource(args.resource,
+        resource_directory=args.resource_directory,
+        override=args.override_download)
 motherboard.set_workload(binary)

-
-# Run the simulation.
-print("Running with ISA: {}.".format(get_runtime_isa().name))
-print(
- "Running with protocol: {}.".format(get_runtime_coherence_protocol().name)
-)
-print()
-
 root = Root(full_system=False, system=motherboard)

 if args.cpu == "kvm":

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/49553
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I4f0f40a4628fd5f5951d89079824369a219d6e91
Gerrit-Change-Number: 49553
Gerrit-PatchSet: 26
Gerrit-Owner: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to