slang is a cool library (and some CLIs) to parse and process SystemVerilog. Although Yosys has some SystemVerilog support, it’s basic compared to the better support in slang. That’s why yosys-slang is useful. It’s a slang-based frontend to process SystemVerilog instead of Yosys’ read_verilog command.

Building Link to heading

We need to bring yosys-slang and build it. Nothing fancy there. Maybe I will spend some time on this later.

   git clone https://github.com/povik/yosys-slang.git
   cd yosys-slang
   make

Running Link to heading

Once we have slang.so, we can load it with plugin and call read_slang. Simple enough.

plugin -i ../yosys-slang/build/slang.so 

#read_verilog -sv example.sv
read_slang example.sv
hierarchy -check -top top
proc
opt

write_verilog output.v