Tools#
Verible#
Verible is an open-source SystemVerilog style linter and formatting tool. The style linter is relatively mature and is used as part of our generation flow to analyze RTL components. Linting serves as a productivity tool for designers to quickly find typos and bugs at the time when the RTL is designed.
We leverage Verible to capture different aspects of the code and detect style elements that violate the lowRISC Verilog Coding Style Guide, thus reducing manual code alignment steps.
How to Install#
You can download and build Verible from scratch as explained on the Verible GitHub page. However, since this requires the Bazel build system we recommend consulting the Verible releases and download a pre-built binary for your machine.
The example below is for Ubuntu 20.04:
export VERIBLE_VERSION=v0.0-3644-g6882622d
wget https://github.com/google/verible/releases/download/${VERIBLE_VERSION}/verible-${VERIBLE_VERSION}-Ubuntu-20.04-focal-x86_64.tar.gz
tar -xf verible-${VERIBLE_VERSION}-Ubuntu-20.04-focal-x86_64.tar.gz
If you are using Ubuntu 18.04 then instead use:
export VERIBLE_VERSION=v0.0-3644-g6882622d
wget https://github.com/google/verible/releases/download/${VERIBLE_VERSION}/verible-${VERIBLE_VERSION}-Ubuntu-18.04-bionic-x86_64.tar.gz
tar -xf verible-${VERIBLE_VERSION}-Ubuntu-18.04-bionic-x86_64.tar.gz
Note that we currently use version v0.0-3644-g6882622d, but it is expected that this version is going to be updated frequently, since the tool is under active development.
How to Use#
Once the generation flow completes, Verible can be used to analyze the generated RTL.
The tool arguments and invocations are managed in scripts/verible-format.py.
For example, the generated RTL of the target platform richie_example is analyzed by running the following command from the Toolchain root:
make check_systemverilog TARGET_PLATFORM=richie_example
Pylint#
Pylint is a static code analyser for Python 2 or 3.
We leverage Pylint to detect style elements that are in violation of the PEP8 Python Code Style Guide, thus reducing manual code alignment steps.
How to Install#
Pylint is automatically installed within the Python Virtual Environment of the Richie SLD toolchain.
How to Use#
Run the following command from the Toolchain root:
make check_python
ShellCheck#
ShellCheck is a shell script static analysis tool, which can detect style elements that are in violation of the Google Shell Style Guide.
How to Install#
Consult the ShellCheck repository and learn how to install the tool. We suggest downloading pre-compiled binaries for the latest release.
The example below is for Linux x86-64 (statically linked):
wget https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz
tar -xf shellcheck-stable.linux.x86_64.tar.xz
How to Use#
Run the following command from the Toolchain root:
make check_shell
Template support in VSCode#
Visual Studio Code (VSCode) allows to define language styles for custom file extensions.
How to Install#
Follow the following instructions:
Open VSCode
Press CTRL+SHIFT+p.
Search for Preferences: Open User Settings (JSON) and add the following configuration:
"files.associations": {
"*.sv.mako": "systemverilog",
"*.v.mako": "verilog",
"*.c.mako": "c",
"*.py.mako": "python",
"*.tcl.mako": "tcl",
"*.yml.mako": "yml"
}