#slang #parser #slang-rs

slang-rs

Rust bindings for the Slang Verilog parser

18 breaking releases

new 0.19.0 Apr 16, 2025
0.17.0 Apr 11, 2025
0.15.0 Feb 14, 2025
0.12.0 Nov 19, 2024

#223 in Hardware support

Download history 11/week @ 2025-01-03 254/week @ 2025-01-10 224/week @ 2025-01-17 109/week @ 2025-01-24 1238/week @ 2025-01-31 3632/week @ 2025-02-07 332/week @ 2025-02-14 168/week @ 2025-02-21 185/week @ 2025-02-28 273/week @ 2025-03-07 311/week @ 2025-03-14 537/week @ 2025-03-21 294/week @ 2025-03-28 78/week @ 2025-04-04 973/week @ 2025-04-11

1,936 downloads per month
Used in topstitch

Apache-2.0

42KB
974 lines

slang-rs

Parse SystemVerilog with Slang using a Rust API.

Note: the API is currently under development and is subject to frequent changes.

Prerequisite

First install the Slang parser. We recommend building it from source.

curl -LO "https://github.com/MikePopoloski/slang/archive/refs/tags/v6.0.tar.gz"
tar xzvf v6.0.tar.gz
cd slang-6.0
cmake -B build
cmake --build build -j8

This will take a few minutes. Then set an environment variable to specify the location of the Slang binary:

export SLANG_PATH=`realpath build/bin/slang`

Installation

Install Rust if you don't have it already:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Then clone this repository:

git clone https://github.com/xlsynth/slang-rs.git

To run the tests:

cd slang-rs
cargo test

Development

We use pre-commit as part of our CI pipeline.

If you haven't already installed pre-commit, you can do so with:

pip install pre-commit

Then install the pre-commit hooks for this repository with:

pre-commit install

The pre-commit hooks will run automatically when you attempt to commit code. You can also run pre-commit checks on-demand with:

pre-commit run

Dependencies

~7–18MB
~283K SLoC