Skip to content

Expose per-event flow to ARM via AXI4-Lite FLOW bundle (ENTR-31)#3

Merged
David Shukhin (davidshukhin) merged 1 commit into
mainfrom
dshukhin/entr-31-expose-flow-via-axi
Jun 12, 2026
Merged

Expose per-event flow to ARM via AXI4-Lite FLOW bundle (ENTR-31)#3
David Shukhin (davidshukhin) merged 1 commit into
mainfrom
dshukhin/entr-31-expose-flow-via-axi

Conversation

@davidshukhin

Copy link
Copy Markdown
Member

Closes the last open item of SYSTEM_ANALYSIS.md / ENTR-31: the ARM's read_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

  • New s_axilite FLOW bundle: flow_out[2048] (first 1024 events × 2 words), flow_count, and a seqlock flow_seq written last so the ARM detects reads that straddle an export and retries.
  • Word format per entry i: +8i → x/y as UQ4.12 (true normalized ring-buffer coords), +8i+4 → vx/vy as Q8.8 from flow_pred.
  • Bounded at 1024 entries: full 4096 would need a 32 KB AXI4-Lite window and ~8k single-beat PS reads per 100 Hz frame; the ARM clusterer needs 30–50 events per object.
  • Index mapping 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_EXPORT loop (II=2) + pragmas; fpga/build.tcl mirror directives
  • arm/fpga_interface.h (new): FpgaInterface extracted from drone_main.cpp; seqlock decode; stale REG_FLOW_PRED_BASE float-memcpy scheme deleted
  • fpga/hls_compat.h: Vitis-compatible range(hi, lo) on the sim fixed-point types
  • Tests: test_flow_export in 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 cases
  • Docs: FLOW register map + read protocol in fpga/README.md; SYSTEM_ANALYSIS item 10 marked FIXED

Validation

  • make test-fpga: 22/22 (incl. new flow-export assertions)
  • make test-arm: 29/29 (incl. 6 new round-trip tests)
  • clang-format clean
  • ⚠️ AXI offsets (0x10/0x18/0x2000 @ 0x43C1_0000) follow standard Vitis allocation but are to-be-confirmed against the generated _hw.h when ENTR-13's real synthesis runs — flagged in code + README.

…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.
@davidshukhin David Shukhin (davidshukhin) merged commit 43a0366 into main Jun 12, 2026
2 checks passed
@davidshukhin David Shukhin (davidshukhin) deleted the dshukhin/entr-31-expose-flow-via-axi branch June 12, 2026 19:13
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.

1 participant