3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-16 22:05:37 +00:00
Commit graph

1669 commits

Author SHA1 Message Date
Krystine Sherwin 032ab8e444
Drop <cmd>.rst dump 2025-03-21 10:34:40 +13:00
Krystine Sherwin ebd6d5f85b
cmdref: Drop optiongroups
Linking to optiongroups doesn't add *that* much, and is kind of a pain; meanwhile having the optiongroups adds an extra level of indentation.
Instead of options needing to be in an option group, they instead go in either the root node or nested in a usage node.  Putting them in a usage node allows for more-or-less the previous behaviour but without making it the default.
2025-03-21 10:28:48 +13:00
Krystine Sherwin a2433ba34b
cmdref: Format help_script() output as yoscrypt
Or at least all of the synth commands, because they have the same preceding text.
Except `synth_fabulous`, because that has unconditional `read_verilog`s at the start.  Which seems like a bad idea and and not compatible with `-run`?
2025-03-21 10:28:48 +13:00
Krystine Sherwin b1c9097a12
cmdref: codeblock language now works
Add `options` map for setting `ContentListing` options with key:val pairs; currently only used with `ContentListing::codeblock()` language arg.
Fix generated codeblock rst to print each line of code with indentation, and change it to use explicit an `code-block` so we can set a language on it.
2025-03-21 10:28:48 +13:00
Krystine Sherwin a74aeb1301
Docs: Grouping changes
Keep techlibs folder hierarchy.
techlibs/* and passes/* groups are now nested under index_techlibs and index_passes respectively, with most (all?) of the passes/* pages getting proper headings, as well as backends/frontends/kernel.  `index_passes_techmap` also references `index_techlibs`.
Split command reference toc in twain, one with maxdepth=2 and one with maxdepth=3, since passes and techlibs now have an extra level of nesting.
Move the `cmd_ref` link to the command reference, instead of top of the page.
Remove `index_internal` and `index_other` from the toc, and mark the pages as orphan. Internal commands get a note callout after the command reference toc (although this doesn't work for the pdf build), while other commands are linked in the warning for missing `source_location` (since that *should* be the only time when there are any commands in the "unknown" group).
Update autodoc extension versions, and mark the directives extension as not `parallel_read_safe` (it might be, but I'm not sure about how the xref lookups work if it is parallel so better to be safe).
2025-03-21 10:26:12 +13:00
Krystine Sherwin a898ade473
cmdref: Export internal_flag to json
Commands flagged as internal will display a warning, just like experimental commands.
Drop `passes/tests` group in favour of `internal` group, which is automatically assigned for any command without an assigned group which is flagged as internal.
2025-03-21 10:26:12 +13:00
Krystine Sherwin b9485ce094
register.h: Add internal_flag to Pass
Update experimental pass warnings to use a shared function.  Reduces repetition, and also allows all of the warning flags to be combined (which at present is just experimental and the new internal).
Update `test_*` passes to call `internal()` in their constructors.
2025-03-21 10:26:12 +13:00
Krystine Sherwin f4ad934542
log_help: Refactor help content adding
Content is now added to the `ContentListing` rather than the `PrettyHelp`.
`open_*` methods return the `ContentListing` that was added instead of leaving a hanging continuation.
This allows for (e.g.) options to be added directly to optiongroups, instead of requiring that groups be closed before continuation.
This also means that all `PrettyHelp`s are a listing, with the actual log being called by the default `Pass::help()`; making the mode field redundant.
Added `PrettyHelp::log_help()` which replaces the `PrettyHelp::Mode::LOG` logic.
Added `ContentListing::back()` which just returns the last element of the underlying content vector.
Some of the content tracking was made redundant and removed, in particular `PrettyHelp::_current_listing` and `ContentListing::parent`.

Converted `ContentListing` to a class instead of a struct, adjusting constructors to match.
Added `ContentListing` constructor that accepts a `source_location`.

Update `HelpPass::dump_cmds_json()` for new log_help.
2025-03-21 10:26:12 +13:00
Krystine Sherwin 68cb02d9f3
Rename help_v2 to formatted_help
Also add comments to `help()` and `formatted_help()` to clarify usage.
2025-03-21 10:26:11 +13:00
Krystine Sherwin 34c514bf96
source_location: Try use __has_include 2025-03-21 10:26:11 +13:00
Krystine Sherwin d244b4a101
register: Remove <filesystem>
Use `string::find_last_of()` instead.
Not sure how this works on windows, but it was already using '/' so at least it's not any worse.
2025-03-21 10:26:11 +13:00
Krystine Sherwin 2575f87381
source_location: Auto detect library
Drop `ENABLE_SOURCE_LOCATION` flag.
2025-03-21 10:26:11 +13:00
Krystine Sherwin 07c2666447
dump_cmds_json: Output groups
Also output `pass->location.{file_name,line,function_name}()`.
If no group is given (i.e. it is "unknown"), attempt to automatically apply a group.
If we have source locations, this is based on path to the source file.
If we do not have source locations, try to match on the pass name instead.
2025-03-21 10:26:10 +13:00
Krystine Sherwin aedc13ab7f
log_help: Add manual group support
Sets `chformal` group to "formal" for testing purposes
2025-03-21 10:26:10 +13:00
Krystine Sherwin 1efd3aeb7d
Move source_location to register.h
Revert `PrettyHelp::get_current()` for no args since we can use `Pass::location` instead.
2025-03-21 10:26:10 +13:00
Krystine Sherwin 620dcd8a38
dump_cmds_json: Fix auto formatting
- Command list for script passes
- Check buffer after loop
- Close options properly
- Ignore mismatched sigs e.g. `fsm_detect` on `fsm`
- Require double blank line before new signature
2025-03-21 10:26:10 +13:00
Krystine Sherwin 35498ae3f6
docs: Working cmdref groups
Also adds note on source location if available.
2025-03-21 10:26:10 +13:00
Krystine Sherwin a0da79981b
log_help: Better location tracking
Assign root location in call to `PrettyHelp::get_current()`.
Set default `source_file` to `"unknown"`, since that appears to be the default value rather than `nullptr`.
2025-03-21 10:26:10 +13:00
Krystine Sherwin 59bcd7ce14
cmdref: Combine consecutive code blocks
Formatting is nicer when there is only one code block instead of multiple in a row, especially in pdf.
2025-03-21 10:25:46 +13:00
Krystine Sherwin 0e1434ac0c
Docs: Fix dump_cmds_json for PrettyHelp 2025-03-21 10:25:45 +13:00
Krystine Sherwin fd5e420edd
log_help: {add,push,pop}_content helpers 2025-03-21 10:25:45 +13:00
Krystine Sherwin 09dfbea6df
log_help: Json dumpable
Current modes are `LOG` and `LISTING`, which `log()` and store for conversion to json respectively.
Add `ContentListing` listing struct to (recursively) contain help data for conversion to a json object to be exported and used elsewhere (e.g. the docs).
Rather than formatting as rst we can just export with type information and do the conversion at the destination (i.e. in the python code which loads the domain for autodoc).
Implement `PrettyHelp::has_content()`.
Provide `PrettyHelp::get_content()` which returns a read-only list of the current content.
`PrettyHelp` constructor takes optional `Mode` enum to define format of help content.
Updates `PrettyHelp` methods to use a switch case for checking current mode, calling `log_abort()` in the default case (i.e. unsupported mode).
2025-03-21 10:25:45 +13:00
Krystine Sherwin a7da7d3a56
log_help: Include source_location
Use `std::experimental::source_location` because clang support is `??`
Add `ENABLE_SOURCE_LOCATION` make variable and corresponding `YOSYS_ENABLE_SOURCE_LOCATION` define.
Dummy out the struct if disabled and check for null instead of using `#ifdef` blocks everywhere.
2025-03-21 10:25:45 +13:00
Krystine Sherwin 40e6fe8263
log_help: Options can have content
Refactor `PrettyHelp::endgroup()` -> `PrettyHelp::close(int levels = 1)`.
2025-03-21 10:25:45 +13:00
Krystine Sherwin af9e0dd0f4
WIP docs: Proto log_help
Define `PrettyHelp` class with methods for declaring different parts of help message.
Currently able to produce standard help messages as expected.
Updates chformal to use (only) the new help_v2.
Currently makes use of a global static to track the current help context, allowing register.h to live in blissful ignorance and instead rely on help_v2 implementations calling `auto *help = PrettyHelp::get_current();` and `return true;` to minimise impact on rebuilds (i.e. not requiring every source file to be recompiled).
2025-03-21 10:25:45 +13:00
Krystine Sherwin 5d239204f2
Docs: Proto doc_string approach for cmd help
Add `doc_string` field to `Pass` constructor
Add `docs/util/newcmdref.py` to contain command domain
Update `docs/util/cmdref.py` with `cmd:usage` and `cmd:optiongroup` for describing commands.
Functional, but WIP.
2025-03-21 10:24:28 +13:00
Krystine Sherwin 63be4d3dd3
Docs: WIP dump_cmds_json 2025-03-21 10:24:28 +13:00
Krystine Sherwin 41a489f085
register: Add pass_usages and default help
Experimental new formatting for describing passes that can be rendered into the standard help format, as well as being more amenable to smarter formatting for web documentation.
2025-03-21 10:24:27 +13:00
Krystine Sherwin 31dba47521
json.h: Fix array template
Using `{begin|end}_object` inserts curly braces instead of square brackets, which can result in reordering (and may be syntactically incorrect?).
2025-03-21 10:24:27 +13:00
Krystine Sherwin 1f1eb1ab57
Docs: Remove unused write_cell_rst function
The `help -write-rst-cells-manual` approach was made redundant by `help -dump-cells-json`.
2025-03-21 10:24:27 +13:00
Emil J. Tywoniak 7aefd4b226 gzip: back to pointers 2025-03-19 13:43:44 +01:00
Emil J. Tywoniak a8a5463f57 gzip: uphold rules for basic_streambuf::underflow overrides 2025-03-19 13:43:44 +01:00
Emil J. Tywoniak 79985a2bca gzip: minor refactor 2025-03-19 13:43:44 +01:00
Emil J. Tywoniak ceb7a923da io: smooth out non-POSIX function usage across platforms 2025-03-19 13:43:44 +01:00
Emil J. Tywoniak ab2ca831c9 io: remove unused unistd.h to fix windows build 2025-03-19 13:43:44 +01:00
Emil J. Tywoniak d00259081d gzip: simplify uncompressed interface 2025-03-19 13:43:44 +01:00
Emil J. Tywoniak 813f909460 gzip: istream 2025-03-19 13:43:44 +01:00
Emil J. Tywoniak 4f3fdc8457 io: refactor string and file work into new unit 2025-03-19 13:43:42 +01:00
KrystalDelusion 9fa1f0e70c
Merge pull request #4567 from kivikakk/cxxrtl-escape-trailing
cxxrtl: use octal encoding of non-printables.
2025-03-14 16:52:07 +13:00
Martin Povišer 6da543a61a
Merge pull request #4818 from povik/macc_v2
Add `$macc_v2`
2025-03-12 22:55:40 +01:00
N. Engelhardt 0dfd9e9395
Merge pull request #4868 from david-sawatzke/improve_tcl_output_docs
tcl: Update help message to clarify usage of `result.string`
2025-03-03 15:16:42 +00:00
Emil J. Tywoniak 78cb10da69 improve mkdtemp error message 2025-02-26 12:06:54 +01:00
Emil J b4a169527d
Merge pull request #4894 from YosysHQ/emil/abstract
Add `abstract` pass for formal verification
2025-02-25 11:16:37 +01:00
Jannis Harder 7cd822b7f5 rtlil: Add {from,to}_hdl_index methods to Wire
In the past we had the occasional bug due to some place not handling all
4 combinations of upto/downto and zero/nonzero start_offset correctly.
2025-02-18 17:08:45 +01:00
KrystalDelusion 31b00b4c72
celledges: Use b_width_capped for left shifts
`b_width_capped` already exists for preventing arithmetic overflow, limiting the value of `b_width` to 30.  This just changes the left shifts to also use it.
The caveat of incorrect results for extremely large values of `a_width` still applies, as does the improbability of that actually happening.
This fixes #4844 (or at least, the floating point exception; the circuit still isn't valid but I think that's fine).
2025-01-31 11:03:33 +13:00
David Sawatzke 09ead2daa9 tcl: Update help message to clarify usage of result.string
In the current documentation, it's unclear if `result.string` serves as
an example of a string name. It is furthermore unclear what the purpose
of `result.string` is. Clarify this by adding a small explanation (and
fix a typo)
2025-01-28 09:42:39 +01:00
Martin Povišer 1d57a7cf6b macc_v2: Relax and fix cell check 2025-01-27 15:52:49 +01:00
Martin Povišer aabb4ea1df macc_v2: Fix checks and parameter padding 2025-01-27 13:08:19 +01:00
Martin Povišer cb8f855f34 rtlil: Fix macc_v2 cell check 2025-01-24 12:38:03 +01:00
Martin Povišer 61450e8b6e Update codebase for macc_v2 2025-01-24 12:38:03 +01:00