Parse SystemVerilog with Slang using a Rust API.
Note: the API is currently under development and is subject to frequent changes.
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.gzcd slang-6.0cmake -B buildcmake --build build -j8This 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`Install Rust if you don't have it already:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shThen clone this repository:
git clone https://github.com/xlsynth/slang-rs.gitTo run the tests:
cd slang-rscargo testWe 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-commitThen install the pre-commit hooks for this repository with:
pre-commit installThe 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