Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ endif
# from it through the print-buildroot-version target, so a bump here is enough.
BUILDROOT_VERSION := 2026.08
BUILDROOT_DIR := build/buildroot
# DEFAULT_DTB=nutshell or nutshell-* -> nutshell_defconfig; otherwise xiangshan_defconfig.
BUILDROOT_DEFCONFIG := $(if $(filter nutshell nutshell-%,$(DEFAULT_DTB)),nutshell_defconfig,xiangshan_defconfig)
# Select the board's userspace and kernel configuration.
BUILDROOT_DEFCONFIG := $(if $(filter boom boom-%,$(DEFAULT_DTB)),boom_defconfig,$(if $(filter nutshell nutshell-%,$(DEFAULT_DTB)),nutshell_defconfig,xiangshan_defconfig))
BUILDROOT_CONFIG_STAMP := build/buildroot-config/$(BUILDROOT_DEFCONFIG)
$(BUILDROOT_DIR)/Makefile:
mkdir -p build
Expand All @@ -73,7 +73,7 @@ $(TOOLCHAIN_WRAPPER): $(BUILDROOT_CONFIG_STAMP)

# Build Linux kernel
LINUX_IMAGE := $(BUILDROOT_DIR)/output/images/Image
$(LINUX_IMAGE): $(TOOLCHAIN_WRAPPER) $(BUILDROOT_CONFIG_STAMP) br2-external/board/openxiangshan/nemu/linux.config $(if $(filter nutshell_defconfig,$(BUILDROOT_DEFCONFIG)),br2-external/board/openxiangshan/nemu/linux-nutshell.fragment)
$(LINUX_IMAGE): $(TOOLCHAIN_WRAPPER) $(BUILDROOT_CONFIG_STAMP) br2-external/board/openxiangshan/nemu/linux.config $(if $(filter nutshell_defconfig,$(BUILDROOT_DEFCONFIG)),br2-external/board/openxiangshan/nemu/linux-nutshell.fragment) $(if $(filter boom_defconfig,$(BUILDROOT_DEFCONFIG)),br2-external/board/openxiangshan/nemu/linux-boom.fragment)
$(MAKE) -C $(BUILDROOT_DIR) BR2_EXTERNAL=$(abspath br2-external) $(BUILDROOT_DEFCONFIG)
$(MAKE) -C $(BUILDROOT_DIR) BR2_EXTERNAL=$(abspath br2-external)

Expand Down
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,30 @@ See the
[SPEC2006 configuration](workloads/linux/spec2006/README.md#configuration)
section for `riscv_gcc16_rv64imac_lp64.cfg`.

BOOM Linux images use `boom_defconfig`: RV64GC/lp64d userspace and a kernel
with V and KVM disabled. Choose the UART map through `DEFAULT_DTB`:

```sh
make linux/hello DEFAULT_DTB=boom-mem2g
make linux/hello DEFAULT_DTB=boom-fpga-mem2g
```

`boom-mem2g` uses the simulated UART at `0x10000000`;
`boom-fpga-mem2g` uses the FPGA UART16550 at `0x310b0000` with 32-bit
accesses and `reg-shift=2`. Both describe one hart and 2 GiB of DRAM.
The existing 256 MiB `boom` template also selects `boom_defconfig`.
Use a clean Buildroot output when switching board profiles so packages and
the kernel are rebuilt with the selected configuration.

SPEC2006 defaults to the GCC 16 RV64GC Zba/Zbb/Zbs config for BOOM.
For FPGA, disable startup profiling markers with `SPEC2006_PROFILING=0`
(the workload-specific form of `PROFILING=0`):

```sh
make linux/spec2006 BENCH=mcf DEFAULT_DTB=boom-fpga-mem2g \
SPEC2006_PROFILING=0 SPEC2006_ISO=/path/to/cpu2006.iso -jN
```

## Build Requirements

Any modern Linux distributions should be okay. The build system of this project is using the toolchain provided by buildroot, so you do not have to set up the toolchains manually to build most workloads. Some workloads require additional toolchians not provided by buildroot. Please refer to the README file of each workload (`README.md` in the workload directory) for details.
Expand Down
4 changes: 4 additions & 0 deletions br2-external/board/openxiangshan/nemu/linux-boom.fragment
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# BOOM implements RV64GC with Zba/Zbb/Zbs, without V or H.
# CONFIG_RISCV_ISA_V is not set
# CONFIG_VIRTUALIZATION is not set
# CONFIG_KVM is not set
15 changes: 15 additions & 0 deletions br2-external/configs/boom_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# BOOM RV64GC/LP64D. Bootlin rv64gc toolchain.
BR2_riscv=y
BR2_RISCV_ISA_RVC=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TARGET_GENERIC_HOSTNAME="boom"
BR2_TARGET_GENERIC_ISSUE="BOOM RV64GC Test Image"
BR2_TARGET_GENERIC_ROOT_PASSWD="xiangshan"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="${BR2_EXTERNAL}/board/openxiangshan/nemu/linux.config"
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="${BR2_EXTERNAL}/board/openxiangshan/nemu/linux-boom.fragment"
BR2_TARGET_ROOTFS_INITRAMFS=y
BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="${BR2_EXTERNAL}/board/openxiangshan/nemu/busybox-taskset.fragment"
BR2_PACKAGE_NEMU_TRAP=y
BR2_PACKAGE_NEMU_EXEC=y
14 changes: 12 additions & 2 deletions dts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,22 @@ The bundled `boom.dts.in` custom template describes the single-hart BOOM v4
DiffTest platform: RV64IMAFDC with Zba/Zbb/Zbs, Sv39, eight PMP regions at
four-byte granularity, and 256 MiB DRAM at `0x80000000`. It uses CLINT at
`0x02000000`, PLIC at `0x0c000000`, and an ns16550 UART at `0x10000000`.
Select it with `make linux/hello DEFAULT_DTB=boom`; it uses the default
`xiangshan_defconfig` Buildroot tree with floating-point support.
Select it with `make linux/hello DEFAULT_DTB=boom`; it uses the
`boom_defconfig` Buildroot tree with floating-point support.

Linux images with `DEFAULT_DTB=nutshell` or `nutshell-*` use
`nutshell_defconfig` (RV64IMAC/LP64) instead of `xiangshan_defconfig`.

BOOM also has two generated 2 GiB profiles: `boom-mem2g` uses the simulated
ns16550 at `0x10000000`; `boom-fpga-mem2g` uses the FPGA UART16550 at
`0x310b0000`, with a 50 MHz UART clock, `reg-shift=2`, and 32-bit accesses
(`earlycon=uart8250,mmio32,0x310b0000`). Both use Sv39, CLINT at
`0x02000000`, PLIC at `0x0c000000`, and eight PMP regions at four-byte
granularity. Neither UART declares an interrupt connection.

Linux images with `DEFAULT_DTB=boom` or `boom-*` use `boom_defconfig`
(RV64GC/LP64D userspace, V and KVM disabled in the kernel).

`nutshell` is the 128 MiB machine description used by NEMU's
`riscv64-nutshell_defconfig`: uartlite at `0x40600000`, no PLIC.
NutShell simulation uses the same map. `nutshell-mem2g` keeps that
Expand Down
40 changes: 38 additions & 2 deletions dts/generate-nemu-board-dts.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ def parse_name(name):
"spike-2core": (2, 2 << 30),
"yanqihu": (1, 128 << 20),
"yanqihu-2core": (2, 128 << 20),
"boom-mem2g": (1, 2 << 30),
"boom-fpga-mem2g": (1, 2 << 30),
"xiangshan-fpga-AIA-mem16g": (1, 16 << 30),
}
if name in fixed:
Expand Down Expand Up @@ -99,15 +101,26 @@ def cache_properties(nemu=False, timebase=False):
return "\n".join(result)


def serial16550():
return """uart0: serial@310b0000 {
def serial16550(label="uart0"):
return f"""{label}: serial@310b0000 {{
compatible = "ns16550a";
reg = <0x0 0x310b0000 0x0 0x10000>;
reg-shift = <2>;
reg-io-width = <4>;
clock-frequency = <50000000>;
current-speed = <115200>;
status = "okay";
}};"""


def serial_boom():
return """serial0: ns16550@10000000 {
compatible = "ns16550a";
clock-frequency = <10000000>;
reg = <0x0 0x10000000 0x0 0x100>;
reg-shift = <0>;
reg-io-width = <1>;
status = "okay";
};"""


Expand Down Expand Up @@ -377,6 +390,29 @@ def render(name, isa_config_name=None):
reserved_memories=[], plic_machine_first=False,
chosen_properties=chosen_properties("nemu"),
bootargs="console=hvc0 earlycon=sbi")
elif name in {"boom-mem2g", "boom-fpga-mem2g"}:
fpga = name == "boom-fpga-mem2g"
gen = DTSGen(
compatible="freechips,rocketchip-boom",
model="boom-v4-difftest",
cpu_compatibles=["riscv"],
isa_extensions=DTSGen.sort_isa_extensions(
"i m a f d c zicsr zifencei zba zbb zbs".split()),
legacy_isa="rv64imafdc_zba_zbb_zbs_zicsr_zifencei",
mmu_type="riscv,sv39",
timebase_freq=1000000,
nr_harts=1,
clint_addr=0x02000000,
plic_addr=0x0c000000,
plic_ndev=31,
memories=[(DRAM_BASE, memory)],
reserved_memories=[],
uartlite_addr=None,
cpu_properties="riscv,pmpregions = <8>;\nriscv,pmpgranularity = <4>;",
chosen_properties=chosen_properties("spike"),
bootargs=("console=ttyS0,115200 earlycon=uart8250," +
("mmio32,0x310b0000" if fpga else "mmio,0x10000000")))
gen.add_device(serial16550("serial0") if fpga else serial_boom())
elif name.startswith("spike"):
nr_harts = 2 if name == "spike-2core" else 1
gen = DTSGen(compatible="ucbbar,spike-bare-dev", model="ucbbar,spike-bare",
Expand Down
20 changes: 20 additions & 0 deletions workloads/linux/spec2006/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@ PROFILING=0 make linux/spec2006 BENCH=mcf INPUT=ref \

The final `nemu-trap <status>` is always emitted for single-hart images.

For BOOM FPGA, use its UART map and disable profiling markers:

```sh
make linux/spec2006 BENCH=mcf DEFAULT_DTB=boom-fpga-mem2g \
SPEC2006_PROFILING=0 SPEC2006_ISO=/path/to/cpu2006.iso -jN
```

`SPEC2006_PROFILING=0` is the workload-specific form of `PROFILING=0`;
it also avoids passing a generic `PROFILING` Make variable into the kernel
build. `boom-mem2g` selects the simulated UART for emulation instead.

## Build a multi-hart workload

Add `MULTIHART=1 HARTS=<count>`, where `<count>` matches the QEMU checkpoint
Expand Down Expand Up @@ -234,6 +245,15 @@ The default SPEC cfg is the GCC 16 RVA23U64 no-vector configuration:
workloads/linux/spec2006/configs/gcc16-linux-riscv64-rva23u64_novec.cfg
```

For BOOM (`DEFAULT_DTB=boom` or `boom-*`), the default is the GCC 16
RV64GC with Zba/Zbb/Zbs configuration:

```text
workloads/linux/spec2006/configs/gcc16-linux-riscv64-rv64gc_zba_zbb_zbs.cfg
```

It emits RV64GC/LP64D code with Zba, Zbb, and Zbs, without Zbc or V.

For GCC 15, select:

```text
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
####################################################################
# RISC-V Config file for SPEC CPU2006

# Please see http://www.spec.org/cpu2006/Docs/config.html (also available in
# the Docs directory of your SPEC tree) for details on config file setup. The
# config.html page has a list of all of the fields required for a full
# publication ofresults.

#####################################################################
# System Under Test (SUT) Section

# If it affects performance, you need to describe it, either in the
# pre-defined fields or by adding it to the notes section. Replace the
# setting below with the ones that match your machine.

#######################################################################

# Tester Description
test_sponsor = OpenXiangShan
tester = OpenXiangShan

# System Description
hw_model = BOOM Medium
hw_memory = 2 GiB DDR
hw_disk = None
hw_vendor = Institute of Computing Technology, Chinese Academy of Sciences
hw_other = N/A
hw_avail = Dec-9999

# CPU description
# See http://www.spec.org/cpu2006/Docs/runrules.html#cpucount
# for a discussion of these fields

hw_cpu_name = BOOM Medium rv64gc_zba_zbb_zbs
hw_cpu_char =
hw_cpu_mhz = 3000
hw_fpu = Integrated
hw_nchips = 1
hw_ncores = 1
hw_ncoresperchip = 1
hw_nthreadspercore = 1
hw_ncpuorder = N/A

# Cache description

hw_pcache = N/A
hw_scache = N/A
hw_tcache = N/A
hw_ocache = N/A

# Tester description

license_num = 0

# Operating system, file system

sw_os = Linux with OpenSBI firmware boot
sw_file = initramfs rootfs
sw_state = Single-user
sw_other = None

## SW config
sw_compiler = gcc, g++ 16.1.0
sw_avail = Jul-2026
sw_base_ptrsize = 64-bit
sw_peak_ptrsize = 64-bit

#######################################################################
# End of SUT section
# If this config file were to be applied to several SUTs, edits would
# be needed only ABOVE this point.
######################################################################

ignore_errors = yes
tune = base
basepeak = no
ext = riscv_gcc16_base
teeout = yes
teerunout = yes
output_format = asc, csv, html
makeflags = -j64

reportable = yes

default=default=default=default:
#####################################################################
#
# Compiler selection
#
#####################################################################

COMPILER_PATH = ${LLVM_INSTALL_PATH}
JEMALLOC_PATH = ${JEMALLOC_INSTALL_PATH}
GCC_TOOLCHAIN_PATH = ${GNU_RISCV64_PATH}

JEMALLOC_LIBS = -Wl,-u,malloc -L$(JEMALLOC_PATH)/lib -ljemalloc -lm
# jemalloc also exports C++ operator new/delete. Some SPEC C++ benchmarks
# define replaceable allocation symbols in their own objects, so keep
# muldefs enabled for the final static link.
STATIC_LDFLAGS = -z muldefs -static

CC = $(COMPILER_PATH)/bin/riscv64-unknown-linux-gnu-gcc -std=gnu89
CXX = $(COMPILER_PATH)/bin/riscv64-unknown-linux-gnu-g++
FC = $(COMPILER_PATH)/bin/riscv64-unknown-linux-gnu-gfortran

#####################################################################
# Optimization
#####################################################################

int=base=default:
COPTIMIZE = -static -O3 -march=rv64gc_zba_zbb_zbs -ffast-math -flto -ffp-contract=off -fno-tree-vectorize -fno-tree-loop-vectorize -fno-strict-aliasing
CXXOPTIMIZE = -static -O3 -march=rv64gc_zba_zbb_zbs -ffast-math -flto -ffp-contract=off -std=c++98 -fno-tree-vectorize -fno-tree-loop-vectorize -fno-strict-aliasing

EXTRA_LIBS = $(JEMALLOC_LIBS)
EXTRA_LDFLAGS = $(STATIC_LDFLAGS)

fp=base=default:
COPTIMIZE = -static -O3 -march=rv64gc_zba_zbb_zbs -ffast-math -flto -ffp-contract=fast -fno-tree-vectorize -fno-tree-loop-vectorize -fno-strict-aliasing
CXXOPTIMIZE = -static -O3 -march=rv64gc_zba_zbb_zbs -ffast-math -flto -ffp-contract=fast -std=c++98 -fno-tree-vectorize -fno-tree-loop-vectorize -fno-strict-aliasing
FOPTIMIZE = -static -O3 -march=rv64gc_zba_zbb_zbs -ffast-math -flto -ffp-contract=fast -fno-tree-vectorize -fno-tree-loop-vectorize -fno-strict-aliasing

EXTRA_LIBS = $(JEMALLOC_LIBS)
EXTRA_LDFLAGS = $(STATIC_LDFLAGS)

int=peak=default:
COPTIMIZE = -static -O3 -march=rv64gc_zba_zbb_zbs -ffast-math -flto -ffp-contract=off -fno-tree-vectorize -fno-tree-loop-vectorize -fno-strict-aliasing
CXXOPTIMIZE = -static -O3 -march=rv64gc_zba_zbb_zbs -ffast-math -flto -ffp-contract=off -std=c++98 -fno-tree-vectorize -fno-tree-loop-vectorize -fno-strict-aliasing

EXTRA_LIBS = $(JEMALLOC_LIBS)
EXTRA_LDFLAGS = $(STATIC_LDFLAGS)

fp=peak=default:
COPTIMIZE = -static -O3 -march=rv64gc_zba_zbb_zbs -ffast-math -flto -ffp-contract=fast -fno-tree-vectorize -fno-tree-loop-vectorize -fno-strict-aliasing
CXXOPTIMIZE = -static -O3 -march=rv64gc_zba_zbb_zbs -ffast-math -flto -ffp-contract=fast -std=c++98 -fno-tree-vectorize -fno-tree-loop-vectorize -fno-strict-aliasing
FOPTIMIZE = -static -O3 -march=rv64gc_zba_zbb_zbs -ffast-math -flto -ffp-contract=fast -fno-tree-vectorize -fno-tree-loop-vectorize -fno-strict-aliasing

EXTRA_LIBS = $(JEMALLOC_LIBS)
EXTRA_LDFLAGS = $(STATIC_LDFLAGS)


#####################################################################
# 32/64 bit Portability Flags - all
#####################################################################

default=default=default=default:
PORTABILITY = -DSPEC_CPU_LP64

#####################################################################
# Portability Flags
#####################################################################

400.perlbench=default=default=default:
CPORTABILITY = -DSPEC_CPU_LINUX_X64 -std=gnu89

401.bzip2=default=default=default:
CPORTABILITY = -std=gnu89

416.gamess=default=default=default:
CPORTABILITY = -funconstrained-commons
FPORTABILITY = -std=legacy -funconstrained-commons -fno-strict-aliasing

436.cactusADM=default=default=default:
CPORTABILITY = -std=gnu17

462.libquantum=default=default=default:
CPORTABILITY = -DSPEC_CPU_LINUX

464.h264ref=default=default=default:
CPORTABILITY = -fsigned-char

482.sphinx3=default=default=default:
CPORTABILITY = -fsigned-char

483.xalancbmk=default=default=default:
CXXPORTABILITY = -DSPEC_CPU_LINUX -include cstring -Wno-c++11-narrowing -Wno-template-body

453.povray=base=default=default:
CXXOPTIMIZE = -static -O3 -march=rv64gc_zba_zbb_zbs -flto -ffp-contract=fast -std=c++98 -fno-tree-vectorize -fno-tree-loop-vectorize -fno-strict-aliasing

453.povray=peak=default=default:
CXXOPTIMIZE = -static -O3 -march=rv64gc_zba_zbb_zbs -flto -ffp-contract=fast -std=c++98 -fno-tree-vectorize -fno-tree-loop-vectorize -fno-strict-aliasing

481.wrf=default=default=default:
CPORTABILITY = -DSPEC_CPU_CASE_FLAG -DSPEC_CPU_LINUX
FPORTABILITY = -std=legacy -fallow-argument-mismatch

447.dealII=default=default=default:
CXXPORTABILITY = -fpermissive -include cstring -std=c++11

450.soplex=default=default=default:
CXXPORTABILITY = -std=gnu++98

#####################################################################
# Notes
#####################################################################
Loading
Loading