3
0
Fork 0
mirror of https://github.com/YosysHQ/sby.git synced 2026-05-10 14:32:27 +00:00

Docs: Advanced tag use

Add complex pycode example, generating tasks and then parsing tags to select source files.  Warn against doing it, and reiterate the usefulness of `--dumptasks` and `--dumpcfg`.
Modify gen.sh for modifiable script/task and to echo how it was called (in case they need to be regenerated, which isn't a problem for the regular example/task1 but is for the complex one).
This commit is contained in:
Krystine Sherwin 2026-05-05 17:50:49 +12:00
parent b476597edf
commit 1a27ba7b1b
No known key found for this signature in database
8 changed files with 143 additions and 9 deletions

View file

@ -0,0 +1,6 @@
Advanced SBY usage/examples
===========================
.. toctree::
tags

View file

@ -0,0 +1,35 @@
Tasks and tags
==============
Complex pycode blocks
---------------------
The following example demonstrates how to configure safety and liveness checks
for all combinations of host and device implementations. Note that the ``task``
variable is set to a value of ``None`` when initially parsing the ``.sby`` file,
so it is important to check ``if task is not None`` to avoid the
``AttributeError`` when trying to use string methods on it.
.. literalinclude:: /../examples/tags/complex.sby
:language: sby
:caption: ``docs/examples/tags/complex.sby``
.. warning::
Including section headings in pycode blocks like this is a quick way to make
your ``.sby`` file very difficult to follow and is generally not recommended.
However since it is not possible to share variables between pycode sections,
in cases such as this it does simplify adding new host/device implementations
while avoiding duplication of the tag parsing.
When working with complex ``.sby`` files like this, it is very helpful to use
``--dumptasks`` and ``--dumpcfg`` to confirm things are being pre-processed as
expected.
.. literalinclude:: /../examples/tags/complex.log
:language: console
:start-at: dumptasks
:end-before: dumptags
.. literalinclude:: /../examples/tags/complex.log
:language: console
:start-at: dumpcfg