Skip to content

kepler-space/svlint

 
 

Repository files navigation

svlint

SystemVerilog linter

Actions Status codecov

Crates.io svlint

svlint

Installation

Download binary

Download from release page, and extract to the directory in PATH.

snapcraft

You can install from snapcraft

sudo snap install svlint

Cargo

You can install by cargo.

cargo install svlint

Usage

Configuration

First of all, you must put a configuration file .svlint.toml to specify enabled rules. Configuration file is searched to the upper directory until /. So you can put configuration file (.svlint.toml) on the repository root like .gitignore. Alternatively, for project-wide rules you can set the environment variable SVLINT_CONFIG to something like /cad/projectFoo/teamBar.svlint.toml.

The example of configuration file is below:

[option]
exclude_paths = ["ip/.*"]
prefix_label = ""

[rules]
non_ansi_module = true
wire_reg = true

The complete example can be generated by svlint --example

[option] section

  • exclude_paths is a list of regular expression. If a file path is matched with the list, the file is skipped to check.
  • prefix_(inout|input|output) are strings which port identifiers must begin with. Only used when the corresponding rule is enabled. Defaults to "b_", "i_", and "o_" respectively.
  • prefix_label is a string which generate labels must begin with. Applicable to if/else, for, and case generate constructs when the corresponding generate_*_with_label rule is enabled. Defaults to "l_". To check only that a label exists, set this to "".
  • prefix_instance is a string which instances must begin with. Defaults to "u_".
  • prefix_(interface|module|package) are strings which definitions must begin with. An alternative naming convention for interface, module, and package names is uppercase/lowercase first letter. This is similar to Haskell where types begin with uppercase and variables begin with lowercase. These alternative rules are called (lower|upper)camelcase_(interface|module|package).

[rules] section

By default, all rules are disabled. If you want to enable some rules, true can be specified.

Configuration update

If svlint is updated, .svlint.toml can be updated to the latest version by svlint --update.

Rules

All rules are here. Suggesting a new rule through Issues or Pull requests is welcome. Some example rulesets, are available here.

If you need to turn off specific rules for a section, then you can use special comments:

...regular code...
  /* svlint off legacy_always */
always @* foo = bar; // this is special
  /* svlint on legacy_always */
...more regular code...

Plugin

svlint supports rule plugin. A sample project is below:

https://github.com/dalance/svlint-plugin-sample

Filelist

svlint supports filelist like major EDA tools. The following features are supported.

  • Substitute environment variables
  • Specify include directories by +incdir
  • Define Verilog define by +define
  • Include other filelists by -f

An example is below:

xxx.sv
${XXX_DIR}/yyy.sv
$(XXX_DIR)/zzz.sv
+incdir+$(PWD)/header/src
+define+SYNTHESIS
-f other.f

Option

svlint 0.2.12

USAGE:
    svlint [FLAGS] [OPTIONS] <files>...

FLAGS:
        --example    Prints config example
    -h, --help       Prints help information
    -s, --silent     Suppresses message
    -1               Prints results by single line
        --update     Updates config
    -V, --version    Prints version information
    -v, --verbose    Prints verbose message

OPTIONS:
    -c, --config <config>           Config file [default: .svlint.toml]
    -d, --define <defines>...       Define
    -f, --filelist <filelist>...    File list
    -i, --include <includes>...     Include path
    -p, --plugin <plugins>...       Plugin file

ARGS:
    <files>...    Source file

Releases

No releases published

Packages

No packages published

Languages

  • Rust 90.8%
  • SystemVerilog 8.7%
  • Makefile 0.5%