
This tile is the score-and-select half of transformer attention: it stores an 8-element int8 query vector, computes a dot product against each key vector streamed in over the data bus, and tracks the highest score and its key index. One int8 multiplier and one saturating int16 accumulator are shared serially across dimensions, so a key is scored in 8 cycles with almost no area.
The design was written in TL-Verilog. The TL-Verilog source was produced by an LLM agent pipeline working from a byte-exact executable specification, and every candidate was gated by a deterministic harness: SandPiper compile, simulation compared byte-for-byte against the golden model over 7968 cycles across two independently seeded vector sets, and a latch-free synthesis check. An earlier candidate passed the entire first vector set while still violating the 64-key limit; the second seed caught it, and the agent repaired the design through the same pipeline. That repaired design is what is in this repository.
Commands are driven on uio[1:0] and sampled every rising clock edge:
01 LOAD_Q: each cycle's ui byte fills the next query slot (8 total). The 8th
byte arms the scorer: best score resets to -32768, key counter to 0.10 STREAM_K: each cycle's ui byte is one key dimension. Every 8th byte completes
a key; a strictly greater score replaces the best, ties keep the earlier key.
Partial keys interrupted by another command are discarded.11 READ: uo rotates through {best index, score high byte, score low byte}.00 IDLE.The cocotb test in test/ replays 7968 vectors covering saturation, ties, interrupted
transactions, exact 64/65/66-key boundaries, read-interrupted streams, and mid-run
resets, and checks every output byte against the pre-computed golden model output.
None. LEDs on the demo board can display the winning key index during READ.
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | DATA0 | RES0 | CMD0 |
| 1 | DATA1 | RES1 | CMD1 |
| 2 | DATA2 | RES2 | |
| 3 | DATA3 | RES3 | |
| 4 | DATA4 | RES4 | |
| 5 | DATA5 | RES5 | |
| 6 | DATA6 | RES6 | |
| 7 | DATA7 | RES7 |