OpenDMA User Guide¶
This guide describes how to integrate and operate odma_core in Direct Register Mode (DR mode, phase a) and in
Scatter/Gather Mode (SG mode, phase b). The register map, the register fields, the descriptor format and the
programming sequences are those of [PG021] (AMD AXI DMA product guide,
version 7.1); this guide states where OpenDMA implements, interprets or omits a part of it. The register map with all
fields is hdl/odma_registers/docs/register_map.md, the C header
sw/odma_regs.h.
1. Sources¶
The synthesis sources are listed in compile_order.txt (generated by python run.py --compile-order) in compile
order. The Open Logic sources go into the VHDL library olo, the OpenDMA sources into the library opendma; the
top level is opendma.odma_core. Open Logic is the submodule open-logic/ (open-space-hdl/open-logic-ft, tag
4.7.0-ft.10). All sources are VHDL-2008.
2. Generics¶
| Generic | [PG021] parameter | Range | Default |
|---|---|---|---|
IncludeSg_g |
c_include_sg |
boolean: false DR mode, true SG mode | false |
IncludeMm2s_g, IncludeS2mm_g |
c_include_mm2s, c_include_s2mm |
boolean, at least one true | true |
LengthWidth_g |
c_sg_length_width |
8 to 26 | 14 |
AddrWidth_g |
c_addr_width |
32 to 64 | 32 |
Mm2sMemWidth_g, S2mmMemWidth_g |
c_m_axi_mm2s_data_width, c_m_axi_s2mm_data_width |
32, 64, 128, 256, 512, 1024 | 32 |
Mm2sStreamWidth_g, S2mmStreamWidth_g |
c_m_axis_mm2s_tdata_width, c_s_axis_s2mm_tdata_width |
8, 16, ..., 1024, at most the memory width | 32 |
Mm2sBurstBeats_g, S2mmBurstBeats_g |
c_mm2s_burst_size, c_s2mm_burst_size |
2, 4, ..., 256 | 16 |
StsCntrlStrm_g, UseRxLength_g |
c_sg_include_stscntrl_strm, c_sg_use_stsapp_length |
false until phase c | false |
MicroDma_g |
c_micro_dma |
false until phase c | false |
Mm2sBufferBeats_g, S2mmBufferBeats_g |
none: depth of the data buffer of a channel in stream beats | at least two bursts (2 x burst x memory width / stream width) | 64 |
Mm2sReadBursts_g |
none: MM2S read bursts in flight | 2 to 8 | 6 |
ExtRegs_g |
none: extension register window 0x100 to 0x1FF | boolean | true |
An inconsistent configuration stops the elaboration with a message that names the generic. The defaults of
IncludeSg_g and StsCntrlStrm_g differ from [PG021] (architecture section 6): a configuration taken from a
system with the vendor core sets them explicitly. Bursts never cross 4 KB, so a channel with a wide memory issues
bursts of at most 4096 bytes whatever the burst generic is (32 beats of 1024 bits). The verification report of
odma_core lists the simulated and the synthesised values of every generic.
Mm2sReadBursts_g sets how many MM2S read bursts are in flight: the read master requests a burst only when its
internal FIFO can hold all its beats, and that FIFO holds Mm2sReadBursts_g bursts. With T stream beats per burst
(Mm2sBurstBeats_g x memory width / stream width, at least 8) MM2S sends one stream beat per clock cycle up to a
memory read latency of (Mm2sReadBursts_g - 1) x T - 8 clock cycles; with the defaults (T = 16) and 6 bursts that
is 72 clock cycles. A burst is at most 4 KB. The internal FIFO is built from registers, which the TMR of the
synthesis tool protects (section 6): Mm2sReadBursts_g x burst beats x (memory width + 1) bits.
| Memory width, burst beats | 2 bursts | 6 bursts (default) | 8 bursts |
|---|---|---|---|
| 32 bits, 16 beats (the defaults) | 1056 bits | 3168 bits | 4224 bits |
| 512 bits, 8 beats | 8208 bits | 24624 bits | 32832 bits |
| 512 bits, 16 beats | 16416 bits | 49248 bits | 65664 bits |
The figures are before TMR. With a wide memory port choose the smallest value that covers the read latency L of the
memory: Mm2sReadBursts_g >= (L + 8) / T + 1; 2 gives the behaviour of OpenDMA 0.1.0.
3. Clock and reset¶
All ports belong to Clk, the synchronous configuration of [PG021]; the core has no clock domain crossing. A
system with other stream or memory clocks places olo_ft_fifo_async (with SyncTmr_g = true) at the ports. Rst
is synchronous and high-active and resets the whole core. It is the reset of the whole AXI domain of the core
and is asserted together with the reset of the interconnect and the slaves on the memory ports, the descriptor
port and the streams (section 8). A soft reset (section 5.4) resets the channels and the registers but not the
AXI4-Lite slave, so that the register access that starts it completes.
4. Interfaces¶
| Interface | Ports | Content |
|---|---|---|
| Register port | S_AxiLite_* |
AXI4-Lite slave, 10 address bits, 32 data bits. Every access gets OKAY; a write uses all 32 bits whatever WStrb holds; offsets without a register read 0 |
| MM2S memory port | M_AxiMm2s_Ar*, M_AxiMm2s_R* |
AXI4 read master: INCR bursts of full-width beats (FIXED bursts of at most 16 beats for keyhole), ArCache 0011, ArProt 000, no ID signals; up to Mm2sReadBursts_g bursts outstanding |
| MM2S stream | M_Mm2s_Data, _Keep, _Last, _Valid, _Ready |
AXI4-Stream master: one packet per transfer, first byte in lane 0, TKeep contiguous from lane 0 in the last beat |
| S2MM stream | S_S2mm_Data, _Keep, _Last, _Valid, _Ready |
AXI4-Stream slave: packets of any length; the bytes of the last beat are those up to the first lane whose TKeep bit is clear; TKeep of the other beats is not used |
| S2MM memory port | M_AxiS2mm_Aw*, M_AxiS2mm_W*, M_AxiS2mm_B* |
AXI4 write master: INCR bursts with write strobes (FIXED bursts of at most 16 beats for keyhole), AwCache 0011, AwProt 000, no ID signals; a burst is requested only when all its data is in the core |
| Descriptor port | M_AxiSg_Ar*, M_AxiSg_R*, M_AxiSg_Aw*, M_AxiSg_W*, M_AxiSg_B* |
SG mode only: AXI4 master with AddrWidth_g address bits and 32 data bits for the descriptors of both channels. A fetch is one INCR burst of 8 beats (descriptor words 0x00 to 0x1C), a status write one beat at descriptor offset 0x1C with all strobes; AxSize 4 bytes, AxCache 0011, AxProt 000, no ID signals; at most one fetch and one status write at a time, the channels served round robin. In DR mode the port is idle and its inputs may stay open |
| Interrupts | Mm2s_Irq, S2mm_Irq |
Level, high-active: the OR of the enabled IOC_Irq, Dly_Irq (SG mode) and Err_Irq flags of the channel |
| ECC interrupt | Ecc_Irq |
Level, high-active: an enabled flag of ECC_STATUS (extension window) |
| Reset outputs | Mm2s_RstOut, S2mm_RstOut |
High-active, during Rst and during a soft reset: reset of the stream peers |
The ports of a channel that the configuration does not include keep constant idle values (valid and ready outputs
'0', burst type INCR, cache 0011, all other outputs 0), and its inputs may stay open. The same holds for the
descriptor port in DR mode, whose AxSize outputs read 4 bytes.
5. Programming sequence¶
5.1 MM2S transfer¶
- Write
MM2S_DMACRwithRS= 1 and, for completion by interrupt,IOC_IrqEnandErr_IrqEn. - Poll
MM2S_DMASRuntilHaltedreads 0. - Write the buffer address to
MM2S_SA, with more than 32 address bits also the upper part toMM2S_SA_MSB. - Write the length in bytes to
MM2S_LENGTH; this write starts the transfer. - Wait for
Mm2s_Irqor poll untilMM2S_DMASR.Idlereads 1. - Clear
IOC_Irqby writing 1 to it inMM2S_DMASR.
The buffer is sent as one packet. Steps 3 to 6 repeat for every transfer while the channel runs.
5.2 S2MM transfer¶
The same steps with S2MM_DMACR, S2MM_DMASR, S2MM_DA, S2MM_DA_MSB and S2MM_LENGTH; the length is the size
of the buffer. After the completion S2MM_LENGTH reads the number of bytes of the received packet. The channel takes
stream data only while it runs; a packet that arrives before its transfer is programmed waits in the data buffer.
5.3 Halt¶
Writing RS = 0 halts a channel; DMASR.Halted reads 1 once it has stopped. A transfer in progress is completed:
MM2S sends it to its end; S2MM writes the chunks of the packet that are complete in its buffer, discards the rest of
the packet up to its TLast and reports no completion for that cut packet (interpretation I8 of odma_registers). A
packet whose TLast the stream port accepted before the halt and whose bytes fit into the buffer is written
completely, and its completion is reported (IOC_Irq in DR mode, RXEOF in its descriptor status in SG mode).
Halted comes once the data received before the halt has been dropped, so a start right after it begins with new
data; it does not wait for the TLast of the discarded rest: the channel keeps dropping its beats while halted, also
when the stream peer never ends the packet, and a soft reset ends that discard. A following start resumes the channel
with the next programmed transfer.
5.4 Errors and soft reset¶
An error halts its channel: DMASR shows the error flag and Err_Irq, DMACR.RS reads 0, and DMASR.Halted
follows when the channel has shut down, a few clock cycles after the interrupt. After an error, software waits for
Halted, reads the flags and resets the core: it writes DMACR.Reset = 1 of either channel and polls until Reset
reads 0. The other channel keeps working until the reset.
| Error | Flags |
|---|---|
| Read response SLVERR or DECERR (MM2S); the packet is still sent completely | MM2S_DMASR.DMASlvErr or DMADecErr |
Write response SLVERR or DECERR (S2MM); no further write for the packet once the error has arrived, the rest of the packet is discarded up to TLast |
S2MM_DMASR.DMASlvErr or DMADecErr, and DMAIntErr |
| EXOKAY response (OpenDMA never requests exclusive access; interpretation I14) | as SLVERR |
| Buffer beyond the top of the address space: no memory access, no stream data | DMADecErr (S2MM also DMAIntErr) |
S2MM packet longer than the buffer: the bytes that fit are written, nothing beyond the buffer, the rest discarded up to TLast |
S2MM_DMASR.DMAIntErr |
The soft reset resets both channels. It stops them at once, completes every AXI transaction the memory has accepted (read data is discarded, write data of accepted bursts is written), takes no S2MM stream data and holds both reset outputs high; the stream peers connected to them abandon their packets. Then the registers return to their reset values, and an error injection pending in an FT buffer is cancelled.
5.5 Scatter/Gather Mode¶
With IncludeSg_g the channels take their transfers from descriptor chains in memory ([PG021], descriptors of
Tables 25 to 40, programming sequence of chapter 4). The registers of DR mode (MM2S_SA, MM2S_LENGTH, S2MM_DA,
S2MM_LENGTH) are replaced by CURDESC, TAILDESC and their MSB registers; DMASR.SGIncld reads 1.
Descriptors and chains:
- A descriptor is 16 words aligned to 64 bytes; the engine reads words 0x00 to 0x1C (
NXTDESC,NXTDESC_MSB,BUFFER_ADDRESS,BUFFER_ADDRESS_MSB, two reserved words,CONTROL,STATUS) and writes only theSTATUSword. The user application words follow with the control and status streams of phase c. - A chain is linked by
NXTDESC; the last descriptor normally points back to the first, as the drivers build their rings. Software clearsCmpltin theSTATUSword of every descriptor it hands to the engine. - Buffers lie at any byte address, also across 4 KB boundaries, with lengths from 1 to 2**
LengthWidth_g- 1. - MM2S: a packet consists of the buffers of the descriptors from one with
TXSOFto the next withTXEOF; the stream carries their bytes without gaps, withTLastonly on the last beat. A descriptor withoutTXSOFafter one withTXEOFstarts a new packet anyway (interpretation SGI-03 ofodma_sg). - S2MM: a packet fills the buffers of the chain in order and continues at byte 0 of the next buffer; the status of
the first buffer of a packet has
RXSOF, that of the lastRXEOF, and the transferred bytes of each buffer. A packet without bytes (only a last beat without valid bytes) gives one status with 0 bytes and both flags (interpretation SGI-13). When the chain has no further descriptor before the tail, the rest of the packet waits at the stream input (TReadylow) until the tail pointer is moved.
Programming sequence of each channel:
- Write the address of the first descriptor to
CURDESC(above 32 address bits alsoCURDESC_MSB) while the channel is halted. - Write
DMACRwithRS= 1, the interrupt enables and, as needed,IRQThreshold,IRQDelayandCyclicBD. - Poll
DMASRuntilHaltedreads 0. - Write the address of the last prepared descriptor to
TAILDESC. This write starts the engine; above 32 address bits writeTAILDESCfirst andTAILDESC_MSBlast, which starts it (interpretation SGI-01 ofodma_sg), as the public drivers do. - The engine fetches the descriptors up to the tail, transfers their buffers and writes their status: transferred
bytes, the error flags, S2MM
RXSOFandRXEOF, andCmplt= 1 after a transfer without error. It fetches one descriptor ahead, so consecutive transfers follow each other without waiting for a fetch. - After the tail descriptor the engine stops and
DMASR.Idlereads 1;CURDESCreads the tail. Software processes the completed descriptors, clears their status and moves the tail pointer, also while the engine still works.
Interrupts: every completed packet counts down the threshold counter; when it reaches 0, IOC_Irq is set and the
counter is reloaded with IRQThreshold. The status words of a packet are in memory before its interrupt flag is set.
With IRQDelay not 0, a packet completion that does not reach the threshold starts the delay timer (units of 125
clock cycles); the first stream beat of the next packet stops and clears it, and when it expires Dly_Irq is set and
the threshold counter reloaded. An MM2S packet can start before the completion of the packet before it, because the
engine issues the next descriptor ahead: the timer then runs during that packet, and Dly_Irq can be set while it is
being sent (interpretation R10 of odma_registers).
Cyclic mode (DMACR.CyclicBD = 1): after the first tail pointer write the engine processes the ring until the
channel is halted or reset, ignores Cmplt of the fetched descriptors and the tail pointer, and still writes the
status of every descriptor.
Halt (RS = 0): the engine issues no further descriptor, the channel ends the transfer in progress as in DR mode,
and its status is written; descriptors fetched but not started keep their status, and CURDESC points to the first
of them. DMASR.Halted is set when the channel and the engine have both stopped.
Errors: each halts its channel with Err_Irq, and CURDESC points to the descriptor of the error. The descriptors
before it are completed with their status; the descriptor after it may also be completed, because it was already
issued (interpretation SGI-08 of odma_sg). For S2MM this happens when the write error of a buffer arrives after the
channel has accepted the next buffer: the channel writes nothing more into it, and its status has the form of a
buffer whose packet a halt cut off, the bytes written, RXSOF as received, RXEOF 0 and Cmplt 1 (no status write
when it received no byte), also when its packet ended in it, so no IOC_Irq follows Err_Irq. When the packet of
the failed buffer continues there, the buffer can hold bytes of that packet; when the failed buffer ended its packet,
it can hold the start of the next packet (interpretation SGI-15). Software that recovers from the error discards
both descriptors.
| Error | Flags |
|---|---|
| Descriptor fetch or status write answered with SLVERR (or EXOKAY) or DECERR | SGSlvErr or SGDecErr |
Stale descriptor: Cmplt = 1 at the fetch outside cyclic mode; the descriptor is not processed and not written |
SGIntErr |
Buffer length 0: no transfer, the status gets DMAIntErr and Cmplt 0 |
DMAIntErr |
Transfer error of the channel (section 5.4): the status gets the flag and Cmplt 0 |
DMASlvErr, DMADecErr (S2MM also DMAIntErr) |
Recovery is the soft reset of section 5.4; in SG mode it also completes every descriptor access the memory has
accepted. A halt or an error inside an MM2S packet of several descriptors ends the packet on the stream: TLast comes
with the last byte of the last descriptor the channel had accepted, before DMASR.Halted is set (interpretation M4
of odma_mm2s). An S2MM packet whose TLast the stream port accepted before the halt and whose bytes fit into the
buffer of the current descriptor is written completely, with RXEOF in its status. A packet that needs a further
buffer is cut like a packet still arriving: the bytes of its complete chunks stay in memory, the rest is discarded
up to its TLast, and the last written status has no RXEOF (interpretation SGI-11 of odma_sg, odma_s2mm
S2-HA-01).
Keyhole (DMACR.Keyhole = 1, for FIFO-like peripherals at a fixed address): the transfers use FIXED bursts of at
most 16 beats at the buffer address with the bits below the memory data width cleared, so every beat accesses the
same memory word. MM2S takes the setting in SG mode only ([PG021] Table 6 gives the bit no function in DR mode,
interpretation I1); S2MM in both modes, taken at the start of each transfer. The stream bytes are packed from lane 0
as for an incrementing transfer of the same length; a buffer address that is not aligned to the memory width is
used with its low bits cleared.
5.6 Extension window¶
With ExtRegs_g the offsets 0x100 to 0x1FF hold an identification word (EXT_ID = 0x4F444D41), the version, the
values of all generics, the ECC counters of the FT buffers, their flags with the enables of Ecc_Irq and an error
injection (register map). The FT buffer indices are 0 MM2S read data, 1 S2MM data, 2 S2MM chunk, 3 S2MM write
data, 4 MM2S transfer and 5 MM2S response; in SG mode 6 MM2S descriptor buffer, 7 S2MM descriptor buffer, 8 read
data and 9 write data of the descriptor port. The other indices count nothing. Software written for [PG021] does
not access the window.
ECC_INJECT flips one bit (single error) or two bits (double error) of the next word written to the selected
buffer, in one of two modes:
ECC_INJECT.Data |
Bits flipped | Effect |
|---|---|---|
| 0 (after every reset) | Parity bits of the code | The data never changes: a single error is corrected, a double error is detected and counted. Safe in a running system |
| 1 | Data bits 0 and 1 | A single error is corrected (data unchanged). A double error corrupts the word: a byte of the MM2S stream (index 0), of the S2MM packet in memory (indices 1 and 3), the length of the MM2S packet (index 4), the result code of the MM2S transfer (index 5, DMADecErr), the length of an S2MM chunk (index 2), the buffer length of a descriptor (indices 6 and 7), the NXTDESC bits 1 and 0 of a fetch, which the engine ignores (index 8), or the transferred bytes of a status word (index 9). For tests only |
6. Protection scope¶
The core is designed for radiation environments together with the triple modular redundancy (TMR) of the synthesis tool, like the Open Logic ft entities it is built on. It protects the parts in the first rows itself and relies on TMR for all other logic:
| Part | Protection | Indication and test |
|---|---|---|
| The FT buffers: MM2S read data, transfer and response buffers; S2MM data, chunk and write data buffers; in SG mode the descriptor buffers of both channels and the read and write data buffers of the descriptor port | SECDED ECC of the Open Logic ft entities: a single error is corrected, a double error is detected and counted; the word of a double error is passed on as read (corrupted data, length, result code or descriptor field of the transfer it belongs to), and the core does not turn the double error into a transfer error | ECC_COUNT_0 to ECC_COUNT_9, ECC_STATUS, Ecc_Irq with ECC_ENABLE; error injection through ECC_INJECT (parity mode non-destructive, data mode corrupts data with a double error, section 5.6) |
| Clock domain crossings and reset synchronisers | The core has none (one clock domain); an olo_ft_fifo_async placed at a port by the integrator uses triplicated synchronisers (SyncTmr_g = true) |
none |
| State machines | Recovery state through the when others branch and the reset |
none |
All other logic: registers of the control and data paths, counters, pointers, pipeline registers, the internal read FIFO of the MM2S read master (Mm2sReadBursts_g bursts) |
TMR of the synthesis tool (for example syn_radhardlevel = tmr with Synplify, or the equivalent setting of the tool chain). The core adds no protection of its own for this logic; without TMR, an upset in it is not covered |
synthesis report |
The integrator:
- enables the TMR of the synthesis tool for the core and the logic around it,
- checks in the synthesis report that TMR was applied, that the synchroniser chains of the crossings were not triplicated a second time, and that no register-based storage meant to be protected by TMR was inferred as a RAM primitive,
- requests safe state machines, so that synthesis keeps the
when othersbranches (AMD Vivado: propertyFSM_SAFE_STATE=default_stateon the state registers; Synplify: attributesyn_encoding=safe), - protects the configuration memory of SRAM-based FPGAs by scrubbing; this is part of the FPGA design, not of the core.
The ECC paths are verified in simulation by error injection. Whether the protection as a whole meets the requirements of a mission is shown by a radiation test with the core in operation (TRL 5).
7. Performance¶
MM2S sends one stream beat per clock cycle when a burst has at least 8 stream beats (burst beats x memory width / stream width), the stream peer is ready and the read bursts in flight cover the read latency of the memory (see below). S2MM issues one write command per chunk of one burst, and only for a chunk that is complete in its data buffer. With equal memory and stream widths the write master issues the burst as soon as the command arrives (low-latency commands); with a wider memory it issues a burst once its data are in its own buffer. The write master overlaps the at least four clock cycles of a command with the data of the command before, so commands cost time with short chunks only. With a memory at least four times as wide as the stream the channel takes one beat per clock cycle. Measured with a memory without latency, a stream without gaps and buffers at burst boundaries (verification reports of the channels):
| Memory / stream width, burst beats | MM2S beats per clock cycle | S2MM beats per clock cycle |
|---|---|---|
| 32 / 32 bits, 16 beats (the defaults) | 1.0 | 0.98 |
| 128 / 64 bits, 32 beats | 1.0 | 1.0 |
| 256 / 128 bits, 4 beats | 1.0 | 0.85 |
| 512 / 256 bits, 8 beats | 1.0 | 0.98 |
| 512 / 512 bits, 2 beats | 0.51 | 0.31 |
| Memory four or more times the stream width | 1.0 | 1.0 |
Short bursts cost the most. A system that needs the full S2MM rate chooses chunks of at least 16 stream beats
(S2mmBurstBeats_g x memory width / stream width) or a memory port at least four times the stream width. A transfer
takes at least four clock cycles in the AXI master for its command, and the register accesses of DR mode add the
time of the processor for every transfer.
With a read latency of L clock cycles (from the read burst to its first beat, the further beats without wait states)
MM2S keeps Mm2sReadBursts_g bursts in flight and sends about min(1, Mm2sReadBursts_g x T / (L + T + 5)) beats
per clock cycle, with T stream beats per burst; section 2 gives the value for a latency and its register cost.
Measured in the MM2S bench (TC-MM-05, 64 bursts, the stream peer always ready):
| Memory / stream width, burst beats (stream beats per burst) | Mm2sReadBursts_g |
Read latency 20 | Read latency 50 | Read latency 100 |
|---|---|---|---|---|
| 32 / 32 bits, 16 beats (16), the defaults | 6 | 1.0 | 1.0 | 0.80 |
| 32 / 32 bits, 16 beats (16) | 2 | 0.77 | 0.45 | 0.27 |
| 128 / 64 bits, 32 beats (64) | 6 | 1.0 | 1.0 | 1.0 |
| 256 / 128 bits, 4 beats (8) | 6 | 1.0 | 0.77 | 0.44 |
| 256 / 128 bits, 4 beats (8) | 8 | 1.0 | 1.0 | 0.60 |
| 512 / 256 bits, 8 beats (16) | 6 | 1.0 | 1.0 | 0.80 |
| 512 / 512 bits, 2 beats (2) | 6 | 0.44 | 0.22 | 0.12 |
The write master keeps at most 8 write bursts open, the most that Open Logic allows; once 8 bursts take less time on the stream than a burst waits for its write response, S2MM slows down. Measured in the core bench (TC-CO-20, buffers of 4 KB, a stream without gaps): the defaults (16 stream beats per burst) keep their rate up to a write response latency of 100 clock cycles; with 8 stream beats per burst (512 / 256 bits, 4 beats) S2MM keeps it up to 50 and reaches 0.59 beats per clock cycle at 100. The unaligned buffers of the defaults, whose chunks are written as two bursts each, likewise keep their rate up to 50 and reach 0.54 at 100. Longer bursts or a wider memory port raise the latency that is covered.
In SG mode the engine processes at most one descriptor per fetch time: about 22 clock cycles per descriptor for one
channel and 40 per channel when both work, with a descriptor memory without latency; a latency of L clock cycles
adds about L per descriptor for one channel and 2 x L per channel for two (verification report of odma_sg). Buffers
that take longer to transfer than a fetch follow each other without a gap on the stream; a chain of many short
buffers runs at the descriptor rate.
An S2MM packet over several buffers continues at a buffer boundary without waiting for the write responses of the
full buffer: the channel accepts the next buffer once the last write command of the full buffer is issued, and the
result of the full buffer waits for its responses meanwhile (odma_s2mm S2-RS-06). The engine keeps a window of two
descriptors per channel: while buffer n waits for its result and buffer n + 1 is written, it fetches the descriptor
of buffer n + 2 once the result of buffer n has been taken. A buffer that fills in less time than the write responses
of the buffer before it take to arrive, together with that fetch, waits at its end for its next descriptor. Measured
in the core bench (TC-CO-20) with packets of 16 KB, a stream without gaps and a memory that is always ready apart from
the write response latency:
| Memory / stream width, burst beats | Write response latency | Pause per buffer boundary | Beats per clock cycle, 1 KB buffers | Beats per clock cycle, 4 KB buffers | Beats per clock cycle, 4 KB buffers at unaligned addresses |
|---|---|---|---|---|---|
| 32 / 32 bits, 16 beats (the defaults) | 0 | 1 clock cycle | 0.94 | 0.95 | 0.90 |
| 32 / 32 bits, 16 beats (the defaults) | 50 | 1 clock cycle | 0.94 | 0.95 | 0.90 |
| 32 / 32 bits, 16 beats (the defaults) | 100 | 1 clock cycle | 0.94 | 0.95 | 0.54 |
| 512 / 256 bits, 4 beats | 0 | 6 clock cycles | 0.71 | 0.80 | 0.68 |
| 512 / 256 bits, 4 beats | 50 | 38 clock cycles | 0.47 | 0.80 | 0.56 |
| 512 / 256 bits, 4 beats | 100 | 51 clock cycles | 0.34 | 0.59 | 0.31 |
With the defaults a buffer of 1 KB fills in 256 clock cycles and its boundaries cost one clock cycle up to a latency of 100. With 512 / 256 bits it fills in about 40 clock cycles, so its boundaries wait for the next descriptor at every latency. At a latency of 100 the 8 open write bursts slow the 4 KB buffers of 512 / 256 bits and the unaligned buffers of the defaults as well (see above).
Packets that fit into one buffer do not pause; buffers of several KB keep the loss small. A buffer address that is
not a multiple of the memory word can cost time: a full chunk then covers one memory word more than a burst holds
and is written as two bursts. In SG mode the chunks follow the address of the buffer (odma_s2mm S2-ST-04):
- At a multiple of the stream width the first chunk ends at the burst boundary above the address and the later chunks are aligned, so the buffer takes no longer than an aligned one (no clock cycle more per KB with 64 / 8 bits and 2-beat bursts, TC-CO-20).
- Inside a stream word the chunks are one memory word shorter, one burst each, when the memory is wider than the stream and a burst has at least 8 beats. Otherwise they keep their full size: 14 clock cycles more per KB with the defaults and 7 with 512 / 256 bits and 4-beat bursts (TC-CO-20, write response latency 0).
In DR mode every chunk has its full size. Buffers at multiples of the memory word avoid the cost in both modes. The MM2S join of several buffers costs at most one clock cycle per packet.
8. Integration constraints¶
| Constraint | Reason |
|---|---|
| TMR of the synthesis tool enabled for the core | The core protects its FT buffers itself and relies on TMR for all other logic (section 6) |
| The memory answers every burst in order (no ID signals) | The masters use one ID for all transactions |
The stream peers are reset by Mm2s_RstOut and S2mm_RstOut |
A soft reset ends the packets in progress; a peer that continues a packet sends its rest as a new packet |
Rst only together with the reset of the interconnect and the slaves on M_AxiMm2s_*, M_AxiS2mm_*, M_AxiSg_* and the streams |
Rst abandons the outstanding AXI transactions of the core; a slave that is not reset would still return their responses. AXI4 resets the master and the slave of an interface together (Arm AMBA AXI Protocol Specification, IHI 0022, section "Reset"). A stop that keeps the buses running is the soft reset (DMACR.Reset) or a halt |
| One clock for all ports | Synchronous configuration; asynchronous stream or memory clocks need FIFOs at the ports (section 3) |
StsCntrlStrm_g, UseRxLength_g and MicroDma_g false |
The control and status streams and the micro DMA follow in phase c |
| Keyhole buffers aligned to the memory data width | The address bits below the memory width are ignored for FIXED bursts |
| SG mode: the descriptor memory answers in order (no ID signals) and holds descriptors aligned to 64 bytes | The descriptor port uses one ID; bits 5 to 0 of the descriptor pointers are ignored |
9. Conformance¶
Implemented ([PG021] references in the compliance matrix, docs/compliance.md):
- Register map and fields of DR mode, the programming sequences of DR mode for both channels, the halt, the soft reset, the interrupt outputs and their enables, the reset outputs.
- Transfers at any byte address and of any length up to 2**
LengthWidth_g- 1 bytes in every width configuration (the function of the data realignment engine, also for streams wider than 512 bits), 4 KB and burst splitting. - The configuration generics of Table 44 listed in section 2, with the ranges of [PG021].
- Scatter/Gather Mode: the register map with
CURDESCandTAILDESC, the descriptors without user application fields, the tail pointer mode, cyclic mode, interrupt coalescing with the threshold and the delay timer, the errors of the engine, packets of one or several descriptors in both channels. - Keyhole transfers with FIXED bursts (MM2S in SG mode, S2MM in both modes, interpretation I1).
DMASlvErrandDMADecErr(SGSlvErrandSGDecErrfor descriptor accesses) from the response codes of the memory.
Not implemented: control and status streams with the user application fields, the receive length in the status stream, micro DMA (phase c). Not in scope: multichannel mode and the asynchronous clock configuration.
10. Verification and tools¶
Each module has a specification, an architecture, a verification plan and a verification report in
hdl/<module>/docs/. The core tests (odma_core) execute the programming sequences of a model written from
[PG021] against the assembled core in seven DR and five SG configurations. python run.py runs the full
regression with GHDL, python lint/synth_check.py the synthesis check of the generics,
python tools/compliance.py --check the traceability to [PG021]. The technology readiness level is stated in the
README and the roadmap.