Skip to content

CLI Usage

Synopsis

bash
Usage: ./jz-hdl JZ_FILE --lint [--warn-as-error] [--color] [--info] [--explain] [--Wno-group=NAME] [--Eno-group=NAME] [--tristate-default=GND|VCC] [-o OUT_FILE]
       ./jz-hdl JZ_FILE --verilog [-o OUT_FILE] [--sdc SDC_FILE] [--xdc XDC_FILE] [--pcf PCF_FILE] [--cst CST_FILE] [--tristate-default=GND|VCC]
       ./jz-hdl JZ_FILE --rtlil [-o OUT_FILE] [--sdc SDC_FILE] [--xdc XDC_FILE] [--pcf PCF_FILE] [--cst CST_FILE] [--tristate-default=GND|VCC]
       ./jz-hdl JZ_FILE --alias-report [-o OUT_FILE]
       ./jz-hdl JZ_FILE --memory-report [-o OUT_FILE]
       ./jz-hdl JZ_FILE --tristate-report [-o OUT_FILE]
       ./jz-hdl JZ_FILE --ast [-o OUT_FILE]
       ./jz-hdl JZ_FILE --ir [-o OUT_FILE] [--tristate-default=GND|VCC]
       ./jz-hdl JZ_FILE --test [--verbose] [--seed=0xHEX] [--tristate-default=GND|VCC]
       ./jz-hdl JZ_FILE --simulate [-o WAVEFORM_FILE] [--vcd] [--fst] [--jzw] [--verbose] [--seed=0xHEX] [--jitter=CLOCK:PS] [--drift=CLOCK:PPM] [--tristate-default=GND|VCC]
       ./jz-hdl --chip-info [CHIP_ID] [-o OUT_FILE]
       ./jz-hdl --lint-rules
       ./jz-hdl --lsp
       ./jz-hdl --help
       ./jz-hdl --version

Simulation timing options:
  --jitter=CLOCK:PS       Add peak-to-peak clock jitter in picoseconds (may repeat)
  --drift=CLOCK:PPM       Add maximum clock drift in parts per million (may repeat)

Expansion safety options:
  --expansion-limits=repeat-count=<n>,repeat-bytes=<n>,apply-count=<n>,apply-growth=<n>
                           Override hard expansion limits (defaults: repeat-count=1024,
                           repeat-bytes=1048576, apply-count=1024, apply-growth=4096)

Path security options:
  --sandbox-root=<dir>     Add permitted root directory for file access
  --allow-absolute-paths   Allow absolute paths in @import / @file()
  --allow-traversal        Allow '..' directory traversal in paths

Modes

FlagDescription
--lintRun all semantic checks and report diagnostics. No output files are generated unless -o is given.
--verilogCompile to Verilog. Optionally emit constraint files (--sdc, --xdc, --pcf, --cst).
--rtlilCompile to RTLIL (yosys intermediate representation).
--astEmit the parsed AST as JSON.
--irEmit the intermediate representation as JSON.
--testRun all @testbench blocks in the file. See Testbench.
--simulateRun all @simulation blocks in the file. See Simulation.
--alias-reportPrint the net alias resolution report.
--memory-reportPrint the memory inference and mapping report.
--tristate-reportPrint the tri-state driver analysis report.
--chip-infoPrint chip data for the given CHIP_ID (or list all supported chips if no ID given).
--lint-rulesList all diagnostic rule IDs and their descriptions.
--lspStart the Language Server Protocol server (stdio transport). See Editor Integration.
--helpPrint usage information.
--versionPrint the compiler version and git commit (e.g., Version 0.2.0 (abc1234)).

Common options

OptionDescription
-o OUT_FILEWrite primary output to OUT_FILE instead of stdout.
--colorForce colored diagnostic output.
--infoInclude informational diagnostics (not just warnings and errors).
--explainPrint detailed explanation under each diagnostic.
--warn-as-errorTreat all warnings as errors.
--Wno-group=NAMESuppress WARNING-level diagnostics in the named group.
--Eno-group=NAMESuppress ERROR-level diagnostics in the named group.

Constraint file options (with --verilog)

OptionDescription
--sdc SDC_FILEEmit Synopsys Design Constraints.
--xdc XDC_FILEEmit Xilinx Design Constraints.
--pcf PCF_FILEEmit Physical Constraints File (open-source toolchains).
--cst CST_FILEEmit Gowin Constraints File.

Path security options

OptionDescription
--sandbox-root=<dir>Add an additional permitted root directory for @import and @file() paths. May be specified multiple times.
--allow-absolute-pathsAllow absolute paths in @import and @file() directives (disabled by default).
--allow-traversalAllow .. directory traversal in paths (disabled by default).

By default, the compiler restricts all file paths to be within the directory containing the input file. See Path Security for details.

Tristate default

OptionDescription
--tristate-default=GNDConvert internal tri-state nets to priority muxes with GND default.
--tristate-default=VCCConvert internal tri-state nets to priority muxes with VCC default.

This option is accepted with --lint, --verilog, --rtlil, --ir, --test, and --simulate. It is rejected with --ast.

See Tristate Default for details.

Expansion safety options

OptionDescription
--expansion-limits=repeat-count=<n>,repeat-bytes=<n>,apply-count=<n>,apply-growth=<n>Override the hard expansion safety limits for @repeat and template @apply. Defaults: repeat-count=1024, repeat-bytes=1048576, apply-count=1024, apply-growth=4096.

Testbench options (with --test)

OptionDescription
--verbosePrint all assertion results (pass and fail), not just failures.
--seed=0xHEX32-bit hex seed for register/memory randomization. Default: 0xDEADBEEF.

Exit codes

CodeMeaning
0All tests passed
1One or more test failures
2Runtime error (x/z observation, combinational loop, etc.)
3Compile error in testbench file

Simulation options (with --simulate)

OptionDescription
-o WAVEFORM_FILEOutput waveform file path. Default: <input_basename>.vcd, or the selected format's extension when --fst or --jzw is specified.
--vcdForce VCD output format (default).
--fstForce FST output format.
--jzwForce JZW output format (SQLite-based).
--jitter=<clock>:<ps>Add peak-to-peak clock jitter in picoseconds. May be specified multiple times.
--drift=<clock>:<ppm>Add maximum clock drift in parts per million. May be specified multiple times.
--verbosePrint tick resolution, clock periods, and @run/@update events.
--seed=0xHEX32-bit hex seed for register/memory randomization. Default: 0xDEADBEEF.

Examples

bash
# Check a design for errors
jz-hdl design.jz --lint --color

# Check with full info-level output
jz-hdl design.jz --lint --info --color

# Compile to Verilog
jz-hdl design.jz --verilog -o design.v

# Compile to Verilog with tristate elimination
jz-hdl design.jz --verilog -o design.v --tristate-default=GND

# Compile to RTLIL for yosys
jz-hdl design.jz --rtlil -o design.il

# Compile with Gowin constraint output
jz-hdl design.jz --verilog -o design.v --cst design.cst

# Dump the AST for debugging
jz-hdl design.jz --ast -o design_ast.json

# View alias resolution
jz-hdl design.jz --alias-report

# View memory inference report
jz-hdl design.jz --memory-report

# View tristate analysis
jz-hdl design.jz --tristate-report

# List supported chips
jz-hdl --chip-info

# View chip details
jz-hdl --chip-info GW2AR-18

# Run testbenches
jz-hdl test_counter.jz --test

# Run testbenches with verbose output and fixed seed
jz-hdl test_counter.jz --test --verbose --seed=0xCAFE

# Run a simulation
jz-hdl sim_fifo.jz --simulate

# Run simulation with explicit output path
jz-hdl sim_fifo.jz --simulate -o fifo_waves.vcd

# Run simulation in FST or JZW format
jz-hdl sim_fifo.jz --simulate --fst
jz-hdl sim_fifo.jz --simulate --jzw

# Run simulation with clock jitter and drift
jz-hdl sim_fifo.jz --simulate --jitter=clk:200 --drift=clk:50

# Run simulation with verbose output and fixed seed
jz-hdl sim_fifo.jz --simulate --verbose --seed=0x1234

# Start the LSP server (used by editors, not invoked directly)
jz-hdl --lsp

Editor Integration

The --lsp flag starts a Language Server Protocol server over stdio. The server provides:

  • Diagnostics — errors and warnings published on file open/change
  • Hover — descriptions for JZ-HDL keywords and diagnostic rule codes
  • Completion@ directives and block keywords
  • Go-to-definition — jump to declarations of modules, ports, wires, registers, etc.

VS Code

A VS Code extension is included in the vscode-ext/ directory. To install:

bash
cd vscode-ext
npm install
npm run package:vsix

Then in VS Code: Extensions...Install from VSIX and select vscode-ext/build/jz-hdl.vsix.

The generated .vsix file is build output and should not be checked into the repository.

Settings

SettingDefaultDescription
jz-hdl.binaryPath"" (system PATH)Path to the jz-hdl binary. Leave empty to use the system-installed version.
jz-hdl.lsp.enabledtrueEnable or disable the language server.

Other Editors

Any editor with LSP support can use jz-hdl --lsp. For example:

Neovim:

lua
vim.lsp.start({
    name = "jz-hdl",
    cmd = { "jz-hdl", "--lsp" },
    filetypes = { "jz-hdl" },
})

Emacs (with lsp-mode):

elisp
(lsp-register-client
 (make-lsp-client
  :new-connection (lsp-stdio-connection '("jz-hdl" "--lsp"))
  :activation-fn (lsp-activate-on "jz-hdl")
  :server-id 'jz-hdl))