Skip to content

Commit 37b1383

Browse files
committed
Allocate adequate memory for running arch-test
Once the memory mapping requirement is adjusted to 2^{19} bytes, RISC-V Architecture Tests is unable to run: make[1]: *** [rv32emu/build/arch-test/Makefile.DUT-rv32emu:5: TARGET0] Error 139 INFO | Running Tests on Reference Model. INFO | Initiating signature checking. ERROR | Signature file : arch-test/rv32i_m/A/src/amoadd.w-01.S/dut/DUT-rv32emu.signature does not exist New option "ENABLE_FULL4G" allows full access to 4 GiB address space, meaning that it requires more memory mapping during the emulator initialization. Close #484
1 parent feca1de commit 37b1383

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

.ci/riscv-tests.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ set -x
99

1010
export PATH=`pwd`/toolchain/bin:$PATH
1111

12-
make clean
12+
make distclean
13+
# Rebuild with all RISC-V extensions
14+
# FIXME: To pass the RISC-V Architecture Tests, full access to 4 GiB is
15+
# necessary. We need to investigate why full 4 GiB memory access is required
16+
# for this purpose, although the emulator can run all selected benchmarks with
17+
# much smaller memory mapping regions.
18+
make ENABLE_EXT_M=1 ENABLE_EXT_A=1 ENABLE_EXT_F=1 ENABLE_EXT_C=1 \
19+
ENABLE_Zicsr=1 ENABLE_Zifencei=1 ENABLE_FULL4G=1
1320
make arch-test RISCV_DEVICE=IMAFCZicsrZifencei || exit 1
1421
make arch-test RISCV_DEVICE=FCZicsr || exit 1

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ $(call set-feature, Zicsr)
8181
ENABLE_Zifencei ?= 1
8282
$(call set-feature, Zifencei)
8383

84+
ENABLE_FULL4G ?= 0
85+
8486
# Experimental SDL oriented system calls
8587
ENABLE_SDL ?= 1
8688
ifneq ("$(CC_IS_EMCC)", "1") # note that emcc generates port SDL headers/library, so it does not requires system SDL headers/library
@@ -99,12 +101,19 @@ ifeq ($(call has, SDL), 1)
99101
OBJS_EXT += syscall_sdl.o
100102
$(OUT)/syscall_sdl.o: CFLAGS += $(shell sdl2-config --cflags)
101103
# 4 GiB of memory is required to run video games.
102-
$(OUT)/main.o: CFLAGS += -DMEM_SIZE=0xFFFFFFFFULL # 2^{32} - 1
104+
ENABLE_FULL4G := 1
103105
LDFLAGS += $(shell sdl2-config --libs) -pthread
104106
LDFLAGS += $(shell pkg-config --libs SDL2_mixer)
105107
endif
106108
endif
107109

110+
# Full access to a 4 GiB address space, necessitating more memory mapping
111+
# during emulator initialization.
112+
$(call set-feature, FULL4G)
113+
ifeq ($(call has, FULL4G), 1)
114+
$(OUT)/main.o: CFLAGS += -DMEM_SIZE=0xFFFFFFFFULL # 2^{32} - 1
115+
endif
116+
108117
ENABLE_GDBSTUB ?= 0
109118
$(call set-feature, GDBSTUB)
110119
ifeq ($(call has, GDBSTUB), 1)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ The image containing all the necessary tools for development and testing can be
9595
* `ENABLE_Zicsr`: Control and Status Register (CSR)
9696
* `ENABLE_Zifencei`: Instruction-Fetch Fence
9797
* `ENABLE_GDBSTUB` : GDB remote debugging support
98+
* `ENABLE_FULL4G` : Full access to 4 GiB address space
9899
* `ENABLE_SDL` : Experimental Display and Event System Calls
99100
* `ENABLE_JIT` : Experimental JIT compiler
100101

src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ static void dump_test_signature(const char *prog_name)
174174
#endif
175175
/* FIXME: MEM_SIZE shall be defined on different runtime */
176176
#ifndef MEM_SIZE
177-
/* Allocate 2^{19} - 1 bytes, which is ample for all known benchmarks. */
178-
#define MEM_SIZE 0x80000
177+
/* Allocate 2^{19} bytes, which is ample for all selective benchmarks. */
178+
#define MEM_SIZE 0x80000ULL
179179
#endif
180180
#define STACK_SIZE 0x1000 /* 4096 */
181181
#define ARGS_OFFSET_SIZE 0x1000 /* 4096 */

0 commit comments

Comments
 (0)