Skip to content

PR: R4 format support — EncodingLayout and field-to-bit mapping #17#22

Open
metasmile wants to merge 6 commits into
mainfrom
17-r4-format-func2
Open

PR: R4 format support — EncodingLayout and field-to-bit mapping #17#22
metasmile wants to merge 6 commits into
mainfrom
17-r4-format-func2

Conversation

@metasmile

@metasmile metasmile commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Add proper EncodingLayout to VerificationSpec for RISC-V instruction encoding format support. R-type and R4 formats are now first-class concepts with explicit field-to-bit-position mappings.

Changes

  • spec.rs: Added EncodingLayout struct with field_map: BTreeMap<String, FieldBitMapping> — format-agnostic field-to-bit mapping
  • spec.rs: Added encoding: Option<EncodingLayout> to VerificationSpec
  • xif.rs: YAML parser supports encoding: r (R-type, default) and encoding: r4 (R4 with func2)
  • xif.rs: Built-in default layouts for R-type and R4
  • cva6_xif_ref.xif.yaml: Added func2 field, encoding: r4, updated cross constraints

R4 format layout: {rs3[4:0], func2[1:0], rs2[4:0], rs1[4:0], funct3[2:0], rd[4:0], opcode[6:0]}

Verification

  • cargo test --release: 14/14 pass, no regressions
  • cva6_xif_ref: 262,144 total, 1,280 pass, 260,864 fail

Closes #17

@metasmile metasmile self-assigned this Jun 11, 2026
@metasmile metasmile changed the title PR: R4 format support — add func2 field axis for ADD_RS3 #17 PR: R4 format support — EncodingLayout and field-to-bit mapping #17 Jun 11, 2026
@metasmile metasmile force-pushed the 17-r4-format-func2 branch from 3182558 to c33a426 Compare June 11, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

R4 format support: func2 field axis for ADD_RS3

1 participant