Repository navigation
fix(fetch): retire terminal requests before redirects - #5
Merged
RossComputerGuy merged 1 commit intoOct 6, 2026
Merged
Conversation
Deassert request enable on the edge consuming a terminal response, preventing duplicate MMU requests from surviving a trap redirect. Preserve straddle continuation and transient retries. Add 12 RV32/RV64 regressions covering data, page faults, retries and redirection. All 66 focused fetch tests pass; all 12 new cases fail on the upstream baseline.
RossComputerGuy
approved these changes
Oct 6, 2026
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.
Description
This came up during River/ZedBoard bring-up while debugging instruction fetch faults around supervisor trap handling. The fetcher left its memory
request enabled after consuming a terminal response, until the instruction was delivered.
That extra cycle could allow the MMU to accept a duplicate request. If the original fetch caused a trap, the duplicate walk could survive the
redirect and return a stale fault against the supervisor handler.
This changes the fetcher to withdraw the request on the same edge that consumes a terminal response, covering:
Requests remain enabled when starting the second beat of a straddling instruction or retrying a transient invalid response. Those aren't terminal
completions.
Testing
Added 12 regressions covering RV32/RV64, single-beat and straddling instructions, successful responses, page faults and retries.
The tests check that the request is withdrawn immediately on completion, stays withdrawn while the result is held, and that fetching resumes
correctly after a redirect without retaining the previous fault.
All 12 new regressions fail against upstream 584f13a because the request remains enabled after completion. With the fix, all 66 focused fetch
tests pass:
dart test \ packages/river_hdl/test/core/fetcher_test.dart \ packages/river_hdl/test/core/prefetch_fetcher_test.dart \ packages/river_hdl/test/core/pipelined_fetcher_test.dart \ packages/river_hdl/test/core/compressed_fetch_buffer_test.dart \ packages/river_hdl/test/core/fetch_completion_test.dart \ -r expanded