Skip to content

Add tUserFirst alignment checking to AxiStreamBatcherEventBuilder#1442

Open
ruck314 wants to merge 2 commits into
pre-releasefrom
EventBuilder-tUserFirst-align-checker
Open

Add tUserFirst alignment checking to AxiStreamBatcherEventBuilder#1442
ruck314 wants to merge 2 commits into
pre-releasefrom
EventBuilder-tUserFirst-align-checker

Conversation

@ruck314

@ruck314 ruck314 commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an optional tUserFirst alignment check to AxiStreamBatcherEventBuilder.

When EnableAlignCheck (0xFF8[1]) is set, every active (non-bypassed) inbound
stream must present the same first-word tUser (tUserFirst) value before an
event is forwarded to the batcher. On a mismatch, the per-channel ErrorAlignDet
status (0xFD4) latches and the builder stops moving data, keeping
corrupted/misaligned data out of the downstream batcher. Recovery is a normal DAQ
run transition and/or blowoff to flush the pipeline. With EnableAlignCheck=0 the
behavior is unchanged and ErrorAlignDet reads zero.

Changes

  • RTL (protocols/batcher/rtl/AxiStreamBatcherEventBuilder.vhd)
    • New EnableAlignCheck control bit (0xFF8[1]) and ErrorAlignDet status word (0xFD4).
    • Gate data movement on errorAlignDet = 0; clear it on a transition frame.
    • Preserve EnableAlignCheck across soft/hard reset, alongside bypass/timeout/blowoff
      (otherwise the auto soft-reset on a blowoff 1->0 edge / initialize() would silently
      disable the check).
    • Exclude bypassed channels from the check (r.enAlignCheck and not(r.bypass(i))) so a
      bypassed stream cannot deadlock the flow.
  • PyRogue (python/surf/protocols/batcher/_AxiStreamBatcherEventBuilder.py)
    • Add ErrorAlignDet (RO) and EnableAlignCheck (RW) variables.
  • Tests (tests/protocols/batcher/test_AxiStreamBatcherEventBuilder.py)
    • cocotb coverage across all three parametrized configs: mismatch stall + flag + blowoff
      recovery, aligned pass-through, bypassed-channel exclusion, and EnableAlignCheck
      survival across a soft reset.

Known limitation

The comparison reference is slave index 0; it must remain enabled when the check is in use.

Verification (local, mirrors CI)

  • VSG VHDL style linter (vsg-linter.yml): pass
  • Trailing-whitespace/tab check: clean
  • compileall + flake8 python/ scripts/ tests/: pass
  • Full regression suite pytest -n auto tests/axi tests/base tests/dsp tests/protocols: 671 passed

Add an optional check (EnableAlignCheck @ 0xFF8[1]) that requires all
non-bypassed inbound streams to present the same tUserFirst value before an
event is forwarded to the batcher. On a mismatch the per-channel ErrorAlignDet
status (@ 0xFD4) latches and the builder stops moving data, keeping
corrupted/misaligned data out of the downstream batcher until a DAQ transition
or blowoff clears the pipeline.

- Preserve EnableAlignCheck across soft/hard reset alongside bypass/timeout/blowoff
- Exclude bypassed channels from the alignment check
- Add PyRogue ErrorAlignDet (RO) and EnableAlignCheck (RW) variables
- Add cocotb coverage: mismatch stall + recovery, aligned pass-through,
  bypassed-channel exclusion, and config survival across soft reset

The comparison reference is slave index 0, which must remain enabled when the
check is in use.
@ruck314 ruck314 marked this pull request as ready for review June 28, 2026 20:05
A NULL frame carries tUserFirst=0x01 (EOFE), which differs from the
reference channel's tUserFirst. With EnableAlignCheck=1, a data channel
(i>0) issuing a NULL frame for an event without data was incorrectly
flagged as a misalignment, stalling the event builder. Gate
errorAlignDet with not(nullDet(i)) so NULL frames do not trip the check.

Add a cocotb regression (align_check_ignores_null_source_test) covering a
NULL frame on a data channel with EnableAlignCheck=1, and document that
stream[0] must never be NULL or bypassed when the check is enabled.
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 16.12903% with 78 lines in your changes missing coverage. Please review.
✅ Project coverage is 25.19%. Comparing base (e648f9b) to head (8d3ec22).

Files with missing lines Patch % Lines
...ocols/batcher/test_AxiStreamBatcherEventBuilder.py 16.12% 78 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@               Coverage Diff               @@
##           pre-release    #1442      +/-   ##
===============================================
- Coverage        25.23%   25.19%   -0.05%     
===============================================
  Files              258      258              
  Lines            20423    20516      +93     
===============================================
+ Hits              5153     5168      +15     
- Misses           15270    15348      +78     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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