Expose per-event flow to ARM via AXI4-Lite FLOW bundle (ENTR-31)#3
Merged
David Shukhin (davidshukhin) merged 1 commit intoJun 12, 2026
Merged
Conversation
…e (ENTR-31) Closes the last open item of SYSTEM_ANALYSIS.md: the ARM read flow vectors from a register space the FPGA never wrote (and would have indexed past the 128-word sim register file). - fpga/top_level.cpp: FLOW_EXPORT loop in COMPUTE_EVASION packs the first 1024 (pos, flow) pairs — x/y UQ4.12, vx/vy Q8.8 — into flow_out[2048] on a new s_axilite FLOW bundle, plus flow_count and a seqlock flow_seq written last for torn-read detection - arm/fpga_interface.h (new): FpgaInterface moved out of drone_main.cpp; read_flow_vectors() decodes the FLOW window with seqlock retry; stale REG_FLOW_PRED_BASE float-memcpy scheme deleted; sim register file sized to the full window; pack helpers shared with tests - fpga/hls_compat.h: Vitis-compatible range(hi, lo) on ap_fixed/ap_ufixed - fpga/build.tcl: FLOW bundle directives - tests: testbench test_flow_export (count/seq/bit-exact-vs-DEBUG/decode ranges/generation advance); ARM register round-trip + end-to-end TTC from register-decoded flow + clamping edge cases - docs: fpga/README.md FLOW register map + read protocol; SYSTEM_ANALYSIS item 10 and summary row marked FIXED make test-fpga 22/22, make test-arm 29/29, clang-format clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the last open item of
SYSTEM_ANALYSIS.md/ ENTR-31: the ARM'sread_flow_vectors()read from a register space the FPGA never wrote — the collision predictor was running on dummy data, and the read would have indexed past the 128-word sim register file.Design
FLOWbundle:flow_out[2048](first 1024 events × 2 words),flow_count, and a seqlockflow_seqwritten last so the ARM detects reads that straddle an export and retries.+8i→ x/y as UQ4.12 (true normalized ring-buffer coords),+8i+4→ vx/vy as Q8.8 fromflow_pred.flow_pred[i] ↔ ring_buffer_events[(read_ptr+i) & RB_ADDR_MASK]is sound because no ingest occurs between NORMALIZE and COMPUTE_EVASION.Changes
fpga/top_level.cpp:FLOW_EXPORTloop (II=2) + pragmas;fpga/build.tclmirror directivesarm/fpga_interface.h(new):FpgaInterfaceextracted fromdrone_main.cpp; seqlock decode; staleREG_FLOW_PRED_BASEfloat-memcpy scheme deletedfpga/hls_compat.h: Vitis-compatiblerange(hi, lo)on the sim fixed-point typestest_flow_exportin the C testbench (bit-exact cross-check against the DEBUG bundle) + ARM register round-trip, end-to-end TTC from register-decoded flow, clamping edge casesfpga/README.md; SYSTEM_ANALYSIS item 10 marked FIXEDValidation
make test-fpga: 22/22 (incl. new flow-export assertions)make test-arm: 29/29 (incl. 6 new round-trip tests)clang-formatclean_hw.hwhen ENTR-13's real synthesis runs — flagged in code + README.