Repository navigation
[hardware] 🐛 Fix register checks for single-register operands - #512
Open
davidharrishmc wants to merge 2 commits into
Open
davidharrishmc wants to merge 2 commits into
davidharrishmc wants to merge 2 commits into
Conversation
The dispatcher applied the LMUL alignment check to operands that are always one register, so legal instructions raised illegal instruction when that register was not a multiple of LMUL: the mask destination of integer and floating-point compares, vmadc and vmsbc; the mask operands of the mask-logical instructions and vmsbf/vmsif/vmsof; the vs2 of viota.m; vlm.v/vsm.v, whose EMUL is 1; and the vd/vs1 of single-width integer and floating-point reductions (widening integer reductions are pulp-platform#478). vmadc/vmsbc also had their own check that rejected vd equal to a source register and, at LMUL >= 2, registers that do not overlap at all. Exempt those operands, and replace the vmadc/vmsbc check with the RVV 1.0 rule for every mask-producing instruction: vd may overlap a source group only at its lowest-numbered register. Fixes pulp-platform#511 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: David Harris <David_Harris@hmc.edu>
Forcing EMUL = 1 for vlm.v/vsm.v made the EMUL > 8 / < 1/8 check compare that EMUL with a fractional LMUL, so vlm.v at e16 mf4 or mf2 raised illegal instruction. vlm.v/vsm.v are legal for any valid vtype: skip the check for them in the load and store decoders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: David Harris <David_Harris@hmc.edu>
davidharrishmc
force-pushed
the
fix/single-register-checks
branch
from
October 20, 2026 06:02
70b89de to
9277c04
Compare
Author
|
Added 9277c04: forcing EMUL = 1 for |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Caution
This pull request was generated by an AI assistant (Claude Code) and has not been reviewed by a human. Please review it with that in mind.
Fixes #511. The dispatcher no longer applies the LMUL alignment check to operands that are always one register: the mask destination of integer and floating-point compares,
vmadcandvmsbc; the mask operands ofvmand.mm..vmxnor.mmandvmsbf/vmsif/vmsof.m; the vs2 ofviota.m;vlm.v/vsm.v(EMUL = 1); and the vd/vs1 of single-width integer and floating-point reductions. Thevmadc/vmsbc-specific check, which rejected vd equal to a source register and (at LMUL >= 2) non-overlapping registers, is replaced by the RVV 1.0 rule for every mask-producing instruction: vd may overlap a source group only at its lowest-numbered register. That rule keeps reserved overlaps such asvmseq.vv v5, v4, v6at LMUL=2 illegal, which today only trap as a side effect of the alignment check.Widening integer reductions are left to #478, which restructures the same OPIVV check, so the two will need a small rebase against each other.
Verification (Verilator, NrLanes=4, VLEN=512): a directed M-mode probe of 25 instructions. On main all 19 legal cases trap; with this change none do, the reserved cases (
vredsum.vs v22, v19, v1,vmadc.vv v5, v4, v6,vmseq.vv v5, v4, v6,vmseq.vx v3, v2, a0,vmfeq.vv v5, v4, v6at LMUL=2) still trap, andvmadc.vi v12, v12, -14gives the expected carry mask.vwredsum.vswith an odd vd still traps until #478.Changelog
Fixed
vmadc/vmsbc(Legal instructions with single-register operands (mask destinations, mask operands, vlm/vsm, reduction scalars) raise illegal instruction #511)Checklist