Shared Memory (histogram)
The shared-memory pattern moves the data off the control plane and into
memory: the accelerator reads its inputs and writes its outputs over an AXI4
memory-mapped (m_axi) master, while a dedicated AXI4-Stream still carries the
command and the status response. It is the next step in the
examples progression after in-band stream control — control stays on a
stream, but the payload now lives in shared memory addressed by pointers in the
command.
The vehicle is a histogram accelerator (examples/shared_mem/, computation
files keep the hist name): given a command carrying three buffer addresses, it
reads ndata float samples and nbins-1 float bin edges from memory, bins the
samples, and writes nbins uint32 counts back to memory.
This makes it the first example to exercise, over one m_axi bundle:
- Multiple distinct buffers at independent addresses (
data_addr,bin_edges_addr,cnt_addr). - Two element types —
Float32inputs/edges andUint32counts. - Validation → status —
ndata/nbinsbounds checks select aHistErrorinto the response before any memory access.
Like the other full examples it walks all five stages — Python model → SimPy
simulation → code generation → C and RTL simulation → timing extraction — with
the kernel and testbench generated from the Python HistAccel component. It is
the reference design for AXI-MM (m_axi) codegen.
Walkthrough
- Understanding AXI Memory-Mapped — what
m_axiis (burst transfers, byte-addressed pointers into shared DRAM), and the shared-memory architecture: bulk data in memory, command/response on a dedicated stream. - Python model — the
HistAccelcomponent, theHistCmd/HistResp/HistErrorschemas, and theMMIFMaster(read_array/write_array) interface. - Python simulation — the SimPy harness (
HistController+MemComponent) and parity against the numpy golden. - Code generation — lowering
HistAccel/HistTBHlsto the multi-buffer m_axi Vitis HLS kernel and testbench. - C and RTL simulation — the four-case C-sim coverage, C-synthesis, RTL co-simulation, and multi-buffer burst extraction.
- Viewing timing and bursts — the committed timing/burst figures and the workflow for refreshing them.