Skip to content

Fix implementation of instreth writes#1950

Merged
aswaterman merged 2 commits intomasterfrom
fix-instreth
Apr 8, 2025
Merged

Fix implementation of instreth writes#1950
aswaterman merged 2 commits intomasterfrom
fix-instreth

Conversation

@aswaterman
Copy link
Collaborator

Decrementing the counter in advance of incrementing it produces incorrect results when there's a carry-out. Fix by getting rid of this scheme altogher: just skip the increment if there was an expicit write.

Looks like Spike tried to do the right thing here, but misimplemented it--i.e. it wasn't a misreading of the spec.

See test case riscv-software-src/riscv-tests@162d3e7 and ISA spec discussion riscv/riscv-isa-manual#1255

cc @Timmmm

No functional change intended; fixes implementation of a forthcoming bug fix.
@aswaterman aswaterman requested a review from jerryz123 April 8, 2025 00:58
@aswaterman aswaterman enabled auto-merge April 8, 2025 00:58
Decrementing the counter in advance of incrementing it produces
incorrect results when there's a carry-out.  Fix by getting rid of this
scheme altogher: just skip the increment if there was an expicit write.
@aswaterman aswaterman merged commit 69c7d11 into master Apr 8, 2025
3 checks passed
@aswaterman aswaterman deleted the fix-instreth branch April 8, 2025 16:41
@Timmmm
Copy link

Timmmm commented Apr 8, 2025

Thanks! I guess an official test and Spike agreeing is enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants