Skip to content

Commit 2f670a4

Browse files
committed
Publish version 1.1
Version 1.1 emphasizes the system emulation capable of running Linux kernel and user-space binaries, aligning with the research paper "Design and Evaluation of a Lightweight RISC-V System-Level Emulator for Booting Linux," which was presented at the CTHPC 2025 conference [1]. [1] https://sites.google.com/view/cthpc2025
1 parent 45d19aa commit 2f670a4

16 files changed

+26
-137
lines changed

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,14 @@ tests/arch-test-target/sail_cSim/riscv_sim_RV32
3131
tests/scimark2/
3232
__pycache__/
3333
src/minimal_dtb.h
34+
35+
# external
36+
tests/riscv-arch-test
37+
src/mini-gdbstub
38+
src/softfloat
39+
tests/ansibench
40+
tests/rv8-bench
41+
src/ieeelib
42+
tests/doom
43+
tests/quake
44+
src/dtc

.gitmodules

-36
This file was deleted.

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ ifeq ($(call has, GDBSTUB), 1)
213213
GDBSTUB_OUT = $(abspath $(OUT)/mini-gdbstub)
214214
GDBSTUB_COMM = 127.0.0.1:1234
215215
src/mini-gdbstub/Makefile:
216-
git submodule update --init $(dir $@)
216+
$(Q)git clone https://github.com/RinHizakura/mini-gdbstub $(dir $@) --depth=1
217217
GDBSTUB_LIB := $(GDBSTUB_OUT)/libgdbstub.a
218218
$(GDBSTUB_LIB): src/mini-gdbstub/Makefile
219219
$(MAKE) -C $(dir $<) O=$(dir $@)

mk/artifact.mk

+10-88
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
ENABLE_PREBUILT ?= 1
2-
31
CC ?= gcc
42
CROSS_COMPILE ?= riscv-none-elf-
53

@@ -54,34 +52,20 @@ define fetch-releases-tag
5452
endef
5553

5654
LATEST_RELEASE ?=
57-
58-
ifeq ($(call has, PREBUILT), 1)
59-
# On macOS/arm64 Github runner, let's leverage the ${{ secrets.GITHUB_TOKEN }} to prevent 403 rate limit error.
60-
# Thus, the LATEST_RELEASE tag is defined at Github job steps, no need to fetch them here.
61-
ifeq ($(LATEST_RELEASE),)
62-
ifeq ($(call has, SYSTEM), 1)
63-
$(call fetch-releases-tag,Linux-Image,rv32emu-linux-image-prebuilt.tar.gz,Linux image)
64-
else ifeq ($(call has, ARCH_TEST), 1)
65-
$(call fetch-releases-tag,sail,rv32emu-prebuilt-sail-$(HOST_PLATFORM),Sail model)
66-
else
67-
$(call fetch-releases-tag,ELF,rv32emu-prebuilt.tar.gz,Prebuilt benchmark)
68-
endif
55+
ifeq ($(LATEST_RELEASE),)
56+
ifeq ($(call has, SYSTEM), 1)
57+
$(call fetch-releases-tag,Linux-Image,rv32emu-linux-image-prebuilt.tar.gz,Linux image)
58+
else ifeq ($(call has, ARCH_TEST), 1)
59+
$(call fetch-releases-tag,sail,rv32emu-prebuilt-sail-$(HOST_PLATFORM),Sail model)
60+
else
61+
$(call fetch-releases-tag,ELF,rv32emu-prebuilt.tar.gz,Prebuilt benchmark)
6962
endif
70-
PREBUILT_BLOB_URL = https://github.com/sysprog21/rv32emu-prebuilt/releases/download/$(LATEST_RELEASE)
71-
else
72-
# Since rv32emu only supports the dynamic binary translation of integer instruction in tiered compilation currently,
73-
# we disable the hardware floating-point and the related SIMD operation of x86.
74-
CFLAGS := -m32 -mno-sse -mno-sse2 -msoft-float -O2 -Wno-unused-result -L$(BIN_DIR)
75-
LDFLAGS := -lsoft-fp -lm
76-
77-
CFLAGS_CROSS := -march=rv32im -mabi=ilp32 -O2 -Wno-implicit-function-declaration
78-
LDFLAGS_CROSS := -lm -lsemihost
7963
endif
64+
PREBUILT_BLOB_URL = https://github.com/sysprog21/rv32emu-prebuilt/releases/download/$(LATEST_RELEASE)
8065

81-
.PHONY: artifact fetch-checksum scimark2 ieeelib
66+
.PHONY: artifact fetch-checksum
8267

83-
artifact: fetch-checksum ieeelib scimark2
84-
ifeq ($(call has, PREBUILT), 1)
68+
artifact: fetch-checksum
8569
$(Q)$(PRINTF) "Checking SHA-1 of prebuilt binaries ... "
8670
$(Q)$(eval RES := 0)
8771

@@ -133,46 +117,8 @@ else
133117
$(call notice, [OK]); \
134118
fi
135119
endif
136-
else
137-
ifeq ($(call has, SYSTEM), 1)
138-
$(Q)(cd $(BIN_DIR) && $(SHA1SUM) linux-image/Image >> sha1sum-linux-image)
139-
$(Q)(cd $(BIN_DIR) && $(SHA1SUM) linux-image/rootfs.cpio >> sha1sum-linux-image)
140-
else
141-
git submodule update --init $(addprefix ./tests/,$(foreach tb,$(TEST_SUITES),$(tb)))
142-
$(Q)for tb in $(TEST_SUITES); do \
143-
CC=$(CC) CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" BINDIR=$(BIN_DIR)/linux-x86-softfp $(MAKE) -C ./tests/$$tb; \
144-
done
145-
$(Q)for tb in $(TEST_SUITES); do \
146-
CC=$(CROSS_COMPILE)gcc CFLAGS="$(CFLAGS_CROSS)" LDFLAGS="$(LDFLAGS_CROSS)" BINDIR=$(BIN_DIR)/riscv32 $(MAKE) -C ./tests/$$tb; \
147-
done
148-
149-
$(Q)$(PRINTF) "Building standalone testbenches ...\n"
150-
$(Q)for tb in $(TEST_BENCHES); do \
151-
$(CC) $(CFLAGS) -o $(BIN_DIR)/linux-x86-softfp/$$tb ./tests/$$tb.c $(LDFLAGS); \
152-
done
153-
$(Q)for tb in $(TEST_BENCHES); do \
154-
$(CROSS_COMPILE)gcc $(CFLAGS_CROSS) -o $(BIN_DIR)/riscv32/$$tb ./tests/$$tb.c $(LDFLAGS_CROSS); \
155-
done
156-
157-
git submodule update --init ./tests/doom ./tests/quake
158-
$(Q)$(PRINTF) "Building doom ...\n"
159-
$(Q)$(MAKE) -C ./tests/doom/src/riscv CROSS=$(CROSS_COMPILE)
160-
$(Q)cp ./tests/doom/src/riscv/doom-riscv.elf $(BIN_DIR)/riscv32/doom
161-
$(Q)$(PRINTF) "Building quake ...\n"
162-
$(Q)cd ./tests/quake && mkdir -p build && cd build && \
163-
cmake -DCMAKE_TOOLCHAIN_FILE=../port/boards/rv32emu/toolchain.cmake \
164-
-DCROSS_COMPILE=$(CROSS_COMPILE) \
165-
-DCMAKE_BUILD_TYPE=RELEASE -DBOARD_NAME=rv32emu .. && \
166-
make
167-
$(Q)cp ./tests/quake/build/port/boards/rv32emu/quake $(BIN_DIR)/riscv32/quake
168-
169-
$(Q)(cd $(BIN_DIR)/linux-x86-softfp; for fd in *; do $(SHA1SUM) "$$fd"; done) >> $(BIN_DIR)/sha1sum-linux-x86-softfp
170-
$(Q)(cd $(BIN_DIR)/riscv32; for fd in *; do $(SHA1SUM) "$$fd"; done) >> $(BIN_DIR)/sha1sum-riscv32
171-
endif
172-
endif
173120

174121
fetch-checksum:
175-
ifeq ($(call has, PREBUILT), 1)
176122
$(Q)$(PRINTF) "Fetching SHA-1 of prebuilt binaries ... "
177123
ifeq ($(call has, SYSTEM), 1)
178124
ifeq ($(wildcard $(BIN_DIR)/rv32emu-linux-image-prebuilt.tar.gz),)
@@ -197,27 +143,3 @@ else
197143
$(Q)$(call warn , skipped)
198144
endif
199145
endif
200-
endif
201-
202-
scimark2:
203-
ifeq ($(call has, PREBUILT), 0)
204-
ifeq ($(call has, SYSTEM), 0)
205-
$(Q)$(call prologue,"scimark2")
206-
$(Q)$(call download,$(SCIMARK2_URL))
207-
$(Q)$(call verify,$(SHA1SUM),$(SCIMARK2_SHA1),$(notdir $(SCIMARK2_URL)))
208-
$(Q)$(call extract,"./tests/scimark2",$(notdir $(SCIMARK2_URL)))
209-
$(Q)$(call epilogue,$(notdir $(SCIMARK2_URL)),$(SHA1_FILE1),$(SHA1_FILE2))
210-
$(Q)$(PRINTF) "Building scimark2 ...\n"
211-
$(Q)$(MAKE) -C ./tests/scimark2 CC=$(CC) CFLAGS="-m32 -O2"
212-
$(Q)cp ./tests/scimark2/scimark2 $(BIN_DIR)/linux-x86-softfp/scimark2
213-
$(Q)$(MAKE) -C ./tests/scimark2 clean && $(RM) ./tests/scimark2/scimark2.o
214-
$(Q)$(MAKE) -C ./tests/scimark2 CC=$(CROSS_COMPILE)gcc CFLAGS="-march=rv32imf -mabi=ilp32 -O2"
215-
$(Q)cp ./tests/scimark2/scimark2 $(BIN_DIR)/riscv32/scimark2
216-
endif
217-
endif
218-
219-
ieeelib:
220-
ifeq ($(call has, PREBUILT), 0)
221-
git submodule update --init ./src/ieeelib
222-
$(Q)$(MAKE) -C ./src/ieeelib CC=$(CC) CFLAGS="$(CFLAGS)" BINDIR=$(BIN_DIR)
223-
endif

mk/riscv-arch-test.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ arch-test: riscof-check $(BIN) artifact
1919
ifeq ($(CROSS_COMPILE),)
2020
$(error GNU Toolchain for RISC-V is required to build architecture tests. Please check package installation)
2121
endif
22-
git submodule update --init $(dir $(ARCH_TEST_DIR))
22+
$(Q)git clone https://github.com/riscv-non-isa/riscv-arch-test $(dir $(ARCH_TEST_DIR)) --depth=1
2323
$(Q)cp $(OUT)/rv32emu-prebuilt-sail-$(HOST_PLATFORM) tests/arch-test-target/sail_cSim/riscv_sim_RV32
2424
$(Q)chmod +x tests/arch-test-target/sail_cSim/riscv_sim_RV32
2525
$(Q)python3 -B $(RISCV_TARGET)/setup.py --riscv_device=$(RISCV_DEVICE) --hw_data_misaligned_support=$(hw_data_misaligned_support)

mk/softfloat.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ SOFTFLOAT_OBJS := $(addprefix $(OUT)/softfloat/, \
327327
SOFTFLOAT_SENTINEL := src/softfloat/.git
328328

329329
$(SOFTFLOAT_SENTINEL):
330-
$(Q)git submodule update --init $(dir $@)
330+
$(Q)git clone https://github.com/ucb-bar/berkeley-softfloat-3 $(dir $@) --depth=1
331331
SOFTFLOAT_DUMMY_PLAT := $(OUT)/softfloat/platform.h
332332
$(SOFTFLOAT_DUMMY_PLAT):
333333
$(Q)mkdir -p $(shell dirname $@)

mk/system.mk

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
ifeq ($(call has, SYSTEM), 1)
33

44
CFLAGS += -Isrc/dtc/libfdt
5-
LIBFDT_HACK := $(shell git submodule update --init src/dtc)
5+
LIBFDT_HACK := $(shell [ -d src/dtc/.git ] || \
6+
git clone --depth=1 https://git.kernel.org/pub/scm/utils/dtc/dtc.git src/dtc)
67

78
DEV_SRC := src/devices
89

src/dtc

-1
This file was deleted.

src/ieeelib

-1
This file was deleted.

src/mini-gdbstub

-1
This file was deleted.

src/softfloat

-1
This file was deleted.

tests/ansibench

-1
This file was deleted.

tests/doom

-1
This file was deleted.

tests/quake

-1
This file was deleted.

tests/riscv-arch-test

-1
This file was deleted.

tests/rv8-bench

-1
This file was deleted.

0 commit comments

Comments
 (0)