Sphinx Extension
svblock includes a Sphinx extension that provides the .. svblock:: directive
for embedding pin diagrams directly in your documentation.
Setup
Install svblock with Sphinx support:
pip install svblock[sphinx]
Add the extension to your Sphinx conf.py:
extensions = [
"svblock.sphinx_ext",
# ... other extensions
]
Basic Usage
The directive takes a path to a SystemVerilog file (relative to the Sphinx source directory) and renders the module as an inline SVG:
.. svblock:: hdl/fifo.sv
This renders the first module found in the file.
Directive Options
.. svblock:: hdl/fifo.sv
:module: fifo_ctrl
:theme: dark
:no-params:
:no-groups:
:no-decorators:
:width: 400
Option |
Type |
Description |
|---|---|---|
|
string |
Name of the module to render. Defaults to the first module in the file. |
|
string |
Theme name ( |
|
flag |
Suppress the parameter section in the header. |
|
flag |
Suppress group separator lines. |
|
flag |
Suppress clock/active-low/bus decorators. |
|
integer |
Override minimum box width in pixels. |
Examples
Minimal:
.. svblock:: hdl/uart_tx.sv
Specific module with dark theme:
.. svblock:: hdl/soc_top.sv
:module: spi_master
:theme: dark
Clean diagram for a datasheet:
.. svblock:: hdl/adc_controller.sv
:no-params:
:no-decorators:
:theme: print
:width: 500
Error Handling
The directive reports Sphinx warnings (not build failures) for:
File not found
No modules found in the file
Parse errors in the SystemVerilog source
This means a broken .sv path won’t break your entire docs build – it will
produce a warning and skip the diagram.
How It Works
The directive runs the full svblock pipeline at Sphinx build time:
Resolves the
.svfile path relative to the Sphinx source directoryParses the file with
pyslangApplies grouping, layout, and rendering
Injects the resulting SVG as a raw HTML node in the document
Since pyslang is required at build time, ensure it is installed in your docs
build environment.