AndrewNolte / vscode-system-verilog

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

Verilog/SystemVerilog Tools

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

Install it from the VS Code Marketplace or OpenVSX

sample

Linters

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

The extension will make symlinks to all verilog files in .sv_cache/files, and then pass that to tools with the -y flag so they can discover modules without the need for individual build configs. This can be disabled with verilog.index.enableSymlinks: false. Note for windows users: "Developer Mode" needs to be turned on in order to reduce the permissions needed to create a symlink, otherwise .sv_cache/files will not get populated.

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 format on save, or you can use the global formatOnSave option for verilog/systemverilog.

Language Servers

Built-in language server

Alt text -->

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

Fst/Vcd/Ghw support from Surfer

Recommended SystemVerilog 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