Support multi-loadarch RTL sims

This commit is contained in:
Jerry Zhao
2023-05-20 09:40:52 -07:00
parent 57d849ae4d
commit 5d55f2bd77
2 changed files with 12 additions and 6 deletions

View File

@@ -320,8 +320,14 @@ else ifneq ($(LOADMEM),)
get_loadmem_flag = +loadmem=$(LOADMEM) get_loadmem_flag = +loadmem=$(LOADMEM)
endif endif
ifneq ($(LOADARCH),_)
get_loadarch_flag = +loadarch=$(subst mem.elf,loadarch,$(1))
endif
# get the output path base name for simulation outputs, First arg is the binary # get the output path base name for simulation outputs, First arg is the binary
get_sim_out_name = $(output_dir)/$(call get_out_name,$(1)) get_sim_out_name = $(output_dir)/$(call get_out_name,$(1))
# sim flags that are common to run-binary/run-binary-fast/run-binary-debug
get_common_sim_flags = $(SIM_FLAGS) $(EXTRA_SIM_FLAGS) $(SEED_FLAG) $(call get_loadmem_flag,$(1)) $(call get_loadarch_flag,$(1))
.PHONY: %.run %.run.debug %.run.fast .PHONY: %.run %.run.debug %.run.fast
@@ -330,14 +336,14 @@ run-binary: $(BINARY).run check-binary
run-binaries: $(addsuffix .run,$(BINARIES)) check-binaries run-binaries: $(addsuffix .run,$(BINARIES)) check-binaries
%.run: %.check-exists $(SIM_PREREQ) | $(output_dir) %.run: %.check-exists $(SIM_PREREQ) | $(output_dir)
(set -o pipefail && $(NUMA_PREFIX) $(sim) $(PERMISSIVE_ON) $(SIM_FLAGS) $(EXTRA_SIM_FLAGS) $(call get_loadmem_flag,$*) $(SEED_FLAG) $(VERBOSE_FLAGS) $(PERMISSIVE_OFF) $* </dev/null 2> >(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) $* </dev/null 2> >(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 simulator as fast as possible (no insn disassembly)
run-binary-fast: $(BINARY).run.fast check-binary run-binary-fast: $(BINARY).run.fast check-binary
run-binaries-fast: $(addsuffix .run.fast,$(BINARIES)) check-binaries run-binaries-fast: $(addsuffix .run.fast,$(BINARIES)) check-binaries
%.run.fast: %.check-exists $(SIM_PREREQ) | $(output_dir) %.run.fast: %.check-exists $(SIM_PREREQ) | $(output_dir)
(set -o pipefail && $(NUMA_PREFIX) $(sim) $(PERMISSIVE_ON) $(SIM_FLAGS) $(EXTRA_SIM_FLAGS) $(call get_loadmem_flag,$*) $(SEED_FLAG) $(PERMISSIVE_OFF) $* </dev/null | tee $(call get_sim_out_name,$*).log) (set -o pipefail && $(NUMA_PREFIX) $(sim) $(PERMISSIVE_ON) $(call get_common_sim_flags,$*) $(PERMISSIVE_OFF) $* </dev/null | tee $(call get_sim_out_name,$*).log)
# run simulator with as much debug info as possible # run simulator with as much debug info as possible
run-binary-debug: $(BINARY).run.debug check-binary run-binary-debug: $(BINARY).run.debug check-binary
@@ -347,7 +353,7 @@ run-binaries-debug: $(addsuffix .run.debug,$(BINARIES)) check-binaries
ifneq (none,$*) ifneq (none,$*)
riscv64-unknown-elf-objdump -D $* > $(call get_sim_out_name,$*).dump riscv64-unknown-elf-objdump -D $* > $(call get_sim_out_name,$*).dump
endif endif
(set -o pipefail && $(NUMA_PREFIX) $(sim_debug) $(PERMISSIVE_ON) $(SIM_FLAGS) $(EXTRA_SIM_FLAGS) $(call get_loadmem_flag,$*) $(SEED_FLAG) $(VERBOSE_FLAGS) $(call get_waveform_flag,$(call get_sim_out_name,$*)) $(PERMISSIVE_OFF) $* </dev/null 2> >(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) $* </dev/null 2> >(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 run-fast: run-asm-tests-fast run-bmark-tests-fast

View File

@@ -254,10 +254,10 @@ LOADMEM ?=
LOADARCH ?= LOADARCH ?=
ifneq ($(LOADARCH),) ifneq ($(LOADARCH),)
override BINARY = $(LOADARCH)/mem.elf override BINARY = $(addsuffix /mem.elf,$(LOADARCH))
override get_out_name = $(shell basename $(LOADARCH)) override BINARIES = $(addsuffix /mem.elf,$(LOADARCH))
override get_out_name = $(shell basename $(dir $(1)))
override LOADMEM = 1 override LOADMEM = 1
override SIM_FLAGS += +loadarch=$(LOADARCH)/loadarch
endif endif
######################################################################################### #########################################################################################