neosyn-fpga-mcp
v1.4.0AI-agent MCP server for FPGA design: compile, validate & generate Verilog from C⏚ HDL.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
cg_check
Parse, scope, and type-check C⏚ source without running it. Returns {ok, diagnostics:[{file,line,message}], summary}. Call this first on any draft; fix every diagnostic before simulating. `extra_files` maps filename → content for imported bundles/tasks (e.g. {"Defs.cg": "..."}). For a MULTI-FILE project, pass `package_dir` (the folder holding your .cg files, e.g. "fpga/src/main/cg", relative to the project root): the tool then reads every sibling .cg there, so tasks defined in other files of the same package resolve — just like the IDE. A task you only got from…
| Parameter | Type | Description |
|---|---|---|
extra_files | ||
package_dir | ||
path | ||
source | string |
cg_simulate
Simulate C⏚ source. Returns {ok, simulator, timed_out, diagnostics, output}. `output` holds port values and print() lines; a `properties { test: {...} }` block self-checks and fails the run on mismatch. This is the ground-truth correctness check — iterate until ok is true. `simulator` picks the backend. 'bytecode' (default) is the fast cycle-accurate simulator — no HDL toolchain, and a `properties { test: {...} }` block self-checks. It ships with the commercial Neosyn distribution; the open-source compiler has no `simulate` verb and the call then retu…
| Parameter | Type | Description |
|---|---|---|
extra_files | ||
package_dir | ||
path | ||
report_dir | ||
simulator | string | |
source | string | |
timeout | integer |
cg_generate_verilog
Generate synthesizable HDL from C⏚. target is 'verilog' (default) or 'vhdl'. Returns {ok, file_count, files:{path:content}}. Use after cg_simulate passes, to hand off RTL. Pass `output_dir` (e.g. "fpga/build/verilog", relative to the project root) to WRITE the files to disk and KEEP them — the result then also carries {output_dir, written:[paths]}. Without it the files are only returned inline and the temp dir is cleaned. Prefer `output_dir` when the host needs the .v on disk (to inspect or run yosys). For a MULTI-FILE project, pass `package_dir` (the fold…
| Parameter | Type | Description |
|---|---|---|
extra_files | ||
output_dir | ||
package_dir | ||
path | ||
source | string | |
target | string |
cg_capabilities
What this host can actually do — PROBED, not assumed. Call it before deciding how to verify a design, instead of assuming a backend exists. Returns {jar, jar_present, bytecode_simulator:{available,reason,detail}, simulators:[...], tools:{iverilog,vvp,verilator,yosys,ghdl}, advice}. The fast bytecode simulator ships with the commercial Neosyn distribution and is absent from the open-source compiler, so any flat claim about it is wrong in one of the two environments. `advice` is written from what was actually found here.
cg_scaffold
START HERE when writing new C⏚ from a blank file. Returns a COMPLETE, COMPILING, SELF-CHECKING skeleton with the datapath left as marked holes — you fill in the holes instead of inferring the file skeleton, the port syntax and the test-harness shape at the same time. It is verified before you get it: the returned source compiles AND its self-test passes as handed over (`verified`). So it starts GREEN — any failure after your edit is your edit, which makes cg_simulate a real signal instead of a guess. kind: task a `sync` task whose `test:` block…
| Parameter | Type | Description |
|---|---|---|
inputs | ||
kind | string | |
name | string | |
outputs | ||
package | string | |
verify | boolean |
cg_example
Get a VERIFIED C⏚ base to seed-and-adapt from (don't synthesize hard kernels from scratch — adapt a known-good one). This is a curated dictionary of validated code with scored lazy lookup, NOT free-form search. No pattern → a compact index (name + kind + use_when + tags). A pattern → the single best-matching source plus its metadata and 1-2 `runners_up` so you can self-correct on an ambiguous query. `k>1` also returns the next sources when the task implies composition. Matching is specificity-weighted (exact name ≫ name word ≫ full tag phrase ≫ pa…
| Parameter | Type | Description |
|---|---|---|
k | integer | |
pattern | string |
cg_lint
Fast static checks for C⏚ that COMPILES CLEANLY AND IS STILL WRONG. Returns {ok, findings:[{rule, line, severity, message, fix}]}; ok is False if any finding is an error. This does NOT replace `cg_check` -- it catches what the compiler ACCEPTS. Chiefly: a `test:` fixture that drives inputs but compares no output (it passes even with a dead design -- the single most expensive failure mode in this codebase), ragged vectors in a sync fixture, a fixture key that matches no port, and a bool compared against 0/1. No jar, no simulator, no timeout -- run it on every…
| Parameter | Type | Description |
|---|---|---|
path | ||
source | string |
cg_suggest_for_error
Map a compiler error/diagnostic to the fix for it. Returns {ok, recipe, hint, source}. Two kinds of answer: - AUTHORING/WIRING errors (the file doesn't parse, a sibling entity isn't visible, the jar failed to load) → `recipe` and `source` are None and `hint` carries the whole fix, which is a one-line edit. Apply the hint literally; do NOT redesign the datapath. - SYNTHESIZABILITY errors (the construct has no hardware) → `recipe` names a validated example and `source` is its full C⏚, to adapt. div/shift-by-a-variable → Recip; a data-depende…
| Parameter | Type | Description |
|---|---|---|
message * | string |
cg_synth
Synthesize the generated Verilog with yosys — the strongest signal that a design maps to real hardware (catches non-synthesizable constructs that simulate/iverilog accept). Returns {ok, verdict, top, flow, cells, arith_ops, latches, warnings, stat, problems, output}. `verdict` is the one-word classification so you can't confabulate success: REAL (a genuine datapath), FOLDED (0 datapath cells — inputs weren't on ports, dead hardware), SUSPECT (latches inferred — a data-dependent loop / missing reset), or ERROR (yosys failed). `cells` is the gate count; `pro…
| Parameter | Type | Description |
|---|---|---|
extra_files | ||
flow | string | |
package_dir | ||
path | ||
report_dir | ||
source | string | |
timeout | integer | |
top |
cg_report
Finalize the FPGA report: (re)render <report_dir>/report.html — a self-contained HTML with the synthesis table (REAL/FOLDED/SUSPECT verdict + cell/arith/latch counts), the simulation PASS/FAIL + output, the generated-Verilog file list, and (best-effort) datapath schematic SVGs. This does NO synthesis — the rows are built incrementally by passing the SAME `report_dir` to cg_synth (per kernel) and cg_simulate as you run them; cg_report just aggregates those fragments + the Verilog under <report_dir>/verilog and renders. Workflow: cg_generate_verilog(output_…
| Parameter | Type | Description |
|---|---|---|
report_dir | string | |
schematics | boolean |
cg_fsm
Show a task's compiled state machine (states + transitions). Useful to confirm an FSM has the intended number of states.
| Parameter | Type | Description |
|---|---|---|
source * | string | |
extra_files | ||
task |
cg_graph
Show a network's compiled graph (instances, ports with widths and interfaces, connections). Useful to confirm wiring.
| Parameter | Type | Description |
|---|---|---|
source * | string | |
extra_files | ||
network |
cg_docs
Fetch a markdown knowledge doc. No topic → an index of available topics, their descriptions and their SECTIONS; a topic → its full content plus its section names; a topic and a `section` → just that section. Re-reading one section is far cheaper than the whole doc -- after your context is compacted, fetch the section you need, not the whole topic. Topics: 'context' (the core C⏚ language pack — load before writing any Cg); 'handshakes' (port protocols push/stream/confirm, back-pressure, and the pacing gotcha when feeding a registered built-in — read b…
| Parameter | Type | Description |
|---|---|---|
section | string | |
topic | string |