26 breaking releases

new 0.27.0 Nov 19, 2024
0.25.0 Nov 17, 2024

#61 in Simulation

Download history 102/week @ 2024-09-03 13/week @ 2024-09-10 338/week @ 2024-09-17 850/week @ 2024-09-24 555/week @ 2024-10-01 855/week @ 2024-10-08 535/week @ 2024-10-15 371/week @ 2024-10-22 156/week @ 2024-10-29 228/week @ 2024-11-05 395/week @ 2024-11-12

1,157 downloads per month

Apache-2.0

115KB
2K SLoC

topstitch

Stitch together Verilog modules with Rust.

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

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/topstitch.git

Demo

A basic demo of hierarchy, multiple instantiation, and connection is in examples/demo.rs.

Run the demo with:

cargo run --example demo

This produces output in examples/output/top.sv. Note: the first time that you build this project, it might take several minutes to build dependencies.

If you want to simulate the Verilog code that is produced, first install Icarus Verilog if you don't have it already (via Homebrew, apt, etc.). Then cd into examples/tb and run:

./demo.sh

This will produce the following output:

 597
demo.sv:16: $finish called at 0 (1s)

The output 597 is expected, as this is the sum of inputs 121, 212, and 222, along with a constant 42.

Building Slang

Topstitch can use the open source "slang" tool as a module parser and elaborator.

You may see messages when running the demo, similar to:

Please set the SLANG_PATH environment variable to the path of the slang binary.

See the Slang quick start for instructions on how to build the slang binaries, then point to the slang binary directly, not to the directory path; e.g.

$ export SLANG_PATH=$HOME/src/slang/build/bin/slang

Dependencies

~8–20MB
~313K SLoC