Skip to main content

Module oracle

Module oracle 

Source
Expand description

Offline RISC-V oracle: run a Program on the golden model (Spike) and read back its final register file as the crate::SIG_BYTES-byte signature. Used by the mint binary to produce committed golden vectors — never a build/CI dependency (CI replays the committed vectors, it does not run Spike).

We drive spike -d with a command file (no ELF symbols, no HTIF): materialize the initial registers, run to the end of the body (the signature epilogue is excluded — it stores to SIG_BASE, which is below Spike’s DRAM; Spike reads the registers directly instead), then print each captured register. The materialization + body is loaded as the single segment of a hand-emitted ELF (no external assembler/linker needed — we already have the instruction words). The model runs as the RV64I superset; the generator never names x16–x31, so the extra registers are irrelevant.

Constants§

SPIKE_ISA
ISA string (RV64I superset of PVM2’s compute core).

Functions§

slot_to_xreg
Slot index (0..=12) → RV x-register number (inverse of reg_slot_or_ff).
spike_signature
Run prog’s body (body + signature epilogue, no terminator — the epilogue is stripped: it stores to SIG_BASE, below Spike’s DRAM) on Spike and return its final register file as the SIG_BYTES-byte signature (one LE u64 per captured slot, in SIG_XREGS order). Errors if Spike is missing or its output can’t be parsed.