Investigating RVVI, the RISC-V Core Verification Interface (2. The Trace Interface RVVI-TRACE)

I've been investigating RVVI, a verification environment for RISC-V cores. First, I'll look into RVVI-TRACE, which carries the trace data information from the DUT.

The actual interface is defined in rvvi-trace.sv in the GitHub repository.

https://github.com/riscv-verification/RVVI/blob/main/source/host/rvvi/rvvi-trace.svgithub.com

I wonder if Verilator can handle this too?

Let's decipher various things from this Verilog file.

Parameters Defined in the RVVI-TRACE Interface

Parameter Name Description
ILEN Maximum allowed instruction length in bits. The default was ILEN=32. So does that mean both 32-bit and 16-bit instructions are accepted?
XLEN Maximum allowed general-purpose register size (in bits).
FLEN Maximum allowed floating-point register size (in bits).
VLEN Maximum allowed vector register size (in bits).
NHART Number of HARTs reported by this interface.
RETIRE Maximum number of instructions that can retire during a valid event. This is probably the number of instructions that can complete simultaneously, and I assume the interface gets wider as it increases.

The RVVI-TRACE Interface

This interface provides internal visibility into the state of a RISC-V device. All signals on the RVVI interface are outputs from the device, intended for observing state transitions and state values.

  • clk: The RVVI trace interface is synchronized to clk. It synchronizes on the rising edge.

  • valid: When this is 1, an instruction has retired or a trap has occurred. Accordingly, this involves updates to the GPR, FPR, VR, CSR, and so on. The address of the instruction at the time it retires is given by pc_rdata.

  • order: The number of retired instructions. I wonder whether this is cumulative.

  • insn: The machine code of the retired instruction.

  • trap: When this signal is 1, an exception such as a trap has occurred. When it is 0, it indicates that the instruction retired normally.

  • halt: When this signal is 1, it means that the HART in question has halted.

  • intr: When this is 1, it indicates that this is the first retired instruction of a trap handler.

  • mode: Indicates the operating mode (machine mode, supervisor mode, or user mode).

  • ixl: Indicates the XLEN in the given execution mode.

  • pc_rdata: The address of the instruction that trapped or retired

  • pc_wdata: The address of the first instruction after the trap or retirement

  • x_wdata, x_wb: Write information for the general-purpose registers. When x_wb[i] is 1, it means that GPR[i] has been written, and the written data is appended to x_wdata.

  • f_wdata, f_wb: Write information for the floating-point registers. When f_wb[i] is 1, it means that FPR[i] has been written, and the written data is appended to f_wdata.

  • v_wdata, v_wb: Write information for the vector registers. When v_wb[i] is 1, it means that VPR[i] has been written, and the written data is appended to v_wdata.

  • csr, csr_wb: CSR update information.

  • lrsc_cancel: When this signal is 1, it indicates that the reference model must clear the current LR/SC reservation after the current instruction completes.


This is an English translation of the original Japanese post: RISC-Vコアの検証インタフェースRVVIについて調べる (2. トレースインタフェースRVVI-TRACE)