Skip to content

Hold DMA upsizer output under backpressure - #20

Open
flaviens wants to merge 2 commits into
RedPitaya:masterfrom
flaviens:agent/hold-dma-upsize-output
Open

Hold DMA upsizer output under backpressure#20
flaviens wants to merge 2 commits into
RedPitaya:masterfrom
flaviens:agent/hold-dma-upsize-output

Conversation

@flaviens

Copy link
Copy Markdown

Summary

  • Backpressure the sample input while a packed output is pending.
  • Hold output valid, data, and packet state through handshake.
  • Keep all stream-app RTL variants aligned.

The upsizers tied input ready high while pulsing output valid for one cycle. A stalled DMA sink could therefore lose packed words, overwrite buffered samples, and retain TLAST into a later packet.

Checks

  • Icarus backpressure regression: upstream accepted 12 samples but returned 1 word; fixed RTL returned all 3 words with no payload or packet-state errors.
  • Icarus partial-packet regression: fixed RTL realigned the next packet with no payload or TLAST errors.
  • All six modified modules compile with Icarus.

@flaviens
flaviens marked this pull request as ready for review August 14, 2026 07:12
Copilot AI lite review requested due to automatic review settings August 14, 2026 07:12

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.

Pull request overview

This PR updates the DMA S2MM “upsizer” RTL blocks to properly apply backpressure to the input stream while an output word is pending, and to hold output TVALID/data/packet state stable until the downstream handshake completes. This prevents packed output words (and TLAST state) from being lost or mis-associated when the DMA sink stalls.

Changes:

  • Gate s_axis_tready with (~m_axis_tvalid | m_axis_tready) and introduce input_transfer / output_transfer / word_complete handshake helpers.
  • Hold m_axis_tvalid asserted until m_axis_tready is observed, and update/clear tlast in sync with completed-word handshakes.
  • Apply the same handshake/backpressure behavior consistently across rtl / rtl_4ch / rtl_250 stream-app variants.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
prj/stream_app/rtl/rtl/rp_oscilloscope/rp_dma_s2mm_upsize.v Adds proper input backpressure and holds output valid/state through handshake for oscilloscope upsizer.
prj/stream_app/rtl/rtl/rp_gpio/gpio_dma_s2mm_upsize.v Adds proper input backpressure and holds output valid/state through handshake for GPIO upsizer.
prj/stream_app/rtl/rtl_4ch/rp_oscilloscope/rp_dma_s2mm_upsize.v Mirrors oscilloscope upsizer backpressure/hold semantics in 4ch variant.
prj/stream_app/rtl/rtl_4ch/rp_gpio/gpio_dma_s2mm_upsize.v Mirrors GPIO upsizer backpressure/hold semantics in 4ch variant.
prj/stream_app/rtl/rtl_250/rp_oscilloscope/rp_dma_s2mm_upsize.v Mirrors oscilloscope upsizer backpressure/hold semantics in 250MHz variant.
prj/stream_app/rtl/rtl_250/rp_gpio/gpio_dma_s2mm_upsize.v Mirrors GPIO upsizer backpressure/hold semantics in 250MHz variant.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +129 to +132
if (input_transfer) begin
upsize_buf[mux_sel ] <= (s_axis_tdata[16-1:8] & {8{ use_8bit}}) | (s_axis_tdata[8-1:0] & {8{~use_8bit}});
upsize_buf[mux_sel+1] <= (s_axis_tdata[16-1:8] & {8{~use_8bit}}) | (upsize_buf[mux_sel+1] & {8{ use_8bit}});
end
Comment on lines +129 to +132
if (input_transfer) begin
upsize_buf[mux_sel ] <= (s_axis_tdata[16-1:8] & {8{ use_8bit}}) | (s_axis_tdata[8-1:0] & {8{~use_8bit}});
upsize_buf[mux_sel+1] <= (s_axis_tdata[16-1:8] & {8{~use_8bit}}) | (upsize_buf[mux_sel+1] & {8{ use_8bit}});
end
Comment on lines +129 to +132
if (input_transfer) begin
upsize_buf[mux_sel ] <= (s_axis_tdata[16-1:8] & {8{ use_8bit}}) | (s_axis_tdata[8-1:0] & {8{~use_8bit}});
upsize_buf[mux_sel+1] <= (s_axis_tdata[16-1:8] & {8{~use_8bit}}) | (upsize_buf[mux_sel+1] & {8{ use_8bit}});
end
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