Formal semanticsmodels RISC-V

riscv-coq (MIT RISC-V specification in Rocq)

Also known as riscv-coq, coq-riscv

A RISC-V model in Rocq (formerly Coq) from MIT, written for proofs rather than as a full reference. It is the target machine of the bedrock2 verified compiler and of MIT's end-to-end verified embedded system.

Stage 0 · Mechanized Written in Rocq Open source · BSD-3-Clause v0.0.6 · 14 months ago

What it covers

Models
RISC-V, No ISA manual version is stated.
Fragment
RV32I and RV64I with the M extension and part of Zicsr (CSR instructions). A and F instructions are decoded, but the main execute function treats them as unsupported. No compressed (C), vector or floating-point execution. Address translation is left abstract.
Written in
Rocq
Usable in
Rocq
Validation
Most of the definitions were generated with hs-to-coq from MIT's Haskell riscv-semantics, which the paper reports running on parts of riscv-tests (rv64ui, rv64ua, rv64si, rv64mi) and booting Linux, without pass counts. We found no published conformance results for the Rocq version itself. Its main check is use in proofs: the bedrock2 compiler targets it, and the paper describes a processor proved correct against it (the PLDI 2021 lightbulb system).
Maintained by
MIT Programming Languages and Verification group (mit-plv)
Per instruction
Instruction-by-instruction readiness

Stage

Computed from the evidence below; see the criteria. MechanizedMechanized. Written in a form a computer can check, rather than on paper. means a computer can check the definition.

Stage 0 Mechanized Met
  • Met: Machine-checked or machine-readable definition evidence
  • Met: Fragment and version are stated The README states the fragment (RV32I/RV64I with M and A), but not an ISA manual version. The code treats A as unsupported in the main execute function. evidence
Stage 1 Validated Next
  • Met: Can be executed or tested The step function (run1) is an ordinary computable Rocq definition. We found no packaged simulator for running test binaries. evidence
  • Not met: Published results against conformance tests or real implementations No published conformance or differential-testing results for the Rocq model. The paper says the Haskell model it came from ran parts of riscv-tests, without pass counts.
Stage 2 Authoritative Later
  • Not met: Adopted by the language or ISA owner, or covers the full current version and tracks new ones Adopted by the owner: no; full coverage: no; tracks new versions: no. We found no statement from RISC-V International about this model. Only I, M and part of Zicsr are executed. No stated policy for following new ISA versions.

Coverage

Which parts of RISC-V the model defines.

ISA-level features

ISA-level features
FeatureSupportNotes
User-level instructions The ordinary integer, memory and branch instructions programs use. PartialPartial.I (32 and 64 bit) and M are executed. A is defined in ExecuteA.v but the main execute function (Execute.v) treats A as unsupported. No C (compressed) or B instructions.
Source
I (32 and 64 bit) and M are executed. A is defined in ExecuteA.v but the main execute function (Execute.v) treats A as unsupported. No C (compressed) or B instructions. source
Floating-point instructions Scalar floating-point instructions. Not supportedNot supported.F and D instructions are decoded but not executed.
Source
F and D instructions are decoded but not executed. source
Vector / SIMD instructions Vector and SIMD extensions. Not supportedNot supported.No vector (V) extension.
Source
No vector (V) extension. source
Privileged mode Privilege levels, control registers, traps and exceptions. PartialPartial.CSR instructions and exceptions are modeled in part; the paper marks Zicsr as partly supported in the Rocq version.
Source
CSR instructions and exceptions are modeled in part; the paper marks Zicsr as partly supported in the Rocq version. source
Virtual memory Page tables and address translation. Not supportedNot supported.Address translation is an abstract machine operation (translate); no page-table walk.
Source
Address translation is an abstract machine operation (translate); no page-table walk. source
Concurrency memory model The multiprocessor memory model (for example x86-TSO, Arm, RVWMO). Not supportedNot supported.The machine is a single hart; no RVWMO multiprocessor memory model.
Source
The machine is a single hart; no RVWMO multiprocessor memory model. source

Used by

Toolchains in this index whose proofs are about this model.

No toolchain in the index refers to it yet.

Sources

esc