decoder: reject reserved same-format FP conversions - #3562
Open
124107157-KV wants to merge 1 commit into
Open
124107157-KV wants to merge 1 commit into
124107157-KV wants to merge 1 commit into
Conversation
Contributor
|
Hi @124107157-KV, I understand that XF16ALT has a special encoding that differs from the other formats. But why isn't there a second arm that raises an illegal_instr when a same-format conversion in XF16ALT happens? |
Contributor
Author
Good point. I followed the issue's suggested patch, which intentionally left XF16ALT unchanged. Since XF16ALT uses |
124107157-KV
force-pushed
the
fix/3494-fcvt-same-format
branch
from
September 16, 2026 11:29
6292c7d to
c34cb64
Compare
IhsaneTahir
reviewed
Sep 16, 2026
124107157-KV
force-pushed
the
fix/3494-fcvt-same-format
branch
from
September 16, 2026 13:02
c34cb64 to
13ae66d
Compare
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.
Why is this PR needed?
The scalar
FCVT_F2Fdecode path validates the source and destinationfloating-point formats independently, but it does not reject conversions
where the source and destination formats are the same.
As a result, reserved same-format encodings such as the equivalent of
fcvt.s.sandfcvt.d.dare accepted by CVA6 instead of being rejectedby the decoder.
Spike treats these encodings as illegal instructions, so executing them
causes CVA6 and Spike to diverge during ISS co-simulation.
What does this PR change?
Add an additional legality check in the scalar
FCVT_F2Fdecoder paththat rejects an instruction when its source floating-point format matches
its destination format.
A directed regression test,
fcvt-same-format-rv64, is also added. Itchecks that:
fcvt.s.dremains accepted;fcvt.d.sremains accepted;exception;
exception;
The test also verifies the exception cause and the address of each
faulting instruction.
Verification
Tested with:
cv64a6_imafdc_sv39Before the RTL fix:
fcvt-same-format-rv64tohost = 1same-format encodings
After the RTL fix:
fcvt-same-format-rv64Existing floating-point conversion regressions:
rv64uf-p-fcvtrv64ud-p-fcvtXF16/XF16ALT-specific verification:
tohost = 0Final local regression report:
Additional checks:
verible-verilog-format --inplace core/decoder.svgit diff --checkFixes #3494