Skip to content

Docs: Add bugpoint guide #5139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open

Docs: Add bugpoint guide #5139

wants to merge 22 commits into from

Conversation

KrystalDelusion
Copy link
Member

@KrystalDelusion KrystalDelusion commented May 22, 2025

What are the reasons/motivation for this change?

While bugpoint is great for minimising designs there isn't much documentation on how to do that.

Explain how this is achieved.

Add a how-to guide on using bugpoint, specifically aimed at people trying to minimise failing designs whether that failure is due to Yosys or the design. This includes both a user-facing guide for minimising designs and a more developer focused guide which goes into minimising scripts (with the suggestion that people using fuzzers to find bugs should be minimising their scripts so as to avoid duplicate issues).

This also makes some additions to the Loading a design page and the contributing page which I totally forgot about until just now so they are still bullet points (though both pages already were mostly bullet points, this just adds more bullet points).

If applicable, please suggest to reviewers how they can test the change.

Check links above for preview build. Some of the content assumes changes from #5068 are included.

How to guide for using bugpoint, minimizing yosys scripts, and minimizing verilog code.
AKA how to MVCE.
Talk about input files coming from command line, the `read` command, and features provided by `RTLIL::Frontend` (making note that `read_slang` is a subclass but `ghdl` isn't).
Also dropping the `autosectionlabel_maxdepth = 1` so that I can actually use the auto section labels.
Adds warning on bash substitution on scripting intro page when talking about `yosys -p`.
Fix error on duplicated heading.
Drop `cmd_ref`_ link (everything already uses :doc:`cmd_ref`).
Add a note on fuzzers, with a polite suggestion that if you're fuzzing you should put in the work of identifying the underlying issue so that you (and we) are confident you're not raising multiple issues for the same bug.
Was previously in yosys_internals which is more developer focused, rather than user focused.
Also some other tidy up and clarifications.
What do I do with the minimized design and (the first half of) Minimizing scripts
More info for creating GitHub issues and the different sections.
Discuss additional details that can be included as comments on the issue.  Also mention Gists for large files (preferable to downloading a .txt).
Add a warning about external plugins/tools.
Also add a note to `load_design.rst` about `Frontend`s and `-f` command line option.
I just missed that it only gets included in the makefile if `DISABLE_SPAWN` is set, because I was looking for the C define `YOSYS_DISABLE_SPAWN`.
part 2: electric boogaloo
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.
Move the "creating an issue" section from bugpoint.rst to "reporting bugs" in `contributing.rst`.
Fix link to `CONTRIBUTING.md`.
Update `CONTRIBUTING.md` to refer to the bugpoint guide instead of the stack overflow guide.
Minimizing scripts (and more generally identifying root cause) isn't necessary for regular bug reports.  Rather, it can be useful for developers working on *fixing* bugs, and also for fuzzers to avoid spam.
Minor adjustments to `bugpoint.rst`.
Add note to `advanced_bugpoint.rst` about primitives when minimizing scripts.
Update text to assume bugpoint PR changes.
as Stack Overflow's `How to create a Minimal, Reproducible Example`_.

Unlike RTLIL designs where we can use `bugpoint`, minimizing Verilog designs is
a much more manual, iterative process. Be sure to check any errors or warnings
Copy link
Collaborator

@georgerennie georgerennie May 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are automated tools we can recommend here that are probably easier to use than manual reduction, most notably sv-bugpoint for (system)verilog and creduce with the --not-c flag that can be useful on a range of languages, including yosys scripts themselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants