Skip to content

Add ACT4 user-mode architectural test coverage for RV32IMAF(C) #730

Description

@cyrilmhansen

Summary

I have an experimental ACT4 bring-up for rv32emu user-mode RV32IMAF(C), currently staged in my fork:

cyrilmhansen#2

The branch adds ACT4 runner integration and fixes conformance issues exposed by the generated tests.

What This Covers

The default passing ACT batch is:

I,M,F,Zicsr,Zicntr,Zifencei,Zca,Zcf,Misalign,MisalignZca,Zaamo

Current local result:

ACT runner: 182/182 passed

The branch intentionally excludes Zalrsc for now because Zalrsc-sc.w still needs separate investigation.

Bugs Found By ACT4

ACT4 exposed several issues:

  1. x0 can be clobbered through interpreter execution and constant propagation.
  2. RV32F CSR handling is incomplete:
    • frm is not handled as a CSR.
    • fflags accesses do not preserve/mask the packed fcsr fields correctly.
    • dynamic rounding reads use an incorrect mask.
  3. The ACT runner previously executed stale ELFs from earlier extension batches, so targeted runs like ACT_EXTENSIONS=F could fail because of unrelated generated tests.

Performance Note

The x0 fix currently uses a conservative interpreter repair after each instruction plus constant propagation pinning. This is correct and makes ACT pass, but it is on a hot path. It may be worth reviewing whether upstream prefers:

  • keeping the conservative repair,
  • replacing it with a lower-overhead per-opcode/rd audit,
  • or gating optimizer-sensitive behavior in the architecture-test config.

The FP CSR fix should not be gated; it is architectural correctness rather than an optimization tradeoff.

Licensing

The ACT4 checkout is kept as a submodule rather than vendoring the test suite into rv32emu.

The local ACT tree documents:

  • code under BSD-3-Clause or Apache-2.0
  • documentation under CC-BY-4.0

So vendoring appears possible with the usual notice/attribution obligations, but a submodule is cleaner and avoids importing a large mixed-license test framework directly.

Validation

Validated locally:

PKG_CONFIG=/usr/bin/pkg-config make -j4

tools/run-act-elfs.sh build/rv32emu-user build/act/rv32emu-rv32imafc/elfs I,M,F,Zicsr,Zicntr,Zifencei,Zca,Zcf,Misalign,MisalignZca,Zaamo

Result:

ACT runner: 182/182 passed

Also validated targeted FP run:

tools/run-act-elfs.sh build/rv32emu-user build/act/rv32emu-rv32imafc/elfs F

Result:

ACT runner: 78/78 passed

Follow-Up Work

  • Investigate Zalrsc-sc.w.
  • Decide whether the x0 repair should be optimized before merging.
  • Decide whether upstream wants ACT4 wired into CI or kept as a documented local/manual target first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions