Skip to content

backend: Hold the zero-length rejection until it is accepted - #193

Open
DanielKellerM wants to merge 1 commit into
pulp-platform:develfrom
DanielKellerM:backend/zero-len-rsp
Open

backend: Hold the zero-length rejection until it is accepted#193
DanielKellerM wants to merge 1 commit into
pulp-platform:develfrom
DanielKellerM:backend/zero-len-rsp

Conversation

@DanielKellerM

Copy link
Copy Markdown
Collaborator

Fixes #189.

With RejectZeroTransfers=1 the rejection response was a purely combinational function of the request handshake, so it carried no state. That gave it two failure modes:

  • Lost response. Its assertion window is one cycle and is not tied to rsp_ready_i, so a consumer that is busy elsewhere never sees it. The backend has then accepted N requests and delivered N-1 responses, and every later response is credited to the wrong transfer.
  • Reordered response. Its position in the response stream is not ordered against transfers still in flight, so it can overtake an older transfer's response.

The fix

Latch the rejection into a proper valid/ready stream that is held until accepted, and hold back a zero-length request while an older rejection is unaccepted or any transfer still owes a response:

assign zero_len_stall = is_length_zero & (zero_rsp_pending_q | (num_outst_q != '0));
assign req_ready_o    = leg_ready & ~zero_len_stall;

Gating acceptance directly on rsp_ready_i was considered and rejected: it puts a bus-facing ready into the req_ready_o cone and closes a real combinational loop through the ND midend and the inst64 top. Here zero_len_stall depends only on flops, so no loop is created. Confirmed with verilator: the UNOPTFLAT warnings on this top are pre-existing and unchanged in count.

Verified

  • Directed regression added (jobs/backend_*/zero_transfer_busy.txt, registered in jobs.json): deterministic, no randomisation. Passes on rw_axi, rw_axi_rw_axis, r_obi_w_axi, r_axi_w_obi and rw_obi.
  • Non-vacuity: reverting only the RTL fix and keeping the test reproduces the hang - Tripped Watchdog (i_axi_r_watchdog) at 1170 ns on rw_axi and 1160 ns on rw_axi_rw_axis. Restoring it passes again. Note r_axi_w_obi and rw_obi pass either way, since an OBI write destination commits synchronously and the deadlock chain cannot close.
  • The CI symptom: the rw_axi_rw_axis random seed 1 leg, which contains two zero-length transfers, goes from failing (Tripped Watchdog at 236210 ns, 19 of 20 jobs launched) to passing (20 of 20, normal finish).
  • Codegen invariant: the template is the only RTL edit; a forced regeneration reproduces target/rtl byte-for-byte, so nothing generated was hand-edited.
  • All verdicts are gated on the transcript rather than the exit code; every failing run above still returned vsim exit 0 while carrying ** Fatal:.

Follow-up, not fixed here

src/midend/idma_nd_midend.sv (around lines 211-227) has the same construct with neither interlock. It was flagged by inspection and four directed ND shapes failed to provoke it, so it is unproven and deserves its own investigation rather than a speculative copy of this fix.

The rejection was a combinational function of the request handshake, so it
lasted one cycle whether or not the consumer was ready and it could overtake
the response of a transfer still in flight. A dropped rejection leaves the
backend owing a response forever; a reordered one is credited to the wrong
transfer.

Latch it into a proper stream and hold back a zero-length request while an
older rejection is unaccepted or any transfer still owes a response.

Fixes pulp-platform#189
Copilot AI lite review requested due to automatic review settings August 13, 2026 11:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@DanielKellerM

Copy link
Copy Markdown
Collaborator Author

Deferred until after the 0.7.0 release, per Daniel. Not to be merged into the release branch.

@DanielKellerM DanielKellerM mentioned this pull request Aug 17, 2026
5 tasks
@DanielKellerM
DanielKellerM deleted the branch pulp-platform:devel August 19, 2026 08:27
@DanielKellerM DanielKellerM reopened this Aug 19, 2026
@DanielKellerM
DanielKellerM force-pushed the devel branch 3 times, most recently from a4b8a4e to 2e0b0fe Compare August 19, 2026 11:33
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