From 7aaa233d73b2bb913d78e7f34ab2effff0b9005b Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Wed, 12 Apr 2023 16:22:39 -0700 Subject: [PATCH] Switch to LOADMEM=1, LOADARCH=loadarch flags --- common.mk | 24 ++++++--------------- docs/Simulation/Software-RTL-Simulation.rst | 9 ++------ docs/Software/Spike.rst | 2 +- variables.mk | 15 +++++++++++++ 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/common.mk b/common.mk index 9ba6850e..3e785867 100644 --- a/common.mk +++ b/common.mk @@ -319,24 +319,14 @@ run-fast: run-asm-tests-fast run-bmark-tests-fast ######################################################################################### # helper rules to run simulator with fast loadmem +# LEGACY - use LOADMEM=1 instead ######################################################################################### -run-binary-loadmem: check-binary -run-binary-loadmem: $(SIM_PREREQ) | $(output_dir) -run-binary-loadmem: run-binary -run-binary-loadmem: override SIM_FLAGS += +loadmem=$(BINARY) -run-binary-debug-loadmem: check-binary -run-binary-debug-loadmem: $(SIM_DEBUG_REREQ) | $(output_dir) -run-binary-debug-loadmem: run-binary-debug -run-binary-debug-loadmem: override SIM_FLAGS += +loadmem=$(BINARY) -run-binary-fast-loadmem: check-binary -run-binary-fast-loadmem: $(SIM_PREREQ) | $(output_dir) -run-binary-fast-loadmem: run-binary-fast -run-binary-fast-loadmem: override SIM_FLAGS += +loadmem=$(BINARY) - -# Legacy targets for backwards compat -run-binary-hex: run-binary-loadmem -run-binary-debug-hex: run-binary-debug-loadmem -run-binary-fast-hex: run-binary-fast-loadmem +run-binary-hex: run-binary +run-binary-hex: override SIM_FLAGS += +loadmem=$(BINARY) +run-binary-debug-hex: run-binary-debug +run-binary-debug-hex: override SIM_FLAGS += +loadmem=$(BINARY) +run-binary-fast-hex: run-binary-fast +run-binary-fast-hex: override SIM_FLAGS += +loadmem=$(BINARY) ######################################################################################### # run assembly/benchmarks rules diff --git a/docs/Simulation/Software-RTL-Simulation.rst b/docs/Simulation/Software-RTL-Simulation.rst index ccbef67c..754fa2bb 100644 --- a/docs/Simulation/Software-RTL-Simulation.rst +++ b/docs/Simulation/Software-RTL-Simulation.rst @@ -155,13 +155,8 @@ Loadmem files should be ELF files. In the most common use case, this can be the .. code-block:: shell - make run-binary BINARY=test.riscv EXTRA_SIM_FLAGS="+loadmem=test.riscv" - -For convenience, special ``-loadmem`` targets are provided to automatically rely on loadmem to read in the binary. - -.. code-block:: shell - - make run-binary-loadmem BINARY=test.riscv + make run-binary BINARY=test.riscv LOADMEM=test.riscv + make run-binary BINART=test.riscv LOADMEM=1 Generating Waveforms ----------------------- diff --git a/docs/Software/Spike.rst b/docs/Software/Spike.rst index 48487851..e9abe0c0 100644 --- a/docs/Software/Spike.rst +++ b/docs/Software/Spike.rst @@ -43,7 +43,7 @@ Spike-as-a-Tile can be configured with custom IPC, commit logging, and other beh .. code-block:: shell - make CONFIG=SpikeUltraFastConfig run-binary-loadmem BINARY=hello.riscv EXTRA_SPIKE_FLAGS="+spike-ipc=10000 +spike-fast-clint +spike-debug" + make CONFIG=SpikeUltraFastConfig run-binary BINARY=hello.riscv EXTRA_SPIKE_FLAGS="+spike-ipc=10000 +spike-fast-clint +spike-debug" LOADMEM=1 * ``+spike-ipc=``: Sets the maximum number of instructions Spike can retire in a single "tick", or cycle of the uncore simulation. diff --git a/variables.mk b/variables.mk index ae5de9a0..a725c599 100644 --- a/variables.mk +++ b/variables.mk @@ -248,6 +248,21 @@ BINARY ?= override SIM_FLAGS += +dramsim +dramsim_ini_dir=$(TESTCHIP_DIR)/src/main/resources/dramsim2_ini +max-cycles=$(timeout_cycles) VERBOSE_FLAGS ?= +verbose sim_out_name = $(output_dir)/$(subst $() $(),_,$(notdir $(basename $(BINARY)))) +LOADMEM ?= +LOADARCH ?= + +ifneq ($(LOADARCH),) +override BINARY = $(LOADARCH)/mem.elf +override SIM_FLAGS += +loadarch=$(LOADARCH)/loadarch +endif + +ifeq ($(LOADMEM),1) +# If LOADMEM=1, assume BINARY is the loadmem elf +override SIM_FLAGS += +loadmem=$(BINARY) +else ifneq ($(LOADMEM),) +# Otherwise, assume the variable points to an elf file +override SIM_FLAGS += +loadmem=$(LOADMEM) +endif ######################################################################################### # build output directory for compilation