AXI-MM
Background: what AXI-MM is
AXI (Advanced eXtensible Interface) is the on-chip interconnect protocol of Arm’s AMBA family, and the standard way blocks are connected on AMD FPGAs and SoCs: processors, DMA engines, memory controllers, peripherals, and accelerator kernels all speak it. It comes in two kinds:
- AXI memory-mapped (AXI-MM) — transactions carry an address. A read asks for the words at an address; a write delivers words to one. This is how a processor programs a peripheral’s registers, how a kernel reads a buffer in DDR, and how one block fills another’s memory.
- AXI-Stream — no addresses at all: data flows from producer to consumer in order, with a
valid/ready handshake per word. In Waveflow that is a
StreamIF, and it is what free-running kernels use between themselves.
Every AXI-MM connection has two sides:
- the master initiates each transaction — it presents the address and asks to read or write;
- the slave responds — it decodes the address and returns or accepts the data.
A master may reach several slaves, and a slave may be reached by several masters, through an interconnect (a crossbar) that routes each transaction to the slave owning its address. AXI-MM comes in two strengths: full AXI4, whose transactions are bursts of up to 256 words, used for memory; and AXI4-Lite, one word per transaction, used for control registers.
In Waveflow, AXI-MM is an interface
Waveflow models AXI-MM as an interface — the same kind of object as a stream: something that connects modules and carries transactions between them. The interface has a master side and a slave side, and a module takes part by owning an endpoint on one of them:
- an
MMIFMasterendpoint issues reads and writes — in bursts, typed or raw; - an
MMIFSlaveendpoint answers them, through callbacks its module supplies; - the interface that joins them is either a
DirectMMIF(one master to one slave) or anAXIMMCrossBarIF(many masters to many slaves, routing each transaction by address — the crossbar).
There is one such model, and both flows use it unchanged. Modeling memory-mapped traffic is that model in detail — endpoints, interconnects, the latency model. The rest of this page is about how each side becomes hardware, which is where the flows differ.
What decides the realization: what Vitis HLS can generate
What differs between the flows is how each endpoint becomes hardware, and that comes down to what Vitis HLS can generate for a kernel:
| Vitis HLS can generate it? | host-activated kernel | free-running kernel | |
|---|---|---|---|
an AXI master (m_axi) |
yes | the kernel’s own MMIFMaster becomes an m_axi port its body reads and writes |
yes, but only inside a master adaptor — MemRStream / MemWStream — never in the kernel’s own logic |
an AXI-Lite register file (s_axilite) |
yes | the kernel’s register map | unusable: a free-running kernel cannot see a write happen |
| an AXI4-full slave | no | — | a slave adaptor — hand-written Verilog beside the kernel |
Everything around the kernel is the same in both flows: a memory is a MemoryMod (an MMIFSlave), a
host is a module holding an MMIFMaster, and the interconnect is a DirectMMIF or an
AXIMMCrossBarIF. At RTL, in an XSI simulation, the memory and the
host become C++ BFMs and the crossbar becomes AMD’s axi_crossbar IP.
A free-running kernel reaches the bus through adaptors
A free-running kernel’s own logic sees only streams. Every synchronization it takes part in is a stream message — that is what keeps the order of events in a design of concurrent tasks defined. So whenever it touches AXI-MM, an adaptor sits between it and the bus, converting stream messages to bus transactions or back:
flowchart LR
subgraph vk["Vitis kernel"]
direction TB
K["kernel<br/>(stream-only)"]
MA["master adaptor<br/>MemRStream / MemWStream<br/><i>a kernel module</i>"]
end
SA["slave adaptor<br/>queues · register bank · BRAM window<br/><i>an RTL module</i>"]
X(("AXI<br/>crossbar"))
MEM["memory,<br/>other slaves"]
HOST["host,<br/>other masters"]
K <-- "stream" --> MA
K <-- "stream" --> SA
MA <-- "m_axi (master)" --> X
SA <-- "AXI4 (slave)" --> X
X <--> MEM
X <--> HOST
Every link carries data both ways. Who initiates differs by side: on the master side the master adaptor starts each transaction (reading from or writing to memory); on the slave side a host or another master starts it, and the slave adaptor answers.
The two adaptors sit in different places for one reason — what HLS can generate:
- The master adaptor is a kernel module. HLS generates
m_axiports, soMemRStreamandMemWStreamare ordinary tasks inside the Vitis kernel, each owning one port and turning a command stream into AXI bursts. See Master side. - The slave adaptor is an RTL module. HLS cannot generate an AXI4-full slave, so the slave side is hand-written Verilog in the RTL top, turning bus transactions into the stream messages the kernel reads. See Slave side.
Either way the kernel is written the same way: it reads and writes streams, and never an address. This is one instance of the rule every free-running design follows – see Stream-only modules and adaptors.
Pages
- Modeling memory-mapped traffic —
MMIFMaster/MMIFSlave,DirectMMIF,AXIMMCrossBarIF, the latency model; the model both flows share. - AXI crossbar — the interconnect in both backends:
AXIMMCrossBarIFin pysim, AMD’saxi_crossbarIP at RTL; describing, generating and instantiating it, what it costs, and how the pysim model is set to match. - Master side — streaming memory kernels —
MemRStream/MemWStream: how a free-running kernel reads and writes memory. - Slave side — memory-mapped adaptor — queues, a register bank and a BRAM window behind one AXI slave port: how a free-running kernel is reached, and the ordering guarantee.
- Slave adaptor views — each view’s constructor, its kernel side and its bus side.
- Slave adaptor — how it works — the RTL modules, the front end, and how closely pysim matches RTL.
- MM-streams with credit — a stream between two kernels over the shared bus: why back-pressure cannot cross it, and the credit pattern that does.
- Credit streams in HLS — the two ends in a kernel body
(
credit::Producer/credit::Consumer), written in chunks. - Register Maps — the AXI-Lite register file of a host-activated kernel.
Table of contents
- Modeling memory-mapped traffic - Memory-mapped interfaces in the SimPy model — MMIFMaster/MMIFSlave endpoints, the AXIMMCrossBarIF (FULL/LITE, address routing) and DirectMMIF, and read/write/read_schema/read_array, with a runnable two-SimObj DirectMMIF toy.
- AXI crossbar - The interconnect between bus masters and slaves, in both backends: AXIMMCrossBarIF in pysim, and AMD's axi_crossbar IP -- generated by create_ip from an AxiXbarConfig -- at RTL, so the cycle counts measured through it are the board's. How to describe one, generate it, instantiate it in an RTL top and drive it from a testbench; what it costs, measured; how the pysim model is set to match; and how it relates to the FPGA part and the platform model.
- Master side — streaming memory kernels - MemRStream and MemWStream give memory a command-based transactional interface: a kernel sends a read or write command on a stream and the component runs the burst. In the in-band protocol every design uses, a command also says how many following bursts to relay untouched, so a descriptor can ride with the data to whichever stage needs it, and the writer's echo of it is the completion.
- Slave side — memory-mapped adaptor - How a free-running kernel is reached by a bus master — a host or another kernel — when Vitis HLS cannot generate an AXI4-full slave. An adaptor in the RTL top turns bus transactions into stream messages, so the kernel still sees only streams. The four views (queue in, queue out, register bank, BRAM window) and how to build an adaptor from them; one adaptor or one per view; the ordering guarantee and its measured scope; a runnable example.
- Slave adaptor views - The views of the memory-mapped slave adaptor — queue in, queue out, register bank, BRAM window, and credit in (the producer end of a credit stream routed over the bus). For each: what it is for, its constructor, what the kernel does with it, and what a bus master does with it. Also: register bank versus register map, and the BRAM window's three RTL leaves (two cycles a read word, or one with the response unregistered or registered) and the bus side's calibrated timing.
- Slave adaptor — how it works - Internals of the memory-mapped slave adaptor, for readers changing or verifying it: the RTL modules and the generated decoder, the AXI front end, what each view does in RTL, why the register bank needs no lock, serialize_transactions in pysim, the AXI crossbar, how closely pysim matches RTL, and the gates.
- MM-streams with credit - A stream between two kernels carried over a shared memory-mapped bus: the producer writes the consumer's queue-in view. Why ordinary back-pressure does not work there -- a write into a full queue stalls the bus, which can deadlock it -- and the design pattern that does: credit. The producer writes only what it knows fits; the consumer returns a cumulative count of words consumed into a credit register. MmCreditStreamIF routes a CreditStreamIF this way with the kernels' code unchanged. How to build one, the three properties that make it safe on a shared bus, how to size it (a FIFO in front of the store-and-forward writer; a credit window covering the bandwidth-delay product), and several writers.
- Credit streams in HLS: chunked writes - Writing the two ends of a credit stream in an HLS kernel body: the framework's credit::Producer and credit::Consumer (credit_stream_hls.h), and the chunked-write pattern they serve -- the producer admits each chunk with wait_room before a pipelined II=1 loop and records it with sent; the consumer counts what it takes and offers credit between chunks. Why credit is never checked inside the loop, the max_write limit on a chunk, and the worked code from examples/markov.
- Register Maps - The AXI-Lite register map as an interface — RegField / RegAccess (R, W, RW, W1C, W1S), the auto-assigned offset table, the RegMapMMIFSlave read/write dispatch, composite and bit-packed fields, and the per-transaction hook contract. axilite_slave is its own kind_of_endpoint boundary kind. The launch lifecycle layered on top of it — VitisRegMap's ap_ctrl_hs and the BoundRegMap host surface — is a separate page.