Changelog — v3.0.0¶
Released: 2026-11-09
rvsim runs Linux user programs without a kernel: SE mode loads a static
executable, serves its syscalls against the host and runs its threads, one
per hart, as gem5's SE mode does, with several programs at once and
checkpoints. gem5's m5ops are an instruction that works the same in a
bare-metal image, a user program and a Linux guest. A GDB stub, a Konata
pipeline trace and a commit log complete enough to replay the run on spike
instruction by instruction come with this release, and rvsim's timing is
compared, instruction by instruction, with Chipyard's Rocket and BOOM.
Fixed lists corrections across the privileged, vector and floating-point
ISA, the pipelines and the memory system. The default machine is now a
desktop out-of-order core, every configuration rule and default lives in
the core, and the Python API has typed errors and enums and type-checks
under mypy --strict. Simulation is 16 to 25% faster, cycle for cycle
unchanged, and the package needs Python 3.11.
Breaking changes¶
- Python 3.11. The package needs Python 3.11 or newer.
- Python API. Configuration names are the core's, with the old
spellings refused;
Configtakes keyword arguments only;console=with aConsoleModereplacesuart_quietanduart_to_stderr;Stats.query()takes a regex;Config.coherenceno longer takesNone;initial_spis gone. - Machines and timing.
Config()is a new, larger default machine;presets.m1()is removed andcortex_a72()andp550()move totools/diag/calibration.py;mtimeruns attimebase_hz; ITTAGE, the in-order backend's system instructions and its load forwarding change cycle counts. - Configuration.
clock_hzandclint_dividerare replaced by one clock andtimer; the ISA string lives underisa.string; configurations no machine can have are refused. - Programs and modes. Direct mode and the sim-control device are gone:
a bare-metal image starts as it does under spike and exits through HTIF
or a pseudo-operation. The bundled programs are static Linux user
binaries run under SE mode, with the bare-metal builds in
software/bin-htif. - Checkpoints. The format is numbered from 1; older checkpoints do not restore.
- Rust API. Program counters are
VirtAddr, andConfig::default()is the Python API's default machine.
Added¶
SE mode¶
- SE mode runs a static Linux user program without a kernel: the simulator
loads the ELF, builds its page tables (Sv39 by default,
page_modeselects Sv48 or Sv57) and stack, runs it in user mode and serves its syscalls against the host, as gem5's SE mode does, so anything built with a Linux toolchain and linked-staticruns unchanged:python -m rvsim ./prog -- args, orEnvironment(binary, args=[...], env=[...]). A syscall costs the pipeline a flush and nothing else.make se-verifychecks the output and exit code of a set of programs, and Embench-IoT withEMBENCH=1, againstqemu-riscv64. See SE mode. - SE mode needs a Unix host, Linux or macOS. On Windows a user program is refused with an error saying so; bare-metal images and full-system runs work there as before, and CI now checks that the crates build on Windows and macOS.
- SE mode loads static position-independent executables (
-static-pie), placing one at the address static executables are linked at; only dynamically linked programs are refused.make se-verifychecks a static PIE against qemu with the other check programs. - Checkpoints work in SE mode: the process's mappings, break and heap are
saved with the hart and RAM, and a run restored from one finishes as
the uninterrupted run does. A checkpoint is refused while the program
has a host file open, since the descriptor would not come back. The
HTIF device's
fromhostis saved too. - SE mode runs threads, as gem5's SE mode does:
clonestarts a thread on the lowest-numbered free hart, where it stays, one thread per hart with no time-slicing, and fails withEAGAINwhen no hart is free, so a static pthreads program runs with--harts NorConfig(hart_count=N). Threads share their process's memory, heap, mappings and descriptors;futexwaits park a hart until a wake or a timeout in simulated time;exitends one thread and wakes its joiner,exit_groupand faults end the process;gettid,set_tid_addressandsched_getaffinityare served; unmapping memory makes the other threads drop their translations, as a TLB shootdown does.kill,tkillandtgkillreach the process they name, signal 0 only checks that it exists, and signals ignored by default do nothing. Checkpoints carry the threads. - SE mode runs several programs at once, one per hart, as gem5's
se.py -n N --cmd "a;b"does:Simulator(programs=[Program(...), ...])orpython -m rvsim a.elf --program "b.elf arg". Each program has its own address space from the shared RAM and sees the memory system the configuration shares; the run ends when the last exits, with the first non-zero exit code in hart order, andSimulator.exit_codesholds each program's exit code, in the order the programs were given. A program'sgetpidis 1, 2, ... by hart. Checkpoints carry every program. - SE mode answers
/sys/devices/system/cpu/online,possibleandpresentfor the simulated harts, as gem5 does, where the host's files showed through:sysconf(_SC_NPROCESSORS_ONLN)andget_nprocs()return the hart count, so a program that starts a thread per CPU starts one per hart. - SE mode answers
riscv_hwprobeas the 6.6 kernel itsunamereports would, from the hart's ISA string: F/D, C, V, Zba, Zbb and Zbs, and whether misaligned accesses are fast. A static glibc program under SE now selects the same routines it would under Linux on rvsim, and the unimplemented-syscall warning every such program logged at start-up is gone. make se-verifyalso compares a static pthreads program withqemu-riscv64: a contended mutex, a condition variable, a barrier, thread-local storage, joins and a timed wait, on five harts.tools/se/verify.py --programs GLOB --harts Nruns threaded programs of one's own.- A multithreaded bundled program,
raytracer_mt: a scene of spheres over a checkered floor, with shadows and a reflection bounce, its rows shared out between N threads (one per CPU by default), printed with the cycles the render took. On the configuration calibrated to the P550 it renders in 1.31 M cycles on one hart, 0.70 M on two, 0.37 M on four and 0.24 M on eight. Threaded programs live inexamples/programs/threadedand build for SE mode only;make se-verify BUNDLED=1compares it with qemu on four threads.
Pseudo-operations¶
- Pseudo-operations are an instruction: gem5's m5op (opcode
0x7b, the operation in bits 31:25, arguments ina0anda1), performed when it retires in any mode and at any privilege, so onervsim.hserves a bare-metal image, a user program under SE mode and a program inside a Linux guest, and a binary instrumented with gem5's libm5 runs unchanged:m5_exit,m5_fail,m5_reset_stats,m5_dump_stats,m5_dump_reset_stats,m5_checkpointand the work markers.regions.elfis a Linux user binary again. See Pseudo-operations. - More of gem5's m5ops:
m5_rpns(rvsim_time_ns()inrvsim.h) gives the simulated time in nanoseconds,m5_sumadds its arguments,m5_debug_breakandm5_switch_cpustop the host's run, andm5_panicends it with exit code 1. - gem5's
readfileandwritefilepseudo-operations (m5_read_file,m5_write_file;rvsim_read_fileandrvsim_write_fileinrvsim.h): a guest reads the host's script file into its memory and writes a file into the host's output directory, named bySimulator(script=..., outdir=...),Environment(script=, outdir=)or--scriptand--outdir. They retire like a syscall in SE mode, reach the program's memory through the hart's own translation, and return a count or a negatederrnoina0, in a bare-metal image, a user program and a Linux guest alike. See Pseudo-operations.
Debugging and tracing¶
- A GDB remote stub:
python -m rvsim prog.elf --gdb 1234waits for GDB andSimulator.gdb(port)serves it from wherever a run is. Breakpoints are stops at a PC, so no guest code is patched; a step retires one instruction; registers include the floating-point registers and the common CSRs by name; memory is read and written through the selected hart's translation; each hart is a thread; Ctrl-C interrupts; the guest's exit ends the session with its code. A stop drains the pipelines as a hardware halt does, so a debugged run takes more cycles (Debugging with GDB). - GDB watchpoints:
watch,rwatchandawatchstop once a load or store to the range has retired, as a hardware trigger with "after" timing does, and GDB shows the old and new values. - A pipeline trace for Konata:
python -m rvsim prog.elf --pipeline-trace out.kanata, orSimulator.open_pipeline_trace(path)around the part of a run to look at, writes where every instruction is each cycle in the Kanata log Konata displays, on both backends, squashes included. The pipeline reports to aPipelineTracetrait, so another viewer's format is another implementation. See Pipeline trace.
Checking against references¶
Simulator.open_commit_logwrites what a reference model needs to replay the run: the architectural state the log starts from, each retired instruction's privilege mode, destination register, the CSR it wrote (as read back), the FP flags it raised and its load or store (virtual and physical address, size and value), and each trap taken. A vector instruction's line also gives each vector register it wrote, with the bits it filled under a tail- or mask-agnostic policy, and each element it loaded or stored. An FP destination was logged as anxregister.- Each commit-log line ends its header with
cycle <n>: the cycle the instruction retired in, or the cycle a trap was taken in, so the log doubles as a retire trace that lines up against an RTL core's (#177). make lockstep(tests/conformance/lockstep.py,make lockstep-smokefor the smoke configs) replays rvsim's commit log on spike one instruction at a time for every riscv-test, program, benchmark and RVV test on every single-hart pipeline config, and stops at the first instruction whose PC, privilege mode, destination, vector registers, CSR write, FP flags or memory access differs. Values the ISA leaves to the implementation (counters, timers, IDs, device reads, interrupt arrival, WFI wake-up, lost reservations, agnostic vector elements) are taken from rvsim's log. The driver istools/lockstep/spike_lockstep.cc, built against the pinned spike.make test-allruns it; the smoke run does not.- The commit log records memory written from outside the harts (HTIF's
syscall results, virtio DMA, the SE host's syscalls) as
core 0: host write 0x<paddr> 0x<bytes>lines before the next instruction, so a reference model replaying the log sees every value a load reads.make lockstepchecks the bare-metal builds of the bundled programs, and they all pass on the smoke configurations; the bare-metal link script gives.tohosta page of its own, as riscv-tests do. - The HTIF device serves the syscall protocol spike's proxy (fesvr) and
Chipyard's harness speak: a bare-metal program hands the host an
eight-word block through
tohost, the host performs the call (the file calls,writeto the console,getmainvarsfor the arguments it was run with) and answers throughfromhost.make softwarenow also builds every bundled program with an HTIF start-up and libc intosoftware/bin-htif, so one ELF prints and exits the same way on rvsim, spike and the RTL simulators (#205). make rtl-buildbuilds Chipyard 1.14.0's Rocket and Medium BOOM V4 as Verilator simulators andmake rtl-compare RTL_CORE=rocket|boomlines rvsim's retire timing up with theirs instruction by instruction;tools/diag/rtl_probe.pymeasures one mechanism at a time on either. Error against Rocket and Error against BOOM record the results and what each remaining difference is (#177).
Models and configuration¶
BranchPredictor.Bhtis Rocket's branch history table: a table of one- or two-bit counters indexed by the fetch PC with a hash of the global history placed above the PC bits, advanced, rebuilt and reset as rocket-chip'sBHTis. Therocketpreset uses it in place of the fixedGShare, which indexed two nearby branches to one counter half the time and mispredictedbr_random's loop branch as often as its random one (#222).fetch_decode_latency,decode_rename_latencyandrename_issue_latencyset the front end's depth, which was fixed; the defaults keep it. A mispredict, a trap and an MRET cost what the configured depth implies, so therocketpreset, which collapses decode and rename into Rocket's ID stage and issues the cycle after it, pays Rocket's three cycles for a mispredict rather than nine (#213).csr_squashandfence_squashsay which CSR accesses and whether a FENCE squash the instructions fetched behind them, as the modelled core's decoder has it; the defaults keep gem5's behaviour (every CSR access on the in-order backend, none on the out-of-order one). Therocketpreset squashes after writes to the CSRs Rocket'swrite_flushnames and never after a read; theboompreset after every CSR instruction and every FENCE, which BOOM commits withflush_on_commit(#212).- A run fails when a hart outside WFI retires no instruction for
Simulator.stall_limitcycles (1,000,000 by default;Noneturns the check off), with an error naming the hart and its PC, instead of running a stuck pipeline to the cycle limit. - The generated device tree advertises every extension the hart
implements, not just
misa's letters:riscv,isanames Zicbom, Zicboz, Zicntr, Zicsr, Zifencei, Zihintpause, Zihpm, Zfh, the Zb and Zbk families, the Zvb and Zvk families, Zvfh,zvl<VLEN>b, Sstc and Svadu as the configuration has them, theriscv,isa-baseandriscv,isa-extensionspair says the same for kernels that prefer it,riscv,cbom-block-sizeandriscv,cboz-block-sizecarry the block size Linux needs before it uses the cache-block instructions, andmmu-typefollowspaging_mode_maxinstead of always saying Sv39. A Linux guest now enables its Zbb string routines and reports the extensions throughhwprobe, so glibc picks the matching routines (#76). sim.harts[n].vmem32andvmem64read through hartn's page tables;sim.vmem32andvmem64are hart 0's, as before.- Every CSR the simulator implements has a name:
sim.csrs[...],rvsim.csr(which gainsMCOUNTINHIBIT, the vector CSRs, the trigger CSRs and the rest) and GDB's target description all read one table in the core. A CSR address beyond 12 bits raisesKeyErrorrather than wrapping.
Documentation¶
- A Coming from gem5 guide: what each gem5 habit, from
se.pyandO3CPUparameters to m5ops, checkpoints, CPU switching and O3PipeView, maps to in rvsim, and what rvsim does not do. - A Validation page: every check rvsim runs against spike, qemu, gem5, the Rocket and BOOM RTL and measured hardware, what each compares, how often it runs, and where its numbers stand.
Changed¶
Python API¶
- rvsim needs Python 3.11 or newer, and its wheels are built for 3.11's stable ABI.
- Errors have classes:
rvsim.SimulationError, aRuntimeError, is the base ofLoadError(a program that cannot be read or loaded),CheckpointError,KernelPanicandStalled, and an invalid config raisesConfigError, aValueError. A checkpoint file that cannot be opened raises the matchingOSError, such asFileNotFoundError, andrun_until()with no condition raisesTypeError. run_to()returns arvsim.StopReasonin place of a string,gdb()returns arvsim.DebugEnd, andprivilegeis arvsim.Privilege. Each is aStrEnumequal to the string it replaces, so comparisons such asreason == "exit"andprivilege == "U"still hold andstr()gives the string.- The native stats class is
rvsim._core.StatsTree, sorvsim.Stats, the dictStats.from_corebuilds, is the package's onlyStats. Stats.query()takes a regex and raisesre.errorfor an invalid one, where it fell back to a substring search.Config(console=...)is the one console setting, arvsim.ConsoleMode(STDOUT,STDERR,QUIET,CAPTURED) or its name as a string;uart_quietanduart_to_stderrare gone (useconsole="Quiet"andconsole="Stderr"), and an unknown mode raisesValueError.- The package type-checks under
mypy --strict, and its stub and annotations say what the runtime does:Fu.VecIntAluand the other vector units are declared (they were attached at import time), aStatsTreecan be subtracted from another, andRegion.statsis aStatsTree. TheFuunit types are dataclasses, so two units with the same count and latency compare equal. Config.coherenceis always aCoherence; it no longer takesNone.load_config()raisesTypeErrornaming the file when its entry point gives something other than aConfig, which used to fail later, inside the simulator.Configtakes keyword arguments only, andConfig.replace()reports an unknown field asConfig.__init__()does.
Configuration¶
- Configuration names are the core's, in Python and in the dicts it
sends, with no aliases or second spellings:
BranchPredictor.Tage,Cache.Nine,MemoryController.DramandMemoryController.Ddr5,ReplacementPolicy.Lru,Plru,FifoandMru; paging modes"Bare"to"Sv57"; DDR5 speed bins"Ddr5_4800B"and"Ddr5_5600B"; consoles"Stdout","Stderr","Quiet"and"Captured"; vector store forwarding"ByteMask","Stall"and"Off"; TAGE rules"TageBase"and"Cbp5", history"Direction"and"PcBits", and hashing"TageBase"and"TageScL"; andpresets.linux()'smemory("Ddr5","Dram") andinterconnect("Mesh"and the rest), with the--memory,--interconnectand--speed-binflags ofrvsim benchandtools/boot_linux.py. A cache with no prefetcher names itOff, asPrefetcher.Off()does. The old names are refused. - Every default of the Python API comes from the core:
Config()reads the core's default machine, and each builder the default of its component, throughrvsim._core.component_defaults(), so no default is written in Python. A configuration's dict names only what its Python objects model, under the core's names, and the core fills in the rest; every machine is unchanged, cycle for cycle.Backend.InOrder()takes the ROB, store buffer, load and store ports and vector store buffer the in-order backend reads, which were fixed. Config()asks the core to check the configuration as it is built, and every rule lives in the core: the Python builders no longer check their own arguments, soCache(mshr_count=0)or an unknown TAGE rule is refused when it goes into aConfig, by the core's message naming the field.- A config dict the core cannot read names the field at fault, as in
Invalid config at system.console: unknown variant ..., instead of a column in the JSON it was sent as. - Building a simulator refuses configurations no machine can have, with a
ValueErrornaming the field, where they used to hang, crash or quietly build another machine: zero widths, queues, ports, TLBs, clocks or harts; an out-of-order register file with no register to rename into; a unit pool missing a unit the ISA needs; caches that are not a whole number of sets, have lines of different sizes or more PLRU ways than it tracks; TLBs, stride-prefetcher tables, DRAM rows and buses whose sizes are not powers of two; RAM overlapping a device or too small for the kernel offset; predictor tables too large to allocate; and latency overrides naming no device. The rules are listed in Configuration. Each device's register window is defined once, in the system config the bus, the device tree and the checks read. - Rust's
Config::default()is the Python API's default machine, andConfig::minimal()the machine every component's own default makes up: one-wide and in order, with no caches and fixed-latency memory, which the Rust tests start from. The configuration types serialize as well as deserialize, andrvsim._coregainsdefault_config(),minimal_config()andcheck_config(), which return those machines and a checked, complete configuration as dicts. The SE thread tests also run on the default machine. - One clock:
cpu_clock_mhznow also sets SE mode's time andm5_rpns, andclock_hzis gone.clint_divideris replaced bytimer("RealTime", the default, ticksmtimeattimebase_hz, which the device tree reports;"EveryCycle"ticks it every cycle) andtimebase_hz(default 10 MHz). The default machine'smtimetherefore runs at 10 MHz rather than every tenth cycle, androcket(),boom()and the calibrated configs report SE time by their core clock rather than 1 GHz.presets.linux()boots exactly as before in both modes. Config(), and Rust'sConfig::default(), is a desktop out-of-order core of the mid-2020s: 6 wide at 4 GHz with a 320-entry ROB, 128-entry issue and load queues, a 72-entry store buffer, 224 integer and 192 FP physical registers, three load and two store ports and the 64KB TAGE-SC-L; a 32 KiB L1I, a 48 KiB L1D (5-cycle load-to-use), a 1 MiB L2 (14) and a 32 MiB L3 (50), all PLRU, with next-line, stream, load and store prefetchers; a 2048-entry L2 TLB; VLEN 256; and two channels of DDR5-5600 (81 ns). It was a 4-wide core with TAGE, 32 KiB L1s, a 256 KiB L2 and fixed-latency memory.Fu()and each unit's defaults are its pool, andBackend.InOrder()defaults to a dual-issue core's pool.presets.basic()is stillConfig(). The default machine joins the conformance matrix and its smoke set.Config(isa=...)names the whole ISA, multi-letter extensions included, andmisa, the decoder and the device tree follow it: withisa="rv64gc"aclzis an illegal instruction and the tree names no Zbb, as on a core without it, where before every extension executed whatever the string said. The string is spelt as-march, spike's--isaand/proc/cpuinfospell it,GandBexpand, the vector crypto groupszvkn,zvksand theirc/gforms stand for their members, an unknown name is refused, andConfig().isa_string()gives the resolved string (everything, by default) to derive variants from. The native config'spipeline.misa_overridekey is gone; the string lives underisa.string(#77).- The
cortex_a72()andp550()presets move totools/diag/calibration.py, beside the latency probe and the Linux benchmark runner that compare them with the hardware they are fitted to; their structure sizes are published and their latencies measured, but neither core's design is, so they are not offered as models of those cores.--presettakesbasic,fast,rocketandboom; the conformance matrix runs the two calibrated configurations as before. presets.m1()is removed: only its cache sizes came from Apple's core, so it modelled no core in particular. The conformance matrix runs 72 configurations.- The Linux session example switches a booted session onto the in-order
backend: switching it onto
p550()failed, since a switch keeps the guest's VLEN and misaligned-access behaviour.
Programs and modes¶
- Direct mode is gone. It was an rvsim-only way to run a bare ELF:
identity translation, a preset stack pointer, the FPU switched on at
reset,
a1holding the hart count and anecall 93ending the run with no trap handler installed. A bare-metal image now starts as it does under spike: every hart at the ELF's entry in machine mode with its id ina0and a device tree describing the system ina1, placed in the last 64 KiB of RAM; the program's start-up sets its stack and switches the FPU on (software/libc/crt0_htif.sandcrt0_smp.sdo), and it exits through HTIF or a pseudo-operation. The bare-metal libc prints through HTIF only, and the multi-core programs take their hart count from the device tree and share the HTIF channel under a lock.Config(initial_sp=...)is gone with it, and thedirect_modeandinitial_spkeys of the native config. - A user program's stdin, stdout and stderr, and the console HTIF's
syscalls serve, are the simulator's console:
console="Quiet"and"Captured",read_console(),write_console()and the Session API's console stops apply to them as they do to the UART, instead of the output going straight to the host's stdout. Input goes to the UART until a program that talks to the host directly is loaded. The console answersTCGETS2as well asTCGETS, so glibc 2.42'sisattyholds and a user program's stdout is line-buffered, as on a terminal. - The bundled programs and benchmarks are static Linux user binaries
built with the glibc toolchain and run under SE mode, as a gem5 user
would run them;
software/bin-htifkeeps the bare-metal build. The bare-metal libc now implements a subset of C's stdio and stdlib (fgets,fflush,exit,int printf) instead of its own API, and a user program reads the cycle and instruction counters without trapping.bench.handrvsim.hmoved tosoftware/include. - The sim-control MMIO device and its
sim_control_basesetting are gone: the pseudo-instruction is the one way a guest talks to the simulator. - The Linux image's
rvsimtool issues the pseudo-instruction instead of writing the sim-control device through/dev/mem, and gainsrvsim readfileandrvsim writefile FILE [NAME], like gem5'sm5. - The Linux image sets
kernel.perf_user_access = 2, sordcycleworks from user space on Linux 6.6. - The Linux image's Buildroot configuration lives in
software/guest/buildroot.defconfig, with a kernel fragment,software/guest/linux.fragment, that states the vector, Zicbom, Zicboz and perf options instead of relying on the kernel's default.
Timing¶
- The in-order backend no longer holds a system instruction in issue until
it is the oldest. A CSR access, ECALL, MRET, WFI, FENCE.I and SFENCE.VMA
issue in order and take effect when they retire: the CSR is read and
written at the head of the ROB, where every older write has been
applied, as Rocket's WB does and as gem5's MinorCPU executes at commit,
and the squash a CSR access, fence or MRET causes is taken from commit
rather than from execute (#216). A CSR read's dependent now waits for
the read to retire.
csr_squash="Never"needs the out-of-order backend's rename hold and is rejected on the in-order one. - The in-order backend forwards a load's value to a dependent the cycle memory2 delivers it, as it already did a unit's result and as Rocket bypasses its D-cache response into the next instruction's execute, so a dependent load costs the L1D latency plus one cycle rather than two (#210). Every in-order cycle count moves.
misa.Bis set (#174): every hart implements Zba, Zbb and Zbs, so B now says so, whateverConfig(isa=...)names, and the device tree'sriscv,isagains ab(rv64imafdcbv_sstcby default).isaacceptsB.
Performance¶
- Simulation is faster with every result unchanged, cycle for cycle: a two-hart Linux boot runs 25% faster, and a program under SE mode 16% on the out-of-order backend and 18% on the in-order one. The DDR5 controller, the branch predictor's history, the issue queue, the ROB's ordering checks, the TLB, the interrupt controller and the coherence network do less work each cycle, and the pipeline reuses its buffers.
Rust API and checkpoints¶
- Rust API: program counters are
VirtAddrrather thanu64:Hart::pc,Simulator::set_pc,StopAt::pcs,Simulator::pc_trace,SimError::Stalled, the pipeline snapshot and trace, the branch and store-set predictors andGeneralConfig::start_pc. Python still takes and returns plain integers. - The checkpoint format is numbered from 1; checkpoints written before it do not restore.
Fixed¶
- ITTAGE's shortest banks see their history. Each bank hashed its PC with two folds of its history whose XOR cancelled when the history fitted in both, so the default ITTAGE's 4-bit bank indexed and tagged by PC alone and its 8-bit bank tagged by PC alone. The narrower fold is now shifted, as Seznec's TAGE forms its tags, so every TAGE-SC-L run's indirect predictions, and with them its cycle counts, move.
- An ITTAGE history longer than the 1024 bits the global history register holds is refused when the configuration is checked, rather than panicking as the predictor is built.
- Fixes in the pipelines: a load still waiting on memory when a trap
flushed the pipeline no longer completes, where in the out-of-order
backend it wrote the physical register the trap handler had been
given; a load reads the youngest older store to its bytes whichever of
the scalar and vector store buffers holds it; and a register written
from Python (
regs[n] = v) reaches the next instruction on the out-of-order backend. - Privileged-architecture fixes: SFENCE.VMA traps in U-mode; CSRRS and
CSRRC with a non-x0
rs1are writes whateverrs1holds, so they trap on read-only CSRs and dirtymstatus.FSforfflags;hpmcounter3tohpmcounter31exist behindmcounteren/scounteren; PMP checks a translation that needed a page walk over the access's own bytes; a locked TOR entry locks thepmpaddrbelow it; and an illegal compressed instruction'smtvalholds its own 16 bits, not its expansion. - Vector fixes: mask and whole-register loads and stores are not aligned
to LMUL, and whole-register ones are aligned to their register count;
every vector instruction leaves
vstartzero;vsetvlsetsvillfor reservedvtypebits and for SEW wider than the configured ELEN; undervillvtype-dependent instructions trap while whole-register loads, stores and moves run; FP instructions at a floating-point width the unit lacks, such as SEW=8, trap instead of writing zeros; andvfwcvt.f.x[u].vandvfncvt.x[u].f.wconvert between 8-bit integers and f16 under Zvfh and between 16-bit integers and f32 without it. - Memory-system fixes: a cache whose full MSHR was re-issued for data after losing its upgrade no longer stays blocked after the fill; FIFO replacement evicts by insertion order, ignoring hits; and the PLIC holds a claimed level-triggered source until its claim is completed.
- On the O3 backend a vector load could read memory from before an older
vector store whose element addresses resolved after the load ran (#184).
The load's micro-ops gave up their load-queue slots as they wrote back,
so the store's ordering check missed them. A vector load now reserves its
slots at rename, one per micro-op it expects (an element, or a window of
an aligned unit-stride access), and its micro-ops hold them until it
commits. A load with more micro-ops than slots (an oversize load, a
misaligned unit-stride load, a span split at a fault) reuses its slots
once no older memory access is in flight. Lockstep against spike stopped
on this in the RVV
vsoxei16andvsseg2e32tests. - A vector instruction with
vstart≥vlupdated its destination (#183): a reduction with vl=0 wrotevs1[0]intovd[0], and element-wise ops filled their tail with ones under a tail-agnostic policy. The vector spec says no destination element, agnostic or not, is updated then. Now none is, except by the instructions that still execute: those writing anxorfregister and the whole-register moves. - Half-precision arithmetic, scalar (Zfh) and vector (Zvfh), raised the
invalid flag only for a signaling-NaN operand (#178). It now also raises
it for ∞ − ∞ in an add or subtract, 0 × ∞ in a multiply, and both in a
fused multiply-add, where 0 × ∞ is invalid even with a quiet-NaN addend.
rv64uzfh-p-faddfailed on this; the riscv-tests runner now runs therv64uzfh,rv64uzba,rv64uzbb,rv64uzbcandrv64uzbssuites, which were built but never run. - The vector widening FP operations dropped the invalid flag for a
signaling-NaN operand (#182):
vfwadd,vfwsubandvfwmul(and their.wforms) at SEW=32 and 16, andvfwredusum/vfwredosumat SEW=32. The host conversion of the operand to the wider format raised it before the flags were cleared. The widening FMAs worked only because of where the compiler placed that conversion. All of them now check their operands. - RMM (round to nearest, ties to max magnitude) rounded ties to even,
scalar and vector, because the host FPU has no such mode (#179). An
inexact RMM result is now rounded again in software from the operation's
exact value. The software rounding (
exec/compute/fpu/exact.rs) is property-tested against the host in the four modes the host has. The half-precision FMAs, scalar and vector, and the Zvfh widening FMA rounded twice (to binary64, then to the result format) in every mode, and now round once. The Zvfh widening add, subtract and multiply lost the flags of their final rounding to binary32 (#180). - The single- and double-precision fused multiply-adds, scalar and
vector, raise the invalid flag for 0 × ∞ with a quiet-NaN addend, as
RISC-V requires; only half precision did.
vfncvt.rod.f.f.wraises the flags its rounding does, inexact included, where it raised none at SEW=32 and dropped inexact at SEW=16. The full lockstep sweep against spike stopped on both. - The vector float-to-integer conversions at a 16-bit width,
vfwcvt.x[u].f.vat SEW=16 (f16 to 32-bit integer) andvfncvt.x[u].f.wat SEW=16 (f32 to 16-bit integer) and theirrtzforms, truncated whateverfrmsaid and raised NV only for a NaN (#181). They now round infrm(thertzforms toward zero) and raise NX for an inexact result and NV for one out of range, as the 32- and 64-bit conversions do. - A
pmpaddrregister kept all 64 bits written to it, so bits 63:54 read back as written (#170). On RV64 they read as zero; only bits 53:0 (physical address bits 55:2) are kept now. - Debug triggers read
tdata1'smcontrolfields from the wrong bits: M, S and U at 13, 11 and 10 and execute, store and load at 9, 8 and 7, where the debug spec puts them at 6, 4 and 3 and 2, 1 and 0 (#171). A trigger written by software that follows the spec, such as a debugger's breakpoint, came back disarmed. The fields are now where the spec puts them. - Writing
satpwith a MODE the hart does not support, or one abovepaging_mode_max, set MODE to Bare and kept the written ASID and PPN (#172). The privileged spec says such a write has no effect, and now it has none. - A load or store trigger's breakpoint set
mtvalto the instruction's PC (#176). The privileged spec gives the faulting virtual address, which for a data trigger is the address accessed; it does now, and a CBO's trigger reports the address its other faults report. - FENCE.I's invalidation of the L1I now reaches the fetch buffer, the copy of the line the I-cache last returned, so the instructions after a FENCE.I refetch through a miss, as Rocket's and BOOM's do (#211). A FENCE.I's cost grows by an L1I miss.
run_to(pc=...)and the Session API'sPcstop land exactly on the address: an out-of-order core no longer retires the instruction there in the same cycle as the ones before it, which could carry a run past the stop.- SE mode's
madviserefuses advice Linux 6.6 does not know, as that kernel does, so glibc 2.42 guards a thread's stack withmprotectrather than taking a guard it never got. - The Session API's fast-forward cache keys checkpoints on the simulator build as well, so a boot cached under one build is never restored under a later one whose guest would have seen a different device tree or ISA.
Simulator.vmem32andvmem64walk the page tables without filling the TLBs, so reading guest memory from Python no longer changes what the hart's translation caches hold.- The
vec_stressexample's masked-operations check failed on rvsim (#173): it used the mask-agnostic__riscv_vadd_vv_i64m2_m, whose inactive elements may be all ones, as rvsim makes them, and expected them to holdva. It now uses the mask-undisturbed form withvaas the merge operand.