3
0
Fork 0
mirror of https://github.com/YosysHQ/sby.git synced 2026-05-11 06:52:30 +00:00

Docs: regex tag matching

This feels cursed.
This commit is contained in:
Krystine Sherwin 2026-05-06 09:12:05 +12:00
parent 974c2339d9
commit aed51170fb
No known key found for this signature in database
3 changed files with 107 additions and 0 deletions

View file

@ -107,3 +107,30 @@ generated config does not include any lines that are conditionally enabled
.. literalinclude:: /../examples/tags/complex.log
:language: console
:start-at: dumpcfg
A better way
~~~~~~~~~~~~
For this particular example, a better approach might be the following:
.. literalinclude:: /../examples/tags/alt.sby
:language: sby
This uses regex string matching on the task name, allowing any task to be
provided in the ``sby`` call that matches at least one task. This allows for
all of the same calls, e.g. ``sby alt.sby unbounded_hAdX``, but there are no
longer any default tasks, so calling ``sby alt.sby`` is no longer valid.
.. warning::
So long as the provided task matches *any* regex task then SBY will recognize
it as valid, opening up the potential for downstream issues where a partially
recognized task name is not fully configured. Extreme care should be taken
when using multiple regex tasks.
We use the tag ``known`` here to validate that the host/device implementations
are valid. This isn't strictly necessary, but it does mean that we can provide
an error message if an unknown host/device is used, and demonstrates that care
must be taken when using regex matching. e.g. without the ``assert task is
None`` line, a task of ``witness_hAdX`` would provide an error message about
``mode`` being unset, which may not be immediately obvious as to why that is.