Skip to content

Commit 29f9347

Browse files
bugpoint.rst: Extra notes
Move `yosys -h bugpoint` failure into a code-block to break up text. Same for the `exec -expect-return` example. TODOs on #5068 being merged.
1 parent e52c935 commit 29f9347

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

docs/source/using_yosys/bugpoint.rst

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ Minimizing failing (or bugged) designs
2424
.. _iverilog: https://steveicarus.github.io/iverilog/
2525
.. _verilator: https://www.veripool.org/verilator/
2626

27+
- are there any warnings before the error (either immediately before or in an
28+
earlier command) that could be related?
29+
- does calling `check` before the failure give any errors or warnings?
30+
- did you call `hierarchy` before the failure?
31+
32+
+ can you call ``hierarchy -check``?
33+
2734
- make sure to back up your code (design source and yosys script(s)) before
2835
making any modifications
2936

@@ -50,9 +57,15 @@ build of Yosys. Because the command works by invoking external processes, it
5057
requires that Yosys can spawn executables. Notably this means `bugpoint` is not
5158
able to be used in WebAssembly builds such as that available via YoWASP. The
5259
easiest way to check your build of Yosys is by running ``yosys -h bugpoint``. If
53-
Yosys displays the help text for `bugpoint` then it is available for use, but if
54-
it instead prints "No such command or cell type: bugpoint", then `bugpoint` is
55-
not available.
60+
Yosys displays the help text for `bugpoint` then it is available for use.
61+
62+
.. code-block:: console
63+
:caption: `bugpoint` is unavailable
64+
65+
$ yosys -h bugpoint
66+
67+
-- Running command `help bugpoint' --
68+
No such command or cell type: bugpoint
5669
5770
Next you need to separate loading the design from the failure point; you should
5871
be aiming to reproduce the failure by running ``yosys -s <load.ys> -s
@@ -87,8 +100,11 @@ making use of the `exec` command in ``<failure.ys>``. This is especially useful
87100
when Yosys is outputting an invalid design, or when some other tool is
88101
incompatible with the design. Be sure to use the ``exec -expect-*`` options so
89102
that the pass/fail can be detected correctly. Multiple calls to `exec` can be
90-
made, or even entire shell scripts (e.g. ``exec -expect-return 1 -- bash
91-
<script.sh>``).
103+
made, or even entire shell scripts:
104+
105+
.. code-block:: yoscrypt
106+
107+
exec -expect-return 1 --bash <script.sh>
92108
93109
Our final failure we can use with `bugpoint` is one returned by a wrapper
94110
process, such as ``valgrind`` or ``timeout``. In this case you will be calling
@@ -98,6 +114,8 @@ leak or excessive runtime. Note however that unlike the `exec` command, there
98114
is currently no way to check the return status or messages from the wrapper
99115
process; only a binary pass/fail.
100116

117+
.. TODO:: above note pending updated bugpoint #5068
118+
101119

102120
How do I use bugpoint?
103121
~~~~~~~~~~~~~~~~~~~~~~
@@ -140,11 +158,7 @@ For more about the options available, check ``help bugpoint`` or
140158
work with runtime errors such as a ``SEGFAULT`` as it is only able to match
141159
strings from the log file.
142160

143-
.. TODO:: Consider checking ``run_command`` return value for runtime errors.
144-
145-
Currently ``BugpointPass::run_yosys`` returns ``run_command(yosys_cmdline) ==
146-
0``, so it shouldn't be too hard to add an option for it. Could also be
147-
used with the ``-runner`` option, which might give it a bit more flexibility.
161+
.. TODO:: above note pending updated bugpoint #5068
148162

149163
By default, `bugpoint` is able to remove any part of the design. In order to
150164
keep certain parts, for instance because you already know they are related to
@@ -177,6 +191,8 @@ you are using the ``-runner`` option, try replacing the `bugpoint` command with
177191
<failure.ys> test.il`` to check it works as expected and returns a non-zero
178192
status.
179193

194+
.. TODO:: note on ``!`` (link to :ref:`getting_started/scripting_intro:script parsing`)
195+
180196
Depending on the size of your design, and the length of your ``<failure.ys>``,
181197
`bugpoint` may take some time; remember, it will run ``yosys -s <failure.ys>``
182198
on each iteration of the design. The bigger the design, the more iterations.

0 commit comments

Comments
 (0)