AndrewNolte / vscode-system-verilog

HDL support for VS Code
MIT License
17 stars 1 forks source link

Verilog/SystemVerilog Tools

Verilog and SystemVerilog support including linting from popular tools, completions, formatting, and project level analysis.

Install it from the VS Code Marketplace or OpenVSX

Linters

slang (recommended) || iverilog (Icarus) || verilator || modelsim || xvlog (Xilinx/Vivado) || xrun (Cadence/Xcelium)

The extension leverages the "-y" flag found on most tools, pointing it to a symlink index of the repo. This makes for almost zero per-project config when modules match each file name. A command titled Verilog: Fix filenames... is offered to help with refactoring these to match.

Note for windows users: "Developer Mode" needs to be turned on in order to create symlinks.

Multiple linters are able to run in parallel:

sample

Language Server

Snappy Hover/Goto Definition on nearly every symbol, including in other files. Optional inlay hints for ports.

sample

Completions- Modules, Params/Ports, Macros, Package references, SV builtins, etc.

sample

Set top level, which shows the hierarchy, different modules used, project level linting, and soon to be waveform integration.

Project View

See a detailed feature list and roadmap in FEATURES.md

Third party language server options: verible-verilog-ls || veridian || svls

Formatters

verible-verilog-format (recommended) || verilog-format || istyle

Verible supports both SystemVerilog and Verilog, while the others are only verilog. verilog.formatDirs lets you specify directories that you want to be formatted.


Recommended Configuration

Install universal-ctags

This is used for definition support, hover support, and most of the analysis features. Use 6.1 or later for port/param definition support

Install slang

This is the recommended linter because it's the fastest and most compliant language frontend, and it has so many more useful warnings than other tools.

Example Configuration

// these get passed to linters and other tools with -I, or the correct format for that tool
"verilog.includes": [
    "hdl/lib",
    "hdl/includes"
],
"verilog.ctags.path": "/usr/local/bin/ctags-universal",
"verilog.lint.slang.enabled": true,
// includes and '-y .sv_cache/files' are already passed to linters
"verilog.lint.slang.args": "--error-limit 200",
"verilog.lint.slang.path": "/usr/local/bin/slang",
// multiple linters can run concurrently
// you can specify if some can only run at the project level
"verilog.lint.verilator.projectEnabled": true,
// tools will use the default name on the path if not given
"verilog.svFormat.formatter": "verible-verilog-format",
"verilog.svFormat.verible.args": "--flagfile=myflags.txt",
"verilog.svFormat.verible.path": "/usr/local/bin/verible-verilog-format",
// select directories to format on save
"verilog.formatDirs": [
    "hdl/my/project/with/formatting"
],

See all config options in CONFIG.md

For debugging your config, you can see the logs in Output tab > select 'verilog' in the dropdown

Contributions are welcome, see DEVELOPING.md