Flux DevKit
VS Code support for Flux, the C++ language and compiler for FPGA hardware.
Features
- Syntax highlighting for
.flux files, plus Flux constructs inside .cpp.
- Completion for ports and signals in scope,
__ constructs, modules
(including the ones in flux/modules/, with the #include added for you),
board and simulator members, pin group names, port names and #include paths.
- Signature help, hover, go to definition and outline for hardware modules.
- Error checking from the Flux compiler on open and save, plus instant
checks while typing, with quick fixes.
- Command palette actions to simulate, build, deploy and export.
Getting started
Install the Flux compiler.
Run Flux: Select Compiler if it is not found automatically. In a source
checkout the compiler is build/flux.
Run Flux: New Project. It creates:
.
├── main.cpp
├── sim.cpp
└── src
└── simpleCounter.flux
Run Flux: Run Simulation, then Flux: Deploy to Board (Temporary)
with a Tang Nano 20K connected.
Commands
Open the command palette and type Flux, or click Flux in the status bar.
| Command |
What it does |
| New Project / Set Up Project in This Folder |
Creates the three starter files. Existing files are never overwritten. |
| Run Simulation |
Builds sim.cpp into build/sim and runs it. |
| Check Current File |
Compiles the file and fills the Problems panel. |
| Build FPGA Image |
Builds main.cpp for the board it declares, into build/. |
| Deploy to Board (Temporary) |
Builds, then loads volatile memory. |
| Deploy to Board (Flash) |
Builds, then writes flash after you confirm. |
| Export Netlist |
Writes Verilog, BLIF, Yosys JSON or EDIF (all but Verilog need Yosys). |
| List Boards / Describe Board / List USB Programmers |
Compiler queries. |
| Clean Build Files |
Lists the build outputs in build/ and deletes them after you confirm. |
Board support
Image building and loading follow what the Flux compiler supports.
| Board |
Build |
Temporary load |
Flash |
| Tang Nano 20K |
yes |
yes |
yes |
| iCEBreaker |
yes |
yes |
yes |
| ULX3S |
yes |
yes |
yes |
| Basys 3, Arty A7-100T |
experimental |
experimental |
no |
| Tang Nano 9K |
yes |
no |
no |
| DE10-Nano |
no |
no |
no |
Settings
| Setting |
Default |
Meaning |
flux.compilerPath |
empty |
Path to flux. |
flux.checkOnSave |
true |
Compile for errors on save. |
flux.checkOnOpen |
true |
Compile for errors on open. |
Notes
- Compiler checks use the saved file. Checks while typing cover loops in
hardware modules, clock misuse, literals,
__memory options, and ++, +=,
/ or % forms that need a sized literal.
- The Microsoft C/C++ extension does not understand Flux headers or
__onRise,
so it may underline main.cpp and sim.cpp. Errors labelled flux come from
the real compiler.
- In untrusted workspaces nothing is compiled or run.
| |