Burning to a Real FPGA (Preview Guide)
The Verilog produced in HDL Export and Equivalence Checking drops straight onto an FPGA.
That said, for someone new to FPGAs, installing a synthesis tool, assigning pins, flashing the board, and
checking it on real hardware are each an independent wall. mdl-fpga is a set of tools that folds those walls
into a single sequence of commands.
The overall flow
Section titled “The overall flow”train (library) → IR (JSON) → convert → check (bit match) → build (synthesis) → flash (program) → hw-check (bit match on hardware) ↑ detect (auto board ID) / advise (fit estimate) / bundle (zip for programming from another PC) / up (end to end)The IR is treated as a fixed input, and this tool owns everything from HDL generation downstream. That keeps the concerns of the training side and the concerns of the board from mixing (the IR is the source of truth).
Verbs (subcommands)
Section titled “Verbs (subcommands)”| Verb | What it does |
|---|---|
doctor | Environment diagnosis. Detects synthesis tools, JTAG, and serial ports, and suggests the next step. Always run this first |
detect | Automatically identifies the connected board (no EDA required). Matches signatures such as the JTAG IDCODE against board definitions and reports candidates with a confidence level |
advise | Up-front feasibility check (no EDA required). Estimates from empirical rules whether a circuit of this size fits on the board |
convert | Loads and validates the IR. If real-valued (blackbox) nodes remain, it refuses explicitly and points you to the fix |
check | Bit-exact verification without a board. Cross-checks the reference simulator against the RTL, and duplicates the generator to compare the two |
build | HDL generation → feasibility check → simulation → synthesis → bitstream. --selftest bundles in a self-verifying circuit |
flash | JTAG programming |
hw-check | Bit-exact match on real hardware. Streams every vector over UART and compares |
up | All of the above end to end (detect → advise → build → flash → hw-check). Stops at the stage that failed and states the cause and next step for that specific stage |
view | Circuit visualization viewer (one click = one clock of interactive simulation, probe anywhere) |
The shortest path on a Tang Nano 20K
Section titled “The shortest path on a Tang Nano 20K”The Sipeed Tang Nano 20K needs no vendor EDA installation at all (an open toolchain covers synthesis and programming) and needs only one cable (JTAG and UART share a bridge), which makes it by far the lowest barrier for a first board. It has also passed hardware acceptance testing.
# 0) Diagnose the environment firstmdl-fpga doctor
# 1) Verify the bit-exact match without a boardmdl-fpga check model.ir.json
# 2) End to end (detect -> advise -> synthesize -> flash -> compare on hardware)mdl-fpga up <manifest>.json --hw-checkHow to confirm the hardware is “correct”
Section titled “How to confirm the hardware is “correct””There are two routes for hardware verification.
- UART comparison (
hw-check) — send test vectors from the PC and compare every response against the golden output. Requires a USB-UART bridge connection - On-chip self-test (
build --selftest) — burn all vectors and expected values into the circuit and compare automatically at power-on. LED lit = every vector matches bit for bit. No UART and no PC needed
The verification loop closes like this.
library simulate (numpy bit-exact = the ground-truth oracle) ⇔ RTL simulation of the in-house core (the primary check verdict) ⇔ real hardware (hw-check / selftest) ⇔ the library's HDL generator (duplicated generators detect drift)Supported boards
Section titled “Supported boards”| Tier | Board | Synthesis | Status |
|---|---|---|---|
| Tier1 | Sipeed Tang Nano 20K (GW2AR) | Open toolchain (no EDA needed) | Hardware-accepted |
| Tier1 | Terasic DE0-CV (Cyclone V) | Vendor EDA | Hardware-tested |
| Tier2 | Terasic DE10-Lite (MAX 10) | Vendor EDA | Definition only (not verified on hardware) |
Board definitions hold only physical facts (pin assignments, device, detection signatures) in JSON, and the
process forbids inventing pin numbers or IDCODEs, requiring the source of every transcription to be recorded
(this prevents real wiring accidents). The synthesis backend is dispatched from the board definition, so adding one
backend makes build / up work with a new vendor without any modification.
Known pitfalls
Section titled “Known pitfalls”There are other environment-specific chores as well, such as a one-time USB driver switch on Windows.
The design is for doctor to detect these and suggest the next step, so when you get stuck, go back to doctor first.
What to read next
Section titled “What to read next”- HDL Export and Equivalence Checking — the three-stage equivalence you must always pass before burning
- Architecture Overview — how everything downstream of the IR branches
- BinaryBrain-Compatible API — measuring “not burnable yet” as a discretization gap
- DWN — a parameterization where the discretization gap is zero