Xilinx
TM
Block Preview

Introduction

Averaging $M$ spectra of a stationary signal reduces the noise-floor variance by $M$ while leaving coherent lines untouched:

$$ \bar{X}[k] = \frac{1}{2^{NAVG}}\sum_{m=0}^{2^{NAVG}-1} X_m[k] $$

The block consumes the gapless TM spectrum format of FFT TM Realtime and FFT Windowed TM: every CE-gated clock carries $R$ bins (TM Factor lanes), with lane $q$ carrying bin $k + q,N/R$ at DV cycle $k$ and START (chain FRAME_START) marking the first cycle of each frame. Each lane is accumulated independently into a BRAM accumulator; when $2^{NAVG}$ complete spectra have been summed the averaged spectrum streams out.

Two output formats are available (compile-time property, both from the same accumulator):

  • TM (R bins per clock) — the average leaves in exactly the input packing and lane mapping, as an $N/R$-clock burst: drop-in for anything that already consumes the TM FFT stream (e.g. IFFT TM Realtime).
  • Serialized (one bin per clock) — the average leaves as a non-TM sequential burst in natural bin order $0 \ldots N-1$ ($N$ clocks), i.e. the same format the scalar FFT block emits: chain it to the scalar IFFT, to a DMA, or to any scalar-burst consumer. The serializer sweeps the accumulator once per lane (lane $q$ outer, row $k$ inner), which is exactly natural order thanks to the TM lane mapping.

NAVG is a runtime input (log2 of the number of spectra, e.g. 10 → 1024), clamped to the compile-time Max averages budget and latched at the start of every round. The accumulator is ping-pong double buffered, so accumulation of the next round proceeds while the previous average streams out and its memory is cleared row by row.

Pin Description

IN_RE Input 32 bit TM
Real parts of the incoming spectrum, TM packed: R lanes of InputBits, slot 0 in the LSBs. At DV cycle k lane q carries bin k + q*N/R (the FFT TM Realtime mapping).
Default: Must be connected
IN_IM Input 32 bit TM
Imaginary parts of the spectrum (same packing and timing).
Default: Must be connected
CE Input 1 bit BIT
Clock enable / row valid, active high. Chain the DV output of the TM FFT. Default when unconnected: ‘1’.
Default: 1
START Input 1 bit BIT
Pulse high on the first DV cycle of every input frame (chain FRAME_START). Resynchronizes the row counter.
Default: Must be connected
NAVG Input 5 bit BIT VECTOR
Runtime log2 of the number of spectra to average (5 bit), clamped to log2(Max averages), latched at the start of every round. Default when unconnected: 0.
CLR Input 1 bit BIT
Synchronous clear, active high: discards the accumulation in progress and restarts. Default: ‘0’.
CLK Input 1 bit BIT
Clock. Rising edges drive all operations.
Default: Default Board Clock
RESET Input 1 bit BIT
Global reset: same effect as CLR.
Default: Default Board Reset
OUT_RE Output 32 bit TM
Real part of the averaged spectrum. TM mode: R lanes (input mapping preserved), N/R-clock burst. Serialized mode: one bin per clock in natural order 0..N-1, N-clock burst. Per-bin width per the Output format property.
OUT_IM Output 32 bit TM
Imaginary part of the averaged spectrum (same timing).
START_OUT Output 1 bit BIT
One-cycle pulse on the first output cycle (bin 0).
DV_OUT Output 1 bit BIT
High for the whole averaged output burst.
BUSY Output 1 bit BIT
High while the averaged spectrum is being streamed out (from the internal buffer swap up to and including the last DV_OUT cycle).
AVG_CNT Output 11 bit BIT VECTOR
Realtime progress: complete spectra accumulated so far in the current round (wraps to 0 when the round completes).

Properties

Property window

Length Length

Number of bins of one FFT frame. Must match the Length of the TM FFT block feeding this averager.

Number of bins N of one spectrum (64 .. 65536, power of 2). Must match the Length of the TM FFT feeding the averager, and be at least 2 x TM Factor.

Default: 1024

Options: 64 128 256 512 1024 2048 4096 8192 16384 32768 65536

TM Factor TMFactor

Number of TM lanes R of the input spectrum stream (must match the source TM FFT).

Number of TM lanes R of the input stream (2 .. 32, power of 2). Must match the source TM FFT.

Default: 4

Options: 2 4 8 16 32

Input bits InputBits

Width of one IN_RE / IN_IM lane (the TM FFT blocks output 32 bit per lane).

Width of one IN_RE / IN_IM lane (8..48, signed). The TM FFT blocks output 32 bit per lane.

Default: 32

Range: 8 – 48

Max averages MaxAverages

Largest number of spectra the runtime NAVG input can request. Sizes the accumulator BRAM: each of the 2 x Length bins stores 2 x (InputBits + log2(MaxAverages)) bits.

Largest number of spectra the runtime NAVG input can request (2 .. 65536, power of 2). Sizes the BRAM accumulators.

Default: 1024

Options: 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536

Output format OutputFormat

Same as input (rounded): each output bin is InputBits wide, average rounded half-up. Fixed point (+16 fractional bits): each output bin is InputBits+16 wide and EXACT, the 16 extra LSBs are fractional bits.

  • Same as input (rounded): each output bin is InputBits wide, rounded half-up.
  • Fixed point (+16 fractional bits): each output bin is InputBits+16 wide and exact (Q x.16).

Default: Same as input (rounded)

Options: Same as input (rounded) Fixed point (+16 fractional bits)

Output stream OutputStream

TM (R bins per clock): the averaged spectrum leaves with the same TM packing and lane mapping as the input (N/R clocks). Serialized (one bin per clock): non-TM sequential burst in natural bin order 0..N-1 (N clocks), directly compatible with the scalar FFT burst consumers. With serialized output and gapless TM input, NAVG must be >= log2(TM Factor) or completed rounds are dropped while the previous burst is still streaming.

  • TM (R bins per clock): averaged spectrum in the input TM packing and lane mapping, N/R-clock burst.
  • Serialized (one bin per clock): non-TM sequential burst in natural bin order 0..N-1 (N clocks) — the scalar FFT burst format. With gapless TM input use NAVG >= log2(TM Factor).

Default: TM (R bins per clock)

Options: TM (R bins per clock) Serialized (one bin per clock)

Chaining from the TM FFT blocks

  • OUT_RE → IN_RE, OUT_IM → IN_IM (TM pins, same TM Factor)
  • FRAME_START → START
  • DV → CE

Leaving CE unconnected ties it to ‘1’; leaving NAVG unconnected gives $2^0 = 1$ (passthrough).

Output scaling

Same options as the scalar FFT Average:

  • Same as input (rounded) — each output bin is InputBits wide, average rounded half-up. No overflow is possible.
  • Fixed point (+16 fractional bits) — each output bin is InputBits + 16 wide and exact; the 16 extra LSBs are fractional bits with the input integer scaling (Q x.16, ready for the Fixed P. family).

Round lifecycle

  1. Every CE clock accumulates one TM row ($R$ bins); START resynchronizes the row counter.
  2. AVG_CNT reports in realtime how many complete spectra of the current round have been accumulated.
  3. When the round completes the buffers swap and the average streams out (START_OUT + DV_OUT, BUSY high for the whole burst): $N/R$ clocks in TM mode, $N$ clocks serialized. Rows are cleared right after their last read.
  4. CLR (or RESET) discards the round in progress and restarts from zero.

Throughput limit of the serialized output

The serialized burst is $N$ clocks while a round lasts at least $(N/R)\cdot 2^{NAVG}$ input clocks: with gapless TM input, choose $NAVG \geq \log_2 R$ (e.g. $R = 4$ → at least 4 averages) or rounds that complete while the previous burst is still streaming are dropped (accumulation itself never stops, and the TM output mode only has the scalar $NAVG = 0$ corner). In practice any real averaging setting is safe.

Resources

Two BRAM buffers of $N/R$ rows, each row $2R,(\text{InputBits} + \log_2\text{MaxAverages})$ bits — the total bit count is the same as the scalar block for equal $N$. No DSP, no HLS: pure VHDL.

Verified with a self-checking GHDL regression (4 TM configurations — TM and serialized outputs, TM factors 2/4/8, both scalings — 556 checks: lane mapping, natural-order serialization, rounding on negative accumulations, CE gaps, buffer reuse, mid-round CLR, runtime NAVG change, DV/START_OUT/BUSY framing, AVG_CNT progress; mutation-tested).