Xilinx
Block Preview

Introduction

Port of KriaTest stream_ser + chunk_packer (round 3, AGENT/17). The clock crossing and the UDP stack live in the AMD_KRIA board; this block runs entirely in the CLK_ACQ domain (250 MHz) and its outputs are exactly the board socket (TDATA, TVALID, TLAST, LEN_DATA, LEN_VALID; inputs TREADY, LEN_READY, EMPTY), so it connects 1:1 to UDP 10G Stream.

Input: the EVT_DATA / EVT_FRAME_HI / EVT_VALID outputs of the Multichannel Delay Buffer (wtype 0x1 sample, 0x2 hitmap, 0x3 timestamp), or any 64-bit word stream. With Number of sources > 1 further sources (EVT_DATA_1 …) are merged round robin.

Pin Description

EVT_DATA Input 64 bit BIT VECTOR
64-bit event word (source 0).
Default: Must be connected
EVT_FRAME_HI Input 16 bit BIT VECTOR
frame_ctr[31:16] of EVT_DATA (needed for the 32-bit frame counter of chunk headers).
EVT_VALID Input 1 bit BIT
Word valid.
Default: Must be connected
TREADY Input 1 bit BIT
Board socket: room for >= 16 words (default 1 when unconnected).
LEN_READY Input 1 bit BIT
Board socket: room in the length queue (default 1).
EMPTY Input 1 bit BIT
Board socket: data FIFO empty (default 1).
CLK Input 1 bit BIT
CLK_ACQ.
Default: Default Board Clock
RESET Input 1 bit BIT
Synchronous reset (starts a 256-cycle state clear).
Default: Default Board Reset
TDATA Output 64 bit BIT VECTOR
Word for the board (SER10G_S_TDATA).
TVALID Output 1 bit BIT
Word valid, never high while TREADY is low.
TLAST Output 1 bit BIT
Always 0.
LEN_DATA Output 8 bit BIT VECTOR
Declared datagram length in words (1..128), chunk16 only.
LEN_VALID Output 1 bit BIT
Length entry valid (one clock, after the words of the packet).
EVT_DATA_1 .. EVT_DATA_3 / EVT_FRAME_HI_n / EVT_VALID_n 64 bit
Additional sources (Number of sources 2..4).

Properties

Property window

Endpoint Name EndpointName

Name of the register endpoint. Registers are REG___WR/_RD (KriaTest regmap page names: use DDC / CHAN / TRIG / GATE to get the exact KriaTest net names).

Register endpoint name (default SER).

Default: SER

Number of sources NumSources

Event-word sources (EVT_DATA, EVT_DATA_1 …). 1 = pure wire into the packer; >1 merges round robin through one FIFO per source (word dropped and counted in STREAM_DROP_COUNT when its FIFO is full).

1..4 event-word sources. 1 = wire into the packer.

Default: 1

Options: 1 2 3 4

Elastic output queue (words) OutputQueueWords

Chunk-mode queue between the packer and the board (G_OUTQ_WORDS, power of 2). KriaTest: 16384 = 128 KiB = 4 UltraRAM, ~110 us at full rate. Smaller values save UltraRAM and lower the burst that is absorbed before whole chunks are dropped.

Elastic queue between packer and board, power of 2 (KriaTest 16384 = 4 UltraRAM).

Default: 16384

Options: 256 512 1024 2048 4096 8192 16384

Max packet length (words) MaxPacketWords

Largest declared datagram (LEN_DATA). A chunk is 9 words and never straddles two datagrams. The board accepts 1..128 (KriaTest DATA_PKT_WORDS = 128).

Largest declared datagram, 32/64/128.

Default: 128

Options: 32 64 128

Merge FIFO depth (log2) SourceFifoDepth

Depth of the per-source FIFO used when Number of sources > 1 (2^n words).

log2 depth of the per-source merge FIFO (Number of sources > 1).

Default: 5

Options: 3 4 5 6

Packet age bound (cycles) PacketIdleCycles

A packet open for this many CLK cycles is declared short (latency bound, G_PAD_IDLE). KriaTest 1024; keep it below the board UDP flush timeout.

Age after which an open packet is declared short (latency bound; KriaTest 1024).

Default: 1024

Options: 64 256 1024

Resync gap at raw -> chunk entry (cycles) ResyncCycles

Quiet cycles after the board FIFO drained before the first chunk of a raw -> chunk16 switch (G_RESYNC). KriaTest 4096; must exceed the board UDP flush timeout (1024 phy cycles).

Quiet gap at raw -> chunk16 entry (KriaTest 4096, must exceed the board flush timeout).

Default: 4096

Options: 64 512 4096

Partial-chunk flush tick (log2 cycles) FlushLog2

A partial chunk with no new sample for 1..2 ticks of 2^n cycles is flushed (G_FLUSH_LOG2). KriaTest 18 = ~1 ms at 250 MHz.

Partial-chunk flush tick, 2^n cycles (KriaTest 18).

Default: 18

Options: 6 10 14 18

KriaTest stream control KriaStreamControl

Adds the KriaTest stream_ser control plane: STREAM_CTRL (b0 enable, b1 patgen_en, b4 counters_reset write-1-to-pulse), SRC_SEL (b0 port0 = EVT words, b1 port1 = pattern generator), PATGEN_PERIOD, STREAM_PKT_COUNT_P1 / STREAM_DROP_COUNT_P1. The pattern generator emits wtype 0x4 ramp words in raw mode. All registers reset to 0: the stream is OFF until software sets enable and port0_en (KriaTest reset). Off = no extra registers, stream always on.

KriaTest STREAM_CTRL / SRC_SEL / PATGEN_PERIOD control plane + wtype 0x4 pattern generator (default off).

Default: False

Usage

Formats (register STREAM_FMT, bit 0)

value format
0 raw: words leave bit-identical, no LEN entries (the board falls back to 128-word datagrams + flush timeout). A word presented while TREADY is low is discarded and counted (STREAM_DROP_COUNT) - TVALID is never raised without TREADY.
1 chunk16: wtype 0x5 header + 8 data words = 16 samples of one channel (header: ch, n_valid 1..16, flags b0 first / b1 last, 32-bit frame counter of the first sample). 0x2/0x3 words pass through between chunks. Packet lengths are DECLARED on LEN_* (words first, length last): a chunk never straddles a datagram. A chunk completed while the previous chunk of the same channel is still queued is dropped whole and counted (CHUNK_DROP_COUNT).

The format is latched at a packet boundary. Entering chunk16 waits for the board FIFO to be empty (EMPTY) and then stays quiet for Resync cycles, so the first chunk starts a datagram. A few samples are lost across the switch (256-cycle state clear + the resync gap): switch while the stream is idle, or stop the source first.

Flow control (board socket)

  • TREADY = board FIFO has room for >= 16 words. Chunk mode drains its elastic queue only while TREADY is high (nothing is lost to a slow link; overload becomes whole-chunk drops). The board FIFO must be deeper than one packet (board: 1024 words, packet <= 128), otherwise the datapath deadlocks.
  • LEN_READY = room in the length queue; a packet is only opened when there is room to declare it.
  • EMPTY (optional, default 1 when unconnected) = board FIFO empty.
  • TLAST is driven 0 (the board ignores it).

Registers (endpoint = EndpointName, default SER)

register access meaning
STREAM_FMT W b0: 0 raw, 1 chunk16
CHUNK_DROP_COUNT R whole chunks dropped (overload)
STREAM_STATUS R b0 chunk_mode_active (may lag STREAM_FMT by some microseconds)
STREAM_DROP_COUNT R raw-mode words discarded while TREADY was low + merge-FIFO overflows
STREAM_PKT_COUNT R words presented to the board
Status registers cross into the bus clock without CDC (repo convention).

KriaTest stream control (property KriaStreamControl)

Adds the KriaTest stream_ser control plane and its pattern generator (port 1, wtype 0x4 ramp). Registers appended after the ones above:

register access meaning
STREAM_CTRL W b0 enable, b1 patgen_en, b4 counters_reset (write-1-to-pulse). b2/b3 ignored (hitmap/timestamp enables live in the Multichannel Delay Buffer GATE CTRL)
SRC_SEL W b0 port0_en (EVT words), b1 port1_en (pattern generator) - two enables, not a mux
PATGEN_PERIOD W clock cycles between ramp words (min 2)
STREAM_PKT_COUNT_P1 R ramp words sent
STREAM_DROP_COUNT_P1 R ramp words dropped (4-word holding FIFO full, or chunk mode)
Port-0 words pass only with enable AND port0_en (otherwise discarded, not
counted); STREAM_PKT_COUNT then counts port-0 words only. Ramp words are
inserted in free slots (no event word, TREADY high) in RAW mode only - in
chunk16 the generator must be off (KriaTest rule), its words are dropped and
counted. counters_reset zeroes the PKT/DROP counters of both ports and the
ramp, not CHUNK_DROP_COUNT. All registers reset to 0: the stream is OFF
until software sets enable and port0_en (KriaTest reset values).

Not ported

Channel count is fixed at 256 (assembly RAM = 1 UltraRAM plus the elastic queue; ram_style “ultra”, UltraScale+ only).

Resources & Timing

  • Latency: NumSources=1: raw 0 clocks (wire); chunk16 up to a packet age (<= Packet age bound) + queue

  • Throughput: raw 1 word/clock; chunk16 16 samples per 9 words

Assembly RAM 1 UltraRAM (4096x64) + elastic queue (OutputQueueWords x 64, UltraRAM). Verified in GHDL (tb/kria_serializer): chunk16 format and datagram parsing against a model of the board socket, raw bit-identity, back-pressure on TREADY, whole-chunk drops, mode switching, merge of two sources; KriaTest’s own tb_chunk_packer on the renamed copy.