3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-07-27 06:27:57 +00:00
Commit graph

1730 commits

Author SHA1 Message Date
Krystine Sherwin
605f12c2ae
Rename help_v2 to formatted_help
Also add comments to `help()` and `formatted_help()` to clarify usage.
2025-07-21 10:34:54 +12:00
Krystine Sherwin
23a066f71f
source_location: Try use __has_include 2025-07-21 10:34:54 +12:00
Krystine Sherwin
041f390a24
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-07-21 10:34:54 +12:00
Krystine Sherwin
534163cf4b
source_location: Auto detect library
Drop `ENABLE_SOURCE_LOCATION` flag.
2025-07-21 10:34:54 +12:00
Krystine Sherwin
7b625591c8
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-07-21 10:34:32 +12:00
Krystine Sherwin
1c627f4a1b
log_help: Add manual group support
Sets `chformal` group to "formal" for testing purposes
2025-07-21 10:34:31 +12:00
Krystine Sherwin
6fdefee35b
Move source_location to register.h
Revert `PrettyHelp::get_current()` for no args since we can use `Pass::location` instead.
2025-07-21 10:34:31 +12:00
Krystine Sherwin
8d1b9b1c1f
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-07-21 10:34:13 +12:00
Krystine Sherwin
00b6d96aee
docs: Working cmdref groups
Also adds note on source location if available.
2025-07-21 10:34:13 +12:00
Krystine Sherwin
3691bb674c
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-07-21 10:34:13 +12:00
Krystine Sherwin
cb502e7505
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-07-21 10:34:12 +12:00
Krystine Sherwin
fe2be07bc8
Docs: Fix dump_cmds_json for PrettyHelp 2025-07-21 10:34:12 +12:00
Krystine Sherwin
7d0bcd8b48
log_help: {add,push,pop}_content helpers 2025-07-21 10:34:12 +12:00
Krystine Sherwin
d4498acea7
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-07-21 10:34:12 +12:00
Krystine Sherwin
ae3514adfd
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-07-21 10:34:12 +12:00
Krystine Sherwin
10fea26fa9
log_help: Options can have content
Refactor `PrettyHelp::endgroup()` -> `PrettyHelp::close(int levels = 1)`.
2025-07-21 10:34:11 +12:00
Krystine Sherwin
3bef122a3f
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-07-21 10:34:11 +12:00
Krystine Sherwin
714790c70b
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-07-21 10:33:31 +12:00
Krystine Sherwin
804e18e0c6
Docs: WIP dump_cmds_json 2025-07-21 10:32:51 +12:00
Krystine Sherwin
28ecb91052
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-07-21 10:32:51 +12:00
Krystine Sherwin
2c79aeb7ad
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-07-21 10:32:09 +12:00
Krystine Sherwin
fe3adfd960
Docs: Remove unused write_cell_rst function
The `help -write-rst-cells-manual` approach was made redundant by `help -dump-cells-json`.
2025-07-21 10:32:09 +12:00
Emil J. Tywoniak
f34c4f2e26 log: deduplicate unescape_id from log_id 2025-07-09 16:20:27 +02:00
Robert O'Callahan
743df9f0f9 Fix space leak in SatGen::importSigSpecWorker() by avoiding log_id().
Calling `log_id()` leaks a copy of the ID into `log_id_cache` until the
end of the pass, which causes exorbitant memory usage.

See issue #5210.
2025-07-08 23:53:38 +00:00
George Rennie
478b6a2b3f kernel: treat zero width constant as zero 2025-07-08 19:37:59 +01:00
Emil J
513f0f16dd
Merge pull request #5173 from RonxBulld/refine_setup_shutdown_flags
Allows calling yosys_shutdown and then yosys_setup to restart.
2025-06-24 12:32:52 +02:00
KrystalDelusion
4ade617c41
driver.cc: Don't split options on commas 2025-06-13 10:31:53 +12:00
N. Engelhardt
0b19f628e9
Merge pull request #5172 from YosysHQ/nak/reduce_warning_spam 2025-06-08 06:50:56 +00:00
RonxBulld
d079240d38
Allows calling yosys_shutdown and then yosys_setup to restart. 2025-06-07 22:21:09 +08:00
N. Engelhardt
3fe31294d6 disable warning for intentional use of deprecated function (to assert the feature isn't used any more) 2025-06-06 16:41:25 +02:00
Emil J. Tywoniak
a16227b209 Revert "Change the implementation of log_debug in kernel/log.h from a macro function to a normal function."
This reverts commit 15cfce061a.
2025-06-06 15:14:40 +02:00
George Rennie
3ef4c91c31
Merge pull request #5148 from georgerennie/george/convertible_to_int_fix
Fix convertible_to_int handling of 32 bit unsigned ints with MSB set.
2025-05-29 10:33:12 +01:00
KrystalDelusion
489a12d6c1
Merge pull request #5141 from garytwong/unique-if
Accept (and ignore) SystemVerilog unique/priority if.
2025-05-27 09:45:50 +12:00
George Rennie
e0c1e88f19 kernel: use try_as_int to implement as_int_compress 2025-05-26 15:34:13 +01:00
George Rennie
33a22b5cd1 kernel: fix convertible_to_int for overflowing unsigned values 2025-05-26 15:28:14 +01:00
Emil J
4b8d42d22c
Merge pull request #5095 from YosysHQ/emil/one-bit-width
rtlil: enable single-bit vector wires
2025-05-23 15:55:45 +02:00
Gary Wong
9770ece187 Accept (and ignore) SystemVerilog unique/priority if.
Add support to the "read_verilog -sv" parser to validate the
"unique", "unique0", and "priority" keywords in contexts where
they're legal according to 1800-2012 12.4.2.

This affects only the grammar accepted; the behaviour of conditionals
is not changed.  (But accepting this syntax will provide scope for
possible optimisations as future work.)

Three test cases ("unique_if", "unique_if_else", and
"unique_if_else_begin") verify that the keywords are accepted where
legal and rejected where illegal, as described in the final paragraph
of 12.4.2.
2025-05-22 19:28:28 -06:00
George Rennie
6331f92d00
Merge pull request #5101 from georgerennie/george/opt_expr_shift_ovfl
opt_expr: fix shift optimization with overflowing shift amount
2025-05-22 15:16:19 +01:00
George Rennie
98eec36921 kernel: add comments to as_int family of methods 2025-05-22 15:12:13 +01:00
mikesinouye
761dc6f62a
Allow reading of gzipped files when not in NDEBUG 2025-05-21 15:18:29 -07:00
William D. Jones
7d4d544001 Strip trailing slashes when checking for directories on Windows. 2025-05-15 18:36:43 -04:00
KrystalDelusion
4c72b0ecd8
Merge pull request #5116 from YosysHQ/krys/update_fst
Update fstlib
2025-05-16 09:22:52 +12:00
KrystalDelusion
3a5ce2df64
Merge pull request #5112 from YosysHQ/krys/on_shutdown
design.cc: Use on_shutdown method
2025-05-16 09:22:39 +12:00
George Rennie
748600c167
small whitespace cleanup (#5119) 2025-05-14 15:18:57 +02:00
Emil J. Tywoniak
5e72464a15 rtlil: enable single-bit vector wires 2025-05-12 13:23:29 +02:00
Krystine Sherwin
afd5bbc7fa
fstdata.cc: Fix last step
Includes test file for sanity checking simulation steps.
2025-05-12 13:18:19 +12:00
Krystine Sherwin
d0b9a0cb98
sim.cc: Move cycle check
Calling `throw dst_end_of_data_exception()` when the desired number of cycles has been reached means that the fst reader can't tidy up after itself and leads to memory leaks.
This doesn't happen when the `-stop` flag is used because the `Yosys::FstData` struct tracks the end time and skips the outer callback if the simulation has gone past the desired end time.
Move cycle checking into the inner callback along with the time checking means that the outer callback no longer needs to throw an exception in order to stop checking further values, while still allowing the fst reader to finish reading and deallocate memory.
2025-05-12 12:48:01 +12:00
Krystine Sherwin
af75dce660
Fix Crashes with GCC 15 #5088
When building `WITH_PYTHON`, where a global list of modules is maintained, deleting a module also erases the entry in said global list.  This can lead to memory corruption if the global list is destructed before the module.
Using `on_shutdown()` instead means the module destructor is explicitly called before the global list can be destructed, preventing the issue.
Also add a comment to `Pass::~Pass()` to suggest the same for future passes that might try to use that (and see this commit in the blame if they need a reason why).
2025-05-10 09:59:13 +12:00
Emil J. Tywoniak
2e9a194ce9 gzip: reject uncompressing directories 2025-05-09 22:33:30 +02:00
Emil J. Tywoniak
b05c0c70af io: don't accept a directory when file expected 2025-05-09 22:33:30 +02:00