Skip to content

fix(fetch): retire terminal requests before redirects - #5

Merged
RossComputerGuy merged 1 commit into
LilithSemi:masterfrom
murdoa:fix/fetch-request-retirement
Oct 6, 2026
Merged

RossComputerGuy merged 1 commit into
LilithSemi:masterfrom
murdoa:fix/fetch-request-retirement

Conversation

@murdoa

@murdoa murdoa commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

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:

  • Successful single-beat fetches.
  • Page faults on the first beat.
  • Successful completion of a straddling instruction.
  • Page faults on the second beat.

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

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
RossComputerGuy merged commit 61acd21 into LilithSemi:master Oct 6, 2026
1 of 4 checks passed
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.

2 participants