Fix mtinst zeroing on traps - #3560
Open
124107157-KV wants to merge 3 commits into
Open
124107157-KV wants to merge 3 commits into
124107157-KV wants to merge 3 commits into
Conversation
124107157-KV
force-pushed
the
fix/3496-mtinst-zero
branch
from
September 15, 2026 18:15
7c23048 to
76fdfdd
Compare
Signed-off-by: 124107157-KV <124107157@umail.ucc.ie>
124107157-KV
force-pushed
the
fix/3496-mtinst-zero
branch
from
September 15, 2026 18:27
76fdfdd to
5f79cf3
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?
In a normal non-SPIKE_TANDEM build, the mtinst update logic depends on ariane_pkg::ZERO_TVAL before checking whether the trap cause requires mtinst to be zero.
Since ZERO_TVAL is disabled in a normal build, a virtual-instruction exception can write ex_i.tinst into mtinst instead of zero. The same condition also affects interrupts, for which mtinst must always be zero.
This fixes #3496.
What does this PR change?
Verification
Both directed regressions were run with:
target: cv64a6_imafdch_sv39
simulator: veri-testharness
SPIKE_TANDEM: unset
Virtual-instruction regression:
Before fix: FAILED (tohost = 2)
After fix: SUCCESS (tohost = 0)
Interrupt regression:
Before fix: FAILED (tohost = 2)
After fix: SUCCESS (tohost = 0)
In both failing runs, tohost = 2 corresponds to observing the expected trap or interrupt cause with a non-zero mtinst value.
Additional checks:
Limitations
This change is intentionally limited to mtinst.
The similar htinst expression is not modified because it is outside the reproducer and scope of issue #3496.