Fix Zcmt table jump target LSB - #3501
Open
124107157-KV wants to merge 2 commits into
Open
Conversation
Clear bit 0 of the JVT-loaded target before converting it to the PC-relative offset used by the internal JAL expansion. Add RV32 directed regressions covering odd JVT targets for cm.jt and cm.jalt.
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 this PR is needed
Zcmt table jumps currently use the JVT-loaded value directly when
calculating the jump target.
For
cm.jtandcm.jalt, bit 0 of the value loaded from the JVT mustbe cleared before it is used as the architectural target. Since CVA6
expands these table jumps to an internal
JAL, they do not pass throughthe existing
JALRtarget-LSB clearing in the branch unit.As a result, an odd address stored in a JVT entry can cause CVA6 to
jump to the odd address instead of the required address with bit 0
cleared.
Changes
core/zcmt_decoder.svbefore converting the target to the PC-relative offset used by the
internal
JALexpansion.cm.jtwith an odd JVT target.cm.jaltwith an odd JVT target.cm.jalttarget executes and returns through theexpected link address.
verif/tests/testlist_issues.yaml.verif/regress/issue-tests.sh.Validation
The permanent directed regressions were checked both before and after
the RTL change.
Before the fix:
zcmt-jt-target-lsb-rv32: FAILzcmt-jalt-target-lsb-rv32: FAILAfter the fix:
zcmt-jt-target-lsb-rv32: PASSzcmt-jalt-target-lsb-rv32: PASSzcmt-jvt-index-rv32regression: PASSAdditional checks:
verible-verilog-format --verify core/zcmt_decoder.sv: PASSbash -n verif/regress/issue-tests.sh: PASSgit diff --check: cleanupstream/masterrequired no changes.Scope / limitations
This change is limited to Zcmt table-jump target handling.
It does not change the normal
JAL,JALR, or branch-unit targethandling. Bit 0 is cleared specifically on the target loaded from the
JVT before that target is converted to the PC-relative offset used by
the Zcmt internal
JALexpansion.No known limitation is introduced by this change.
Fixes #3441