RTLDoc
Documentation for SystemVerilog projects that use Bender. One command makes a web site that joins the text a person wrote with the facts that the RTL gives.
Open the example site — the documentation of the datamover accelerator.
What you get
- A block diagram of each module, with the child instances, the interfaces and the signals between them.
- A page for each module: the ports with the resolved type and width, the parameter values, the clocks, the resets and the parent modules.
- The comment above the module. Markdown, reStructuredText and the Doxygen commands each render. A name in the comment becomes a link to that module.
- The Markdown and the reStructuredText of the repository, in the same site. A page with the name of a module attaches to that module.
- The code of each file, with the colours and a line number.
- Graphs of the hierarchy, the source files and the Bender packages, and one search over all of them.
slang elaborates the design: the macros expand, the parameters resolve and the widths are calculated. Nothing is guessed from the source text.
1. Read a repository that you do not know
Copy this into a terminal. Remove the lines for the tools that you have.
# The tools. Graphviz is the only line that changes with the operating system.
curl -LsSf https://astral.sh/uv/install.sh | sh # uv
curl https://pulp-platform.github.io/bender/init -sSf | sh # bender
sudo apt install -y graphviz # macOS: brew install graphviz
uv tool install rtldoc # or: pipx install rtldoc
# The design. Use the path of any repository that has a Bender.yml.
cd ~/my-bender-project
bender checkout # only if the dependencies are not there yet
rtldoc gen --open
The tool finds the nearest Bender.yml, elaborates each module of the root
package, writes .rtldoc/ and opens it in the browser. It adds that
directory to your .gitignore. A simulator is not necessary.
uv tool upgrade rtldoc gets a later version. To read or change the code,
clone this repository and install that directory:
uv tool install --force ~/rtldoc.
In the site: Overview gives the tops, Hierarchy gives the structure,
Files gives the compile order and the code, and a module page gives the ports
and the block diagram. Push / to search.
| Command | Function |
|---|---|
rtldoc gen |
Makes the documentation in .rtldoc/ |
rtldoc open |
Opens it. Makes it first if it is not available |
rtldoc serve |
Makes it, then serves it on http://localhost:8080 |
rtldoc doctor |
Shows the status of the necessary programs |
rtldoc init |
Writes an optional rtldoc.yml |
If a run fails, rtldoc doctor shows which program is missing. gen stops
with exit code 3 when bender is not available, and with 4 when bender cannot
resolve the dependencies. It then shows the message from bender.
2. Publish the documentation of your repository
Write the site to a directory that your host serves:
.PHONY: docs
docs:
rtldoc gen -o public
rtldoc check public --min-modules 20 --require-graphs
check gives exit code 1 if the result is not complete. Use it in your pipeline,
because a design that no longer elaborates gives an empty site and no error.
--want-module, --min-interfaces and --max-diagnostics make the condition
stronger. rtldoc check --help gives each option.
In Python, the same two steps are rtldoc.build_documentation(root, out)
and rtldoc.check_site(out).
Then let your CI job run make docs and publish public/. Each CI system
publishes in a different way, thus this repository gives no configuration. The
pages workflow of this repository is one example
for GitHub Pages.
Settings are not necessary. rtldoc.yml in the project root can give:
output: .rtldoc
name: My Design # The title. The default is the directory name
tops: [my_testbench_top] # More top modules
docs: [manual] # More directories with text. `false` reads none
sources: false # Makes no page for the code
The tool shows the code of the root package only. The code of a dependency has another licence, thus it stays in its own repository.
Contribute
git clone https://github.com/lionnus/rtldoc && cd rtldoc
uv sync --extra dev
uv run pytest # A substitute for bender, thus the tests run anywhere
uv run ruff check .
Each module has one subject: bender reads the project, extract elaborates it,
comments and markup read the text, graphs and dot draw, render writes
the site. A module imports from a lower layer only;
tests/test_architecture.py holds that rule and
the docstring of rtldoc/__init__.py gives the
layers.
A tag makes a release: rtldoc/__init__.py gives the version, and
git tag v0.2.0 && git push origin v0.2.0 starts the
release workflow. That workflow runs the tests
again, builds the wheel, and publishes it to PyPI. PyPI trusts the workflow
through OpenID Connect, thus there is no token.
Then open a pull request. CI runs ruff, the tests on Python 3.9 to 3.13, and
the coverage measurement. It then makes the documentation of two real designs,
opope and
datamover, with the true
bender, and examines the result. New code needs tests: pyproject.toml gives
the minimum coverage, and CI stops below it.
IMPROVEMENTS.md gives the design of the tool, the known
limitations, and the ideas for later work.
License
Apache-2.0. See LICENSE.
The IBM Plex fonts in rtldoc/assets/fonts have the SIL Open Font License
1.1. See rtldoc/assets/fonts/OFL.txt.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rtldoc-0.1.0.tar.gz.
File metadata
- Download URL: rtldoc-0.1.0.tar.gz
- Upload date:
- Size: 250.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b67083819f7fd8138486a38f38dfea516a3adfd1163571f06097b79483df9ee8
|
|
| MD5 |
8a116a20cdc6aef4a2d92c692cef88fb
|
|
| BLAKE2b-256 |
c2dc73df6a9458cda67f360c32d054cf1f446edb3c529aed966d3b8ca8b2489e
|
Provenance
The following attestation bundles were made for rtldoc-0.1.0.tar.gz:
Publisher:
release.yml on lionnus/rtldoc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rtldoc-0.1.0.tar.gz -
Subject digest:
b67083819f7fd8138486a38f38dfea516a3adfd1163571f06097b79483df9ee8 - Sigstore transparency entry: 2313296197
- Sigstore integration time:
-
Permalink:
lionnus/rtldoc@4f51a2e7c2ad7e73fb330c3ec9bbe5f7aa96612b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/lionnus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4f51a2e7c2ad7e73fb330c3ec9bbe5f7aa96612b -
Trigger Event:
push
-
Statement type:
File details
Details for the file rtldoc-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rtldoc-0.1.0-py3-none-any.whl
- Upload date:
- Size: 173.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed5050ef82d6169b670f3333a63429975122af75894bd63735f3c27164d6f547
|
|
| MD5 |
2cce6306151ee0ee2de709bd07970e0b
|
|
| BLAKE2b-256 |
95a01e379aff8dab8fc6fe5d5649ffc40f0b317c755e4c9650bed11759bbcf47
|
Provenance
The following attestation bundles were made for rtldoc-0.1.0-py3-none-any.whl:
Publisher:
release.yml on lionnus/rtldoc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rtldoc-0.1.0-py3-none-any.whl -
Subject digest:
ed5050ef82d6169b670f3333a63429975122af75894bd63735f3c27164d6f547 - Sigstore transparency entry: 2313296279
- Sigstore integration time:
-
Permalink:
lionnus/rtldoc@4f51a2e7c2ad7e73fb330c3ec9bbe5f7aa96612b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/lionnus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4f51a2e7c2ad7e73fb330c3ec9bbe5f7aa96612b -
Trigger Event:
push
-
Statement type: