SQRL BCU-1525 · xcvu9p · Qwen3.5-9B · state at 1 Oct 2026

Inside fable5_llm

A nine-billion-parameter language model decoding on a single FPGA board, built from an empty directory. Every token it produces needs 4.09 GB of four-bit weights read out of DDR4 and multiplied. This page walks through what the machine has to do to make that happen, and what it took to trust the answer.

Fly through the placed design in 3D · RTL, reference models, evidence and docs on GitHub

4.09 GB
of weights streamed from four DIMMs for every token
39,146
sequencer records executed per decode step
8.18 tok/s
best chat decode measured on silicon (R2 build)
4 ps
worst timing slack over 1.32 million endpoints, newest build
11,593
lines of RTL, inside about 235,000 tracked lines
1,611
commits and 46 numbered builds since 10 June 2026
Physics

Every token reads the whole model

Decoding one token at batch size one uses every weight in the model exactly once. The 9B pack is 249 matrices totalling 3,902 MiB at 4.125 bits per weight, which is about 7.9 billion multiply-accumulates per token derived.

None of that fits on the chip. All the block RAM and UltraRAM in the xcvu9p adds up to about 44 MB derived, roughly one percent of the weights. So the weights live in four 4 GiB DDR4 DIMMs and are streamed past the multipliers again for every token.

The four channels deliver 17.875 GB/s each, 70.70 GB/s together silicon. That sets a floor of about 58 ms per token and a ceiling near 17.3 tokens per second derived, before any other work is counted.

The matvec engines already run at that floor: 1.003 clock cycles per 64-byte beat in the chip testbench sim. The remaining complexity in this design is about everything that happens between matvecs.

What has to be stored, against what the FPGA can hold

megabytes, to scale
Weight pack, read every token
4,092
Embedding table, one row per token
2,034
Layer state region
163
All block memory inside the FPGA
44 derived
The FPGA's own memory is the short orange mark at the bottom. Everything the model needs lives in DDR4, and the design is organised around moving it.
Architecture

One sequencer, one layer engine, four weight streams

The host does almost nothing per token. A sequencer on the chip reads a program out of DDR and drives two kinds of engine with it: one layer engine that holds the working vectors and does all the non-matrix math, and four matvec channels, one bolted to each DIMM. Select a step to see which parts it touches.

Host PC chat_seq.py: patch, START, read token PCIe PCIe bridge (XDMA) Gen3 x8 · source of the 250 MHz clock 256-bit DMA: weights in, a patch per step AXI-Lite control: CSR writes, doorbells, polls 32-bit burst lane: x out, results back Sequencer (seq_0) fetch, decode, issue: straight from DDR 8 index registers · token FIFO movers: MOVX MVGO MOVY FENCE 4,159 LUTs Layer engine (layer_0) scratchpad: 65,536 × 16-bit words vector ALU · RMSNorm · RoPE · conv · gates dn_step (128 lanes) · attn_core state cache (182 URAM) + state DMA 113,235 LUTs · 1,840 DSPs Matvec channel × 4 XWIN: the int8 input vector 128 four-bit weights per beat RES: 4,096 × 32-bit sums runs on its DIMM's 300 MHz clock ≈14,700 LUTs each 128-bit fetch: records, constants, embedding row 512-bit state DMA: layer state in and out 4 × 512-bit weight streams 70.7 GB/s measured DDR interconnect: one 4 GiB window per channel DDR4 channel 0 · 4 GiB¼ of every weight matrix DDR4 channel 1 · 4 GiB¼ of every weight matrix DDR4 channel 2 · 4 GiB¼ of every weight matrix DDR4 channel 3 · 4 GiBweights · 155 MiB layer state

One step of the machine, in order

Select a step to light its path. Select it again to clear.
Steps 3 to 7 repeat for every projection: a decode step launches 1,370 matvecs. The record stream, the constants and the embedding table are also in DDR. Everything runs on the bridge's 250 MHz clock except the four matvec engines, which run on their DIMM's 300 MHz clock; that boundary is the only clock-domain crossing in the custom RTL.
Control

The chip runs a program stored in DDR

The first working version drove the engines from Python, register write by register write: about 100,000 MMIO accesses and 9.3 seconds per token, 98.8% of it host overhead silicon. The fix was to compile that register sequence into a binary stream and let the chip execute it.

The layers are unrolled. A reference-model run emits every register write, command and data move for a whole forward pass, with the weight addresses baked in. The host uploads it once.

The program is fixed but the numbers are not. Each vector picks its own exponent at run time, and later shift amounts depend on it. Eight 18-bit index registers carry those values, and a record can add or subtract one from its operand. A decode step has on the order of 1,656 such indirected records at the 0.8B size, which is why the registers live inside the sequencer and are read combinationally at decode.

One record, 128 bits, little-endian

127:96length / addr hi
95:64addr lo
63:32imm32
31:16target
15:8flags
7:0opcode

Flags hold an indirection code (none, add, subtract) and either an index-register number or a channel number.

Three instruction sets, nested

Sequencer records · 12
  • CSRWR
  • CMD
  • MOVX
  • MOVY
  • MVGO
  • EMB
  • AMAXL
  • JMP
  • FENCE
  • HALT
  • LDC
  • XOP

What the stream is made of. Register writes, data moves, matvec launches, waits.

Layer commands · 14
  • VN
  • VNW
  • ROPET
  • ROPE
  • CONVW
  • CONV
  • GATE
  • DNST
  • KVAP
  • ATTN
  • ALU
  • DNZ
  • SLD
  • SST

Started by a CMD record. Norms, rotary embedding, convolution, gates, the DeltaNet step, attention, state load and store.

ALU operations · 12
  • DYNQ8
  • SHIFT32
  • SCALE
  • EMUL
  • ADD
  • SILU16
  • SILU32
  • SIGM16
  • EMUL32
  • SHIFT32W
  • AMAX32
  • DYNQ16

Selected inside an ALU command. Elementwise glue over the scratchpad, one element per clock.

Records in one decode step, by opcode

sim
CSRWR, register writes
26,552
CMD, layer commands
8,821
MVGO, matvec launches
1,370
MOVY, results back
1,370
MOVX, input vector out
996
FENCE, waits
343
LDC, XOP, EMB, AMAXL
172
Counted on the chip testbench for the shipped order, before the software reorder. Two thirds of the program is register writes, which cost almost nothing. The 343 FENCE records (orange) are less than one percent of the program and 41.5% of its run time.
; one projection y = W·x, four channels, chunk 0
MOVX  ch0  scratch[x8] → XWIN, len K
MOVX  ch1  …                ; ×4, the same x each time
MVGO  ch0  shape, weight base, beats, no-wait
MVGO  ch1  …                ; ×4, one per DIMM
FENCE                       ; wait for the engines
MOVY  ch0  RES → scratch,
           shift = imm − XRF[0]
MOVY  ch1  …                ; ×4, rows land side by side
The shape of one matvec in the stream. The shift on each MOVY is not known when the stream is emitted; it is completed on the chip from the exponent DYNQ8 chose.

A stream is validated as it runs. Twenty error codes cover unknown opcodes, reserved bits, out-of-range jumps, bus errors and watchdogs, and any of them halts the sequencer with the code in a status register. Newer record forms are designed to fault on an older bitstream before a wrong result is consumed. One of them could not be made to, and that exception is listed under silent failures.

Compute

Two kinds of layer, two kinds of hardware

Qwen3.5 is a hybrid. Three layers in four are DeltaNet linear attention and every fourth is ordinary attention. They share the matvec engines and the scratchpad and nothing else, so the layer engine carries two separate state machines with separate state memories.

24 of 32 layers

DeltaNet layer

Keeps a 128 × 128 matrix per value head as its memory of the sequence. Each token decays the matrix, reads it with the key, writes back a rank-one correction scaled by a gate, then reads it with the query. It never looks at earlier tokens, so the work per token is constant.

Around it: a four-tap depthwise convolution over 8,192 channels with its own history, and per-head gates computed through softplus, exp and sigmoid ROM tables.

unit
dn_step, 128 parallel lanes
control
22-state FSM, ≈1,300 cycles per head
heads
16 key, 32 value
state
1 MiB per layer, int16
area
42,012 LUTs · 1,279 DSPs
time
3.916 ms per layer sim
8 of 32 layers

Full-attention layer

Appends this token's key and value to a cache as int8 with an exponent, then every query head scores itself against every cached key, takes a softmax through an exp ROM and a serial reciprocal, and sums the values. The work grows with the context length.

Around it: partial rotary position encoding on 64 of 256 dimensions, RMSNorm on queries and keys, and a sigmoid output gate.

unit
attn_core, head dim 256
control
42-state FSM
heads
16 query over 4 key/value
state
KV cache, 128 MiB region
area
36,639 LUTs · 529 DSPs
time
3.051 ms per layer sim

The context cost is visible on the board: a decode step takes 137.7 ms near position 30 and 147.9 ms near position 520, 7.4% more silicon. The DeltaNet layers account for 71.7% of a token's time in the testbench census, because there are three times as many of them and each is slower.

Numerics

Integers that must match bit for bit

There is no floating point on the chip. Every operation is an exact integer algorithm defined in one Python file, ref/layer_fixed.py, and the RTL has to reproduce it bit for bit. The project rule is that when hardware and reference disagree, the bug is real.

Fixed formats alone were not enough. An early fixed shift crushed the DeltaNet output to 0.17 of a least-significant bit and the 0.8B model produced nonsense. The fix was block floating point: DYNQ8 and DYNQ16 scan a vector and choose its exponent on the chip, per vector, per token.

Exactness shapes the hardware. The vector ALU is a single lane, because argmax ties must resolve to the first index and the exponent searches depend on arrival order. Parallel lanes would be faster and would give different answers.

QuantityFormat
WeightsINT4, one uint16 scale per 128
Matvec inputint8 + per-vector exponent
Residual streamint16 Q8.7
Normalized q, kint16 Q1.14
DeltaNet stateint16 Q2.13
Gates, RoPE tablesQ15
KV cacheint8 + exponent per token, head
Roundinghalf away from zero, everywhere

The chain an answer has to survive

  1. CheckpointQwen3.5-9B, bf16 safetensors
  2. layer_ref.pyfloat anchor that mirrors the upstream model code
  3. layer_fixed.pythe integer-only law, 2,679 lines
  4. Emitterwrites the record stream, the weight pack and the expected state
  5. seq_model.pypure-Python executor of the stream, the sequencer's golden
  6. Chip testbenchthe real RTL in Verilator, no stubs, files served as DDR
  7. Siliconfour seeds, each run twice without reprogramming

On the board, the 9B gate matched 24 of 24 tokens over four prompts, 36,886 state checks on each of eight full-model runs, and the entire 162,529,280-byte state region against the emitter's hash with no carve-outs silicon.

Bit-exact to the integer model is a separate question from faithful to the float model. Against the bf16 original, the quantized 9B agrees on the top token in 98 of 108 teacher-forced steps sim. GPTQ, which rewrites the 4-bit codes without changing the layout or the byte count, cut the perplexity penalty from +8.79% to +2.58% sim.

Memory

State that outgrew the chip

At 0.8B and 2B, every layer's persistent state sat in on-chip memory, banked by layer. The 9B doubles the DeltaNet value heads, doubles the attention heads and adds eight layers. The same design needed 928 of the device's 960 UltraRAMs.

It synthesised and placed. It did not meet timing: eleven out-of-context placements, the best of them 0.554 ns short. Floorplanning alone could not close a memory that has to span all three dies.

The redesign moved all layer state into DDR and left a two-slot cache on the chip for each kind. While one layer computes out of one slot, a 512-bit DMA engine stores the previous layer's state and loads the next into the other. That added two layer commands, a new AXI master and its own error codes.

The DMA lane costs 5.125 ms per token running beside 41.588 ms of compute silicon, and moves about 70 MiB per token at a context of 512.

UltraRAM needed by the layer engine, of 960

State banked on chip928 · 96.7%
State in DDR, two-slot cache on chip182 · 19.0%
State region, DDR channel 3Size
DeltaNet matrices, 24 layers × 1 MiB24 MiB
KV cache, sized for 4,096 positions128 MiB
Conv taps and history, 24 × 128 KiB3 MiB
The first design did not close timing at 96.7% occupancy. The second fits one die and trades UltraRAM for DDR traffic.
Time

Where a token's time goes

A census on the chip testbench splits one 131.1 ms token three ways. The three activities sum to 98% of the token, which means they happen almost entirely one after another: stream weights, then move vectors, then compute.

One token of the shipped order, 131.138 ms

sim
By activity
  • Weight streaming from DDR54.4 ms
  • Mover work, x out and results back32.5 ms
  • Layer compute41.6 ms
  • Everything else2.6 ms
By part of the model
  • 24 DeltaNet layers94.0 ms
  • 8 full-attention layers24.4 ms
  • LM head, 248,320 rows12.7 ms
Two cuts of the same token. The board runs the same stream 4.6% slower than the testbench, and its idle counters agree with the picture: the sequencer sits in a FENCE for 42.0% of the step, and no matvec engine is busy for 57.8% of it silicon.

So the DDR path, the thing the physics says is the limit, is idle more than half the time. The engines wait for the movers, the movers wait for the scratchpad, and the scratchpad has one owner at a time. Every speed-up since the 9B first ran has been a way of overlapping those three.

A dependency model of the stream puts the limit of overlap at 86.7 ms per token, 1.51 times the shipped order model. The naive bound of 2.36 times is not reachable, because the scratchpad is single-ported between compute and the movers.

RoundWhat changedChat gain
ReorderSoftware only. Fences moved to the point of use, a dependency-safe reorder, redundant MOVX removed.×1.125
R1FENCE takes a channel mask and waits only for the channels it names.×1.041
R2A second bank in each XWIN and RES memory, so the next x can be staged while an engine runs.×1.032
R3One scratchpad read broadcast to all four channels over a direct 376-flop bus. Built and signed off, not loaded.×1.085 model

Tokens per second at 9B, rung by rung

  • chat, context ≈ 505
  • 6-token stream
  • hollow: not measured
Shipped order
6.770
7.293
Reordered stream, same bitstream
7.619
8.296
R1, fence channel mask
7.929
8.742
R2, double-banked buffers
8.182
9.057
R3, MOVX broadcast
8.70–8.77 model
9.70–9.83 model
DDR bandwidth ceiling
17.3 derived
Every measured rung produced identical tokens to the one before it. The best measured stream rate is about half of what the DIMMs could feed.
Silicon

Fitting the device

The xcvu9p is three dies stacked on an interposer. Signals that cross between dies are slow and limited in number. The design uses 26% of the LUTs, which sounds comfortable, but the hard parts are local: the layer engine takes 81% of one die's DSPs and all of the UltraRAM in use.

The main clock is 250 MHz because the PCIe bridge generates it. That gives every path 4 ns. The newest build closes with 0.004 ns to spare on its worst path; the bitstream on the board closes with exactly 0.000.

That zero was produced once. Six placement runs of the same netlist spread over 0.512 ns, so the margin is far smaller than the tool's own run-to-run noise.

build_046Die 0Die 1Die 2
Logic blocks used61.9%66.2%7.3%
LUTs152,630141,74015,457
Flip-flops115,833182,65421,656
DSP slices1,845123
UltraRAM18200
Block RAM tiles112.511325.5

2,993 wires cross between die 0 and die 1, and 1,358 between die 1 and die 2. The third die is nearly empty.

Where the 309,827 LUTs go

build_046 hierarchy report
Layer engine
113,235
of which DeltaNet step
42,012
of which attention core
36,639
of which state DMA
17,299
Four matvec channels
≈58,800
Four DDR4 controllers
≈56,200
Per-channel interconnect
≈24,000
PCIe bridge
23,642
DDR interconnect
23,299
Sequencer
4,159
The block that runs the whole program (orange) is the smallest thing on the chip. Plumbing, the vendor bridges and interconnect, is about as large as the layer engine.

What moved the slack on the resident build

StepWorst slack, ns
First placement−0.859
Best of four placement directives−0.156
Floorplan: none, then a layer region, then a context region too−0.247 → −0.768 → −1.126
RTL round: one memory cascade capped, three stages split+0.091 gained
Clock root moved to the layer engine's centroid−0.156 → 0.000
Post-route physical optimisation+0.000 gained

The clock-root move changed clock skew by 0.407 ns and left the data paths alone. Floorplan regions cost slack every time one was added, so the shipped build has none. R1, R2 and R3 were each built incrementally against a signed-off checkpoint and closed at +0.001, +0.004 and +0.004.

ClockMHzSlack, ns
Main clock, from the PCIe bridge250.00+0.012
DDR channel 0 user clock300.12+0.064
DDR channel 1 user clock300.12+0.055
DDR channel 2 user clock300.12+0.055
DDR channel 3 user clock300.12+0.026
Design worst, inside the bridge+0.004
Proof

What it took to trust it

The charter allows no claim without evidence captured in the repository. Every stage needed its own reference model, simulation against it before hardware, and four seeds on the board, each run twice without reprogramming.

That rule is why the RTL is one line in twenty. There are 23 testbenches totalling 11,406 lines, almost exactly the size of the RTL they test. There are 33 reference-model and generator scripts, 4,860 tracked evidence files, and 22 gate reports.

Two testbench habits recur. Differential benches feed one random command stream to a frozen copy of a module and to its rewrite, compare the full scratchpad after every command, and never assume the two take the same number of cycles. And benches carry sabotage tests: deliberately broken comparators that must fail, to prove the check can.

Tracked lines by kind

git ls-files, 1 Oct 2026
Python: references, emitters, host tools
97,352
Markdown: specs, gates, history
81,482
Testbench and model SystemVerilog
22,079
Shell: run wrappers, launchers
13,368
RTL
11,593
TCL: build scripts
6,389
XDC: constraints
2,483
The hardware description (orange) is 4.9% of the tracked text. The rest exists to generate its inputs, check its outputs and record what was measured.
Hazards

Ways it can be wrong without saying so

A design this layered fails quietly more often than loudly. These are on the record in the repository, each found the hard way.

SituationWhat happensWhat guards it
A run reuses DDR without resetting the state regionThe wrong token comes back with error code 0x00.The chat tool now writes the region itself. The lower-level runner is unchanged, so the defect stands there.
The weight pack in DDR belongs to a different modelThe identity gate passes. Nothing ties the resident pack to the resident model; the 2B pack was once uploaded over the 9B one this way.Still open. A per-model template pin makes it harder to reach.
The host is slow to drain the token FIFOA push past 64 entries drops the token. The sequencer does not stall.A sticky overflow bit that survives restart.
An R2 stream runs on a bitstream without R2Accesses to the second bank silently use the first.Host admission against a capability register. R1 and R3 streams fault at decode instead.
Context reaches 512 positionsA 40-bit sum in the attention core can wrap in the worst case. 526 positions have matched on the board; that is evidence, not proof.The ceiling is held at 511 by analysis until the register is widened.
The reference model runs at the wrong residual format12,096 wrong shifts in the reference, invisible for 17 hours. The chip was right.The format is now derived from the model tag.
The placer moves the layer engine to another dieThe clock-root constraint still applies without error, now pointing at the wrong die.A script checks every routed build. It has an open hole: for an unknown location it compares "?" with "?" and reports OK, so that result is read as a failure.
A 4-core workstation does the arithmeticIt computed wrong results on two occasions in the 9B campaign.Every emission, simulation and build runs on the server. The workstation is retired from numeric work.
History

Sixteen weeks

  1. Charter and first commit. No RTL, no scripts, no board files.
  2. Bring-up. PCIe and all four DDR4 channels calibrated.
  3. Streamed matvec, bit-exact, weights from DDR.
  4. A full transformer layer, bit-exact end to end.
  5. Token in, token out. First build to meet timing outright.
  6. The real 0.8B model, 24 layers, host-driven and very slow.
  7. The speed ladder. Sequencer, pipelines, burst movers, zero-bubble matvec: 0.11 to 30.4 tok/s.
  8. Qwen3.5-2B on silicon at 16.1 tok/s, on the first bitstream with no timing waiver.
  9. State spill decided after the 928-UltraRAM layer failed to close timing.
  10. Qwen3.5-9B on silicon at 7.29 tok/s, every token and state hash matching.
  11. Power loss. The bitstream is volatile by rule, so the board dropped the design and its DDR contents. Back up on 27 Sep.
  12. Reorder, R1, R2 measured: chat 6.77 to 8.18 tok/s.
  13. R3 built and signed off at +0.004 ns. Not loaded; waiting on a decision to load it.

The first ladder, on the 0.8B model

silicon
Host drives every register
0.11
On-chip sequencer
4.91
One element per clock in the ALU
6.40
Burst movers
15.56
Zero-bubble matvec, 4-channel head
30.4
Tokens per second, each rung measured on the board. The order of the rungs was set by measurement: a cycle census showed the planned third rung would not have helped until the movers were fixed. The 9B then needed its own ladder, shown above.