lowRISC / lowRISC/ibex

RVFI CSR support

Open
#2,335 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type:Question
Dominant language
SystemVerilog
Stars
2.1k
Forks
810
Avg merge
5d 23h
Merged PRs (30d)
9

Description

Is there a reason Ibex's RVFI interface doesn't support CSR writes? I'd like to add it so we can trace CSR writes.

Note there appear to be two different approaches:

1. [Give each supported CSR a wire.](https://github.com/SymbioticEDA/riscv-formal/blob/master/docs/rvfi.md#control-and-status-registers-csrs)
2. [Use a vector of wires](https://docs.openhwgroup.org/projects/cv32e40s-user-manual/en/latest/rvfi.html#:~:text=instructions%20have%20retired.-,CSR%20Signals,-To%20reduce%20the). Hard to tell what each index corresponds to.
3. [Use a 4096-element vector of wires!](https://github.com/riscv-verification/RVVI/blob/0043bdf0313670f3e1d6bac3af2d88b52de459d6/source/host/rvvi/rvviTrace.sv#L91)

That last one seems pretty mad. I think the first options is probably best given the relatively small number of CSRs that Ibex has. I'd probably put them in an `interface` to save wiring insanity. Something like:

```
struct rvfi_csr {
logic [31:0] wdata;
logic wvalid;
}

interface rvfi_csrs {
rvfi_csr mstatus;
rvfi_csr mcause;
...
}
```

I don't think there's any need to record CSR reads. I'm not aware of any with read side effects (`seed` almost is but you aren't allowed to only read it). Does that sound reasonable?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked RVFI CSR documentation and compare its named-wire and vector approaches with Ibex's existing RVFI interface. The work is done when the CSR write representation is agreed and CSR writes can be traced through the RVFI interface; the issue names no Ibex files or tests to begin with.

Written by the indexing model from the issue text.

Assessment

Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.