Skip to main content

Module array

Module array 

Source
Expand description

The array’s processing element as Verilog: two weight rows’ partial dot products with one token-row’s activations, four multiply-adds a DSP block.

A Stratix 10 DSP block in its multiplier-adder sum mode computes ax·ay + bx·by plus the chain-in of the block before it, its operands two’s complement (19 bits for ax/bx, 18 for ay/by; unsigned operands only as 18×18), the chain 64 bits wide. The element packs two rows into each 19-bit operand: W = q₁ + (q₂ − 8)·2^15 for 4-bit digits q₁ (row one) and q₂ (row two), which lies in [−2^18, 2^18); the activation excess codes a′ = a + 128 (0..255) ride the 18-bit operands. A chain of CHAIN blocks sums L + H·2^15 with L = Σ a′·q₁ ≤ 8·255·15 < 2^15 never negative and H = Σ a′·(q₂ − 8) signed, so the two rows split from the chain’s two’s-complement sum exactly: L its low 15 bits, H the rest shifted down. Row two’s partial is H + 8·Σa′.

logos_dsp_sum2 is the block’s arithmetic, behavioural for simulation; synthesis maps it to the device’s DSP block in that mode. logos_pe8 chains four and splits the lanes; logos_subdot32 sums four elements into a 32-element sub-block’s two partials. logos_pe8_p is logos_pe8 for the user clock, systolic: each block’s sum registered on the chain, block k’s activations given k clocks after block 0’s (logos_column_act_stagger delays them once for every core) and its digits delayed k clocks to meet them, the lanes PE8_P_LATENCY clocks after block 0’s operands.

Constants§

CHAIN
DSP blocks a processing element chains.
CHAIN_ELEMENTS
Elements one chain covers: two products a block.
HIGH_OFFSET
The offset row two’s digit carries so its packed operand fits the signed port.
LANE
The place row two’s lane starts at.
PE8_P_LATENCY
Clocks from a systolic element’s operands to its lanes in logos_pe8_p: the first block’s input register, then a chain register a block.

Functions§

array_verilog
Every module of the element.
pack
W = q₁ + (q₂ − 8)·2^15: two rows’ digits in one signed 19-bit operand.
split
A chain’s sum split into its two rows’ partials: (Σ a′·q₁, Σ a′·q₂).