Skip to content

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.

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).

VerbWhat it does
doctorEnvironment diagnosis. Detects synthesis tools, JTAG, and serial ports, and suggests the next step. Always run this first
detectAutomatically identifies the connected board (no EDA required). Matches signatures such as the JTAG IDCODE against board definitions and reports candidates with a confidence level
adviseUp-front feasibility check (no EDA required). Estimates from empirical rules whether a circuit of this size fits on the board
convertLoads and validates the IR. If real-valued (blackbox) nodes remain, it refuses explicitly and points you to the fix
checkBit-exact verification without a board. Cross-checks the reference simulator against the RTL, and duplicates the generator to compare the two
buildHDL generation → feasibility check → simulation → synthesis → bitstream. --selftest bundles in a self-verifying circuit
flashJTAG programming
hw-checkBit-exact match on real hardware. Streams every vector over UART and compares
upAll 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
viewCircuit visualization viewer (one click = one clock of interactive simulation, probe anywhere)

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 first
mdl-fpga doctor
# 1) Verify the bit-exact match without a board
mdl-fpga check model.ir.json
# 2) End to end (detect -> advise -> synthesize -> flash -> compare on hardware)
mdl-fpga up <manifest>.json --hw-check

How to confirm the hardware is “correct”

Section titled “How to confirm the hardware is “correct””

There are two routes for hardware verification.

  1. UART comparison (hw-check) — send test vectors from the PC and compare every response against the golden output. Requires a USB-UART bridge connection
  2. 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)
TierBoardSynthesisStatus
Tier1Sipeed Tang Nano 20K (GW2AR)Open toolchain (no EDA needed)Hardware-accepted
Tier1Terasic DE0-CV (Cyclone V)Vendor EDAHardware-tested
Tier2Terasic DE10-Lite (MAX 10)Vendor EDADefinition 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.

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.