Skip to main content

SystemVerilog Formatter

· loading · loading · · ·
HDL Verilog HDL
Axolot Logic
Author
Axolot Logic
Digital Design Engineer
Table of Contents

๐Ÿ› ๏ธ Installing and Using Verible SystemVerilog Formatter on Windows
#

This guide explains how to install and use the Verible SystemVerilog Formatter on Windows.


1. What is Verible?
#

Verible is an open-source SystemVerilog linting and formatting tool developed by Google. It automatically formats your HDL code, identifies syntax issues, and enforces consistent style according to defined rules.


2. Installing Verible on Windows
#

Verible doesnโ€™t have a direct Windows installer, but you can install it using the methods below:


โœ… Method 1: Installing via Chocolatey (Recommended) #

Chocolatey is a package manager for Windows that allows easy installation of CLI tools like Verible.

1. Install Chocolatey (if not already installed)
#

Open PowerShell as Administrator and run:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Close and reopen the terminal, then verify the installation:

choco --version

2. Install Verible via Chocolatey
#

choco install verible

Verify installation:

verible-verilog-format --version

โš™๏ธ Method 2: Manual Installation from Prebuilt Binaries
#

If you prefer not to use Chocolatey:

1. Download Verible Binary
#

  1. Go to the official Verible GitHub Releases page.
  2. Download the latest Windows (win64.zip) build.
  3. Extract it to a directory, e.g., C:\verible.

2. Add Verible to PATH
#

To run verible-verilog-format from any directory:

  1. Open Start Menu โ†’ Search for Edit environment variables โ†’ Open.
  2. Under System Variables, select Path โ†’ click Edit.
  3. Click New, then enter: C:\verible\bin
  4. Save and restart your PowerShell or Command Prompt.

3. Verify Installation
#

Run the following in PowerShell:

verible-verilog-format --version

If version info appears, Verible is installed successfully.


3. Using the Verible Formatter
#

Once installed, you can format your SystemVerilog files as follows:


๐Ÿ“„ 1. Format a Single File
#

verible-verilog-format my_design.sv

Prints the formatted version to the terminal.


๐Ÿ“ 2. Format All Files in a Directory
#

verible-verilog-format *.sv

Formats all .sv files in the current directory.


๐Ÿ’พ 3. Overwrite the Original File (In-place)
#

verible-verilog-format my_design.sv --inplace

This modifies the file directly.


๐ŸŽจ 4. Use Custom Style Options
#

You can override default options like indentation and line length:

verible-verilog-format --indentation_spaces=4 --max_line_length=120 my_design.sv
  • --indentation_spaces=4: Use 4 spaces for indentation.
  • --max_line_length=120: Limit line length to 120 characters.

๐Ÿงฉ 5. Integrate with Visual Studio Code
#

To use Verible as a formatter in VS Code:

  1. Install the Verilog/SystemVerilog extension from the VS Code marketplace.
  2. Enable Format on Save in VS Code settings.
  3. Add the following to your settings.json:
{
  "verilog.formatting.command": "verible-verilog-format",
  "verilog.formatting.arguments": ["--indentation_spaces=4", "--max_line_length=120"]
}

Now, your .sv files will auto-format on save.


โœ… Conclusion
#

Youโ€™ve now learned how to install and use Verible SystemVerilog Formatter on Windows. If you encounter any issues:

  • Test with: verible-verilog-format --version
  • Ensure the binary is added to your systemโ€™s PATH
  • Try formatting from the terminal or within VS Code

Good luck, and happy coding! ๐Ÿš€

Related

RISC-V Imperas
· loading · loading
HDL Verilog HDL
Blocking vs Non-Blocking Assignments
· loading · loading
HDL Verilog HDL
Command-Line Input
· loading · loading
HDL Verilog HDL
Compiler Directives & Macros
· loading · loading
HDL Verilog HDL
Control Flow
· loading · loading
HDL Verilog HDL
Delay Controls
· loading · loading
HDL Verilog HDL