From 55e6dd67fd2d9b090ca97a21f2bb465efcf4382c Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Tue, 13 Feb 2024 17:20:41 -0800 Subject: [PATCH 1/3] Add BINARY_ARGS to run-binary targets --- common.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common.mk b/common.mk index 26b488f57f..a2c0104611 100644 --- a/common.mk +++ b/common.mk @@ -371,14 +371,14 @@ run-binary: check-binary $(BINARY).run run-binaries: check-binaries $(addsuffix .run,$(BINARIES)) %.run: %.check-exists $(SIM_PREREQ) | $(output_dir) - (set -o pipefail && $(NUMA_PREFIX) $(sim) $(PERMISSIVE_ON) $(call get_common_sim_flags,$*) $(VERBOSE_FLAGS) $(PERMISSIVE_OFF) $* >(spike-dasm > $(call get_sim_out_name,$*).out) | tee $(call get_sim_out_name,$*).log) + (set -o pipefail && $(NUMA_PREFIX) $(sim) $(PERMISSIVE_ON) $(call get_common_sim_flags,$*) $(VERBOSE_FLAGS) $(PERMISSIVE_OFF) $* $(BINARY_ARGS) >(spike-dasm > $(call get_sim_out_name,$*).out) | tee $(call get_sim_out_name,$*).log) # run simulator as fast as possible (no insn disassembly) run-binary-fast: check-binary $(BINARY).run.fast run-binaries-fast: check-binaries $(addsuffix .run.fast,$(BINARIES)) %.run.fast: %.check-exists $(SIM_PREREQ) | $(output_dir) - (set -o pipefail && $(NUMA_PREFIX) $(sim) $(PERMISSIVE_ON) $(call get_common_sim_flags,$*) $(PERMISSIVE_OFF) $* $(call get_sim_out_name,$*).dump ; fi - (set -o pipefail && $(NUMA_PREFIX) $(sim_debug) $(PERMISSIVE_ON) $(call get_common_sim_flags,$*) $(VERBOSE_FLAGS) $(call get_waveform_flag,$(call get_sim_out_name,$*)) $(PERMISSIVE_OFF) $* >(spike-dasm > $(call get_sim_out_name,$*).out) | tee $(call get_sim_out_name,$*).log) + (set -o pipefail && $(NUMA_PREFIX) $(sim_debug) $(PERMISSIVE_ON) $(call get_common_sim_flags,$*) $(VERBOSE_FLAGS) $(call get_waveform_flag,$(call get_sim_out_name,$*)) $(PERMISSIVE_OFF) $* $(BINARY_ARGS) >(spike-dasm > $(call get_sim_out_name,$*).out) | tee $(call get_sim_out_name,$*).log) run-fast: run-asm-tests-fast run-bmark-tests-fast From f3c221ddfa5f6db10557cb06999182695067af0f Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Tue, 13 Feb 2024 17:24:59 -0800 Subject: [PATCH 2/3] Split run-binary targets to be easier to read --- common.mk | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/common.mk b/common.mk index a2c0104611..a0acba03fe 100644 --- a/common.mk +++ b/common.mk @@ -371,14 +371,27 @@ run-binary: check-binary $(BINARY).run run-binaries: check-binaries $(addsuffix .run,$(BINARIES)) %.run: %.check-exists $(SIM_PREREQ) | $(output_dir) - (set -o pipefail && $(NUMA_PREFIX) $(sim) $(PERMISSIVE_ON) $(call get_common_sim_flags,$*) $(VERBOSE_FLAGS) $(PERMISSIVE_OFF) $* $(BINARY_ARGS) >(spike-dasm > $(call get_sim_out_name,$*).out) | tee $(call get_sim_out_name,$*).log) + (set -o pipefail && $(NUMA_PREFIX) $(sim) \ + $(PERMISSIVE_ON) \ + $(call get_common_sim_flags,$*) \ + $(VERBOSE_FLAGS) \ + $(PERMISSIVE_OFF) \ + $* \ + $(BINARY_ARGS) \ + >(spike-dasm > $(call get_sim_out_name,$*).out) | tee $(call get_sim_out_name,$*).log) # run simulator as fast as possible (no insn disassembly) run-binary-fast: check-binary $(BINARY).run.fast run-binaries-fast: check-binaries $(addsuffix .run.fast,$(BINARIES)) %.run.fast: %.check-exists $(SIM_PREREQ) | $(output_dir) - (set -o pipefail && $(NUMA_PREFIX) $(sim) $(PERMISSIVE_ON) $(call get_common_sim_flags,$*) $(PERMISSIVE_OFF) $* $(BINARY_ARGS) $(call get_sim_out_name,$*).dump ; fi - (set -o pipefail && $(NUMA_PREFIX) $(sim_debug) $(PERMISSIVE_ON) $(call get_common_sim_flags,$*) $(VERBOSE_FLAGS) $(call get_waveform_flag,$(call get_sim_out_name,$*)) $(PERMISSIVE_OFF) $* $(BINARY_ARGS) >(spike-dasm > $(call get_sim_out_name,$*).out) | tee $(call get_sim_out_name,$*).log) + (set -o pipefail && $(NUMA_PREFIX) $(sim_debug) \ + $(PERMISSIVE_ON) \ + $(call get_common_sim_flags,$*) \ + $(VERBOSE_FLAGS) \ + $(call get_waveform_flag,$(call get_sim_out_name,$*)) \ + $(PERMISSIVE_OFF) \ + $* \ + $(BINARY_ARGS) \ + >(spike-dasm > $(call get_sim_out_name,$*).out) | tee $(call get_sim_out_name,$*).log) run-fast: run-asm-tests-fast run-bmark-tests-fast From 66a0610c5a905ee57cf6476c119e90c6e2589809 Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Tue, 13 Feb 2024 17:26:02 -0800 Subject: [PATCH 3/3] Add BINARY_ARGS help text --- variables.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/variables.mk b/variables.mk index 6351998373..20154c2468 100644 --- a/variables.mk +++ b/variables.mk @@ -27,6 +27,7 @@ HELP_SIMULATION_VARIABLES = \ " BINARY = riscv elf binary that the simulator will run when using the run-binary* targets" \ " BINARIES = list of riscv elf binary that the simulator will run when using the run-binaries* targets" \ " BINARIES_DIR = directory of riscv elf binaries that the simulator will run when using the run-binaries* targets" \ +" BINARY_ARGS = arguments to pass to each binary in run-binary targets (primarily meant for pk arguments)" \ " LOADMEM = riscv elf binary that should be loaded directly into simulated DRAM. LOADMEM=1 will load the BINARY elf" \ " LOADARCH = path to a architectural checkpoint directory that should end in .loadarch/, for restoring from a checkpoint" \ " VERBOSE_FLAGS = flags used when doing verbose simulation [$(VERBOSE_FLAGS)]" \ @@ -275,6 +276,7 @@ PERMISSIVE_ON=+permissive PERMISSIVE_OFF=+permissive-off BINARY ?= BINARIES ?= +BINARY_ARGS ?= override SIM_FLAGS += +dramsim +dramsim_ini_dir=$(TESTCHIP_DIR)/src/main/resources/dramsim2_ini +max-cycles=$(TIMEOUT_CYCLES) VERBOSE_FLAGS ?= +verbose # get_out_name is a function, 1st argument is the binary