LIVE BOARD ORDER FLOW
Artix-7 FPGA Limit Order Book
Pure hardware price-time-priority matching engine with serialized FSM execution, a crossing-ADD fast path, BRAM-backed book state, and an end-to-end 32-byte wire protocol. Supports live order flows over Gigabit UDP, with a Python golden model and Questa UVM testbench.
01. Hardware Setup & Video Preview
Hardware target board followed by a full-width interactive Python golden-model demo and the real-time UDP order-flow video walkthrough.
ALIENTEK DaVinci Pro FPGA Board
Artix-7 XC7A100T board running the LOB engine over Gigabit RGMII Ethernet.
Python Interactive Order Book Demo
Browser mirror of software/lob/orderbook.py: issue all four commands and inspect price-time matching in real time.
Hardware Matching Engine Demo Video
Real-time UDP 32-byte datagram injection, live price matching, and trade execution reporting on Artix-7.
02. End-to-End Hardware Architecture
The implemented board path carries 32-byte commands through RGMII and UDP framing into a FIFO-buffered, serialized controller. The order manager handles book maintenance, while the matcher consumes resting orders and updates shared book state during trades. Ingress and egress can overlap core execution.
ORDER BOOK STORAGE & LOOKUP
How the FPGA Stores and Updates the Live Book
03. Two Matcher Paths for Faster Trades
Fast Path keeps a crossing ADD in registers and matches before any remainder enters the book. Drain Path clears a live book that becomes crossed after an ADD or price-changing MODIFY, using parallel bid/ask reads. Both routes use a multi-cycle FSM: fills execute sequentially, with completion time determined by cleanup, best-price refresh, and output backpressure.
MATCHER.SV · TWO FSM ROUTES
How Fast Path and Drain Path Reach a Trade
New crossing order
The incoming ADD remains in registers while the FSM consumes resting heads. Only a non-crossing remainder is enqueued; each fill still updates the live book.
Already-crossed live book
The FSM reads bid and ask levels together, then both FIFO heads through the dual-port order pool. Fills and cleanup execute sequentially.
Latency and throughput
First-trade latency is diagnostic. Core throughput estimate: 125 MHz / 13 cycles, with one partial fill per Fast ADD and no backpressure.
04. Frozen 32-Byte Wire Protocol
The Python model, UVM scoreboard, and synthesizable RTL share the exact big-endian binary frame format for seamless verification and live hardware networking.
| Byte Offset | Field Name | Size | Data Type | Description & Encodings |
|---|---|---|---|---|
| 0 | version | 1 byte | uint8 | Protocol version 0x01 |
| 1 | msg_type | 1 byte | uint8 | 0x01 ADD · 0x02 CANCEL · 0x03 MODIFY · 0x04 EXECUTE |
| 2 | side | 1 byte | uint8 | 0x00 BUY · 0x01 SELL |
| 3 | flags | 1 byte | uint8 | bit0 FLAG_EXTERNAL=0x01; all other bits reserved=0 |
| 4–7 | seq_num | 4 bytes | uint32_be | Sender-monotonic sequence number (starts at 1) |
| 8–15 | order_id | 8 bytes | uint64_be | Client order ID |
| 16–19 | price | 4 bytes | uint32_be | Fixed-point price; current supported range 1–4095 |
| 20–23 | quantity | 4 bytes | uint32_be | > 0 for ADD, MODIFY, and external EXECUTE; unused by CANCEL |
| 24–31 | timestamp_ns | 8 bytes | uint64_be | Nanosecond timestamp |
05. Board Validation & Verification Results
Paced UDP board stress, full 8,191-order live capacity, and post-implementation timing closure at 125 MHz.
Questa UVM Scoreboard
QuestaSim scoreboard: sweep, ACK, and defensive checks passed.
Fast-Path Crossing
Aggressive ADD orders sweep resting asks across multiple price levels.
Cancel & Modify
Hash lookup, linked-list splice, quantity updates, and slot release.
Mixed Stress Flow
Crossing adds, passive orders, cancels, and modifies in one realistic stream.
Boundary Defense
Duplicate IDs, invalid prices, zero quantity, and minimum/maximum levels.

