Repository navigation
Use fd/fs# operand names for floating-point registers - #444
Conversation
Rename the floating-point destination/source operands from rd/rs1/rs2/rs3 to fd/fs1/fs2/fs3 (and their compressed/H-extension variants) across the extension files, following the ISA manual's naming convention for FP register operands. Closes riscv#190. - Rename operands in 23 extension files: rv_f, rv_d, rv_q, rv_zfh, rv_zfhmin, rv_d_zfhmin, rv_q_zfhmin, the rv64 variants, rv_c_d, rv32_c_f, the *_zfa variants, rv_zfbfmin, rv32_zclsd, rv_v and rv_zvfbfwma (226 instruction entries in total). - Add the fd/fs# entries to arg_lut.csv at the same bit positions as their rd/rs# parents. - Alias the new names to the existing LaTeX renderings in constants.py, so every generated format renders exactly what it rendered before. - Add unit tests covering the naming in extension files, the arg_lut rows, and the LaTeX renderings. All outputs are unchanged: instr-table.tex, priv-instr-table.tex, inst.go, inst.rs, inst.sverilog and inst.chisel are byte-identical to a baseline generated before this change, and the committed encoding.h is unchanged as well. Only the untracked encoding.out.h is affected, gaining the new INSN_FIELD_FD/FS*/... macros. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai> Signed-off-by: leo7martins <219400372+leo7martins@users.noreply.github.com>
| #quadrant 2 | ||
| $pseudo_op rv32_c_f::c.flwsp c.ldsp rd_n0_e c_uimm9sphi c_uimm9splo 1..0=2 15..13=3 7=0 | ||
| $pseudo_op rv32_c_f::c.fswsp c.sdsp c_rs2_e c_uimm9sp_s 2..0=2 15..13=7 | ||
| $pseudo_op rv32_c_f::c.flwsp c.ldsp fd_n0_e c_uimm9sphi c_uimm9splo 1..0=2 15..13=3 7=0 |
There was a problem hiding this comment.
c.flwsp doesn't impose the != 0 requirement (and the fd_n0_e token can be deleted down below). Ping me when this is ready to merge.
There was a problem hiding this comment.
Andrew Waterman (@aswaterman) Thanks for the review. Addressed in f8bc6a3: the Zclsd c.ldsp pseudo-op is back to rd_n0_e, since the nonzero, even constraint comes from c.ldsp's integer register pair and not from c.flwsp. The fd_n0_e token is gone from arg_lut.csv and the LaTeX mapping. A second commit, d9b8227, fixes isort/black/pyright findings in the new tests.
An AI agent re-ran the checks locally on Python 3.12: python -m unittest -b tests/test.py passes (20 tests), pre-commit run --all-files passes, and generating all outputs works. Apart from the removed INSN_FIELD_FD_N0_E macro in encoding.out.h, the generated outputs are the same as before this change. The earlier build (3.9) failure happened because setup-python couldn't find 3.9 on the ubuntu-26.04 runner. It wasn't caused by this PR, and master has since dropped 3.9 (#443).
This should be ready to merge from my side once CI is green.
This change was prepared with an AI coding assistant.
c.flwsp has no rd != 0 restriction; the nonzero, even constraint belongs to the integer register pair of c.ldsp. Restore rd_n0_e on the c.ldsp pseudo-op and delete the now-unused fd_n0_e token from arg_lut.csv and the LaTeX mapping. Signed-off-by: leo7martins <219400372+leo7martins@users.noreply.github.com>
Apply isort/black formatting and add the type annotations pyright requires on the _extension_file helper. Signed-off-by: leo7martins <219400372+leo7martins@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #444 +/- ##
==========================================
- Coverage 97.08% 96.89% -0.20%
==========================================
Files 14 14
Lines 926 997 +71
==========================================
+ Hits 899 966 +67
- Misses 27 31 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
0a7bd76
into
riscv:master
Closes #190.
As requested in the issue, this renames the floating-point register operands from
rd/rs1/rs2/rs3tofd/fs1/fs2/fs3across the extension files, matching the naming the ISA manual already uses for FP operands. The naming is now consistent with how the manual (#1094) and the assembler conventions distinguish FP registers from integer registers.What changed
extensions/(23 files, 226 instruction entries):rv_f,rv_d,rv_q,rv_zfh,rv_zfhmin,rv_d_zfhmin,rv_q_zfhmin,rv64_d/rv64_f/rv64_q/rv64_zfh,rv_c_d,rv32_c_f, the*_zfavariants,rv_zfbfmin,rv32_zclsd,rv_v,rv_zvfbfwma.flw→fd,fsw→fs2; compressed variants getfd_p/fs2_p/c_fs2(and the Zclsd equivalents with the_esuffixes).fmadd-family):fd/fs1/fs2/fs3; 3-operand (fadd-family,fmin/fmaxand the Zfa min/max/round variants):fd/fs1/fs2.fclass/convert-to-integer keep the integerrd(orrs1for X→FP), since that operand really is an integer register;fmv.x.*keepsrdandfmv.*.xkeepsrs1.arg_lut.csv: the newfd/fs1/fs2/fs3(and compressed variants) entries sit at the same bit positions as theirrd/rs#parents.src/riscv_opcodes/constants.py:latex_mappingaliases each new name to the exact rendering its parent already used (e.g.fd_p→rd\,$'$), so LaTeX output is unchanged.tests/test.py: newFloatingPointOperandNamingTestcovering the naming in the extension files, thearg_lutrows, and the LaTeX renderings (17 → 20 tests, all passing).Outputs are unchanged
None of the generated artifacts change, which was the acceptance criterion in the issue:
instr-table.tex,priv-instr-table.tex,inst.go,inst.rs,inst.sverilog: byte-identical to a baseline generated at the parent commit.inst.chisel: identical content; the only machine-produced file whose text ordering shifts is discussed below.encoding.his untouched. Only the (untracked, build-time)encoding.out.his affected, gaining the newINSN_FIELD_FD/INSN_FIELD_FS1/...macros andINSN_FIELD_RS2_EQ_RS1→INSN_FIELD_FS2_EQ_FS1.Notes
tests/test.py(20 passed) and byte-comparing generated outputs against the parent commit. GitHub workflows are awaiting maintainer approval; no human review or independent human testing is claimed.