Tutorials
AXI4-Stream Backpressure Testbench: Catch Changed or Lost Beats
Published · Updated
Build the reference queue from accepted transfers
An AXI4-Stream transfer occurs on a clock edge where TVALID and TREADY are both asserted. Count that event exactly once. A source must retain the offered beat while stalled, including the sideband fields carried with it. A test that compares only TDATA during a constantly ready run misses many interface bugs.

The downloadable SystemVerilog example is a small one-stage stream register with a testbench, not a complete AXI verification IP. It carries data and a last marker, drives random downstream stalls from a repeatable seed, and compares every accepted output against a reference queue. It does not implement TKEEP or every optional sideband; extend both the payload and scoreboard when your interface uses them.
Check timing after functional simulation.
Use the external timing budget for board-facing signals.
Make a broken implementation fail the same test
Run the normal design, then run the provided deliberately faulty variant that drops the last marker. The reference sequence includes marked beats, so a missing marker must produce a mismatch. This is a useful check on the checker: a test that passes both versions does not establish the behavior it claims to test.
The browser trace tool examines user-entered cycle,valid,ready,data,last records. It counts accepted beats and reports changes to a stalled offer. It is a single-interface trace check; without an input reference stream it cannot prove that an entire pipeline neither lost nor duplicated a beat. The downloadable testbench supplies that separate end-to-end comparison.
Define reset release separately.
Keep simulation success tied to its scope
Preserve the seed, simulator version, source revision and pass/fail output. Test long stalls, back-to-back transfers and reset recovery; add packet-length and byte-valid tests when those signals exist. Check a reset interruption according to your system contract rather than pretending an in-flight packet survives every reset.
Passing this example proves the supplied test cases for the supplied register, not timing closure or board performance. For your own design, retain the scoreboard and replace the device under test, then make at least one intentional fault fail before trusting a green regression.
Keep the actual implementation version.
Count accepted stream beats: short sequence

Cycle 0: VALID 1 READY 0: 0 accepted beats → Cycle 1: held while stalled: 0 accepted beats → Cycle 2: first transfer: 1 accepted beats → Cycle 3: second transfer: 2 accepted beats
Download and reproduce the test
Download the stream register and testbench. Run the commands in RUN.txt. The normal build accepted 200 beats in 313 cycles; the injected LAST fault failed at beat index 12. This is simulation evidence for the supplied example.
iverilog -g2012 -s tb -o pass.vvp axis_register_tb.sv
vvp pass.vvp
iverilog -g2012 -DFAULT -s tb -o fault.vvp axis_register_tb.sv
vvp fault.vvpExport your result with its assumptions. For an unresolved board or implementation issue, prepare an engineering review with the exact part, revision and relevant record. This link opens the review page; it does not send your worksheet.
Sources and scope
Sources checked 18 November 2026. Numerical examples are calculated cases. Hardware measurements and device timing closure are outside the results shown here.
Back to Tutorials