3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-24 01:25:33 +00:00
Commit graph

1666 commits

Author SHA1 Message Date
Krystine Sherwin
49eec407c2
consteval: Fix $bwmux handling
If the cell type has a S signal and hasn't already been handled, use `CellTypes::eval(cell, A, B, S)`.
2025-04-15 17:19:31 +12:00
Krystine Sherwin
2d069c8a5e
test_cell: Support more cell types
Still unsupported:
- wide muxes (`$_MUX16_` and friends)

Partially supported types have comments in `test_cell.cc`.

Fix `CellTypes::eval() for `$_NMUX_`.
Fix `RTLIL::Cell::fixup_parameters()` for $concat, $bwmux and $bweqx.
2025-04-15 16:38:12 +12:00
Martin Povišer
38beae1e06
Merge pull request #4946 from povik/cost-cc-enhance
cost: Add `$mem_v2`, `$macc_v2` estimates
2025-04-14 11:08:59 +02:00
Krystine Sherwin
ca57df8927
cutpoint: Add $scopeinfo cell
Also adds "blackbox" as a valid TYPE.
2025-04-11 04:12:34 +12:00
Krystine Sherwin
f042c36898
rtlil.h: Extra comment on helper enums
i.e. making explicit the ones that aren't intended for direct use.
2025-04-08 11:59:42 +12:00
Krystine Sherwin
1ef9908a85
rtlil.cc: Fix box checks in selected_modules 2025-04-08 11:59:36 +12:00
Krystine Sherwin
7d7ee5d9bf
rtlil.h: Fix selection ctor ordering 2025-04-08 11:59:32 +12:00
Krystine Sherwin
cd3b914132
Reinstate #4768
Revert the reversion so that we can fix the bugs that the PR missed.
2025-04-08 11:58:05 +12:00
Miodrag Milanović
d49364d96f
Revert "Refactor full_selection" 2025-04-07 12:11:55 +02:00
KrystalDelusion
98d4355b82
Merge pull request #4768 from YosysHQ/krys/refactor_selections
Refactor full_selection
2025-04-05 14:15:27 +13:00
Krystine Sherwin
d8a9ad6860
Add Selection::clear() method
Use method in `select.cc` to reduce code duplication.
2025-04-05 10:56:01 +13:00
Krystine Sherwin
dab67f84da
rtlil.h: Document selections 2025-04-05 10:46:09 +13:00
Jannis Harder
119e998f12 read_liberty: Faster input handling for the liberty lexer
The lexer for liberty files was using istream's `get` and `unget` which
are notorious for bad performance and that showed up during profiling.

This replaces the direct `istream` use with a custom LibertyInputStream
that does its own buffering to provide `get` and `unget` that behave the
same way but are implemented with a fast path that is easy to inline and
optimize.
2025-04-01 14:12:12 +02: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
Martin Povišer
251285be4c cost: Add $mem_v2, $macc_v2 estimates 2025-03-18 13:51:09 +01:00
Martin Povišer
91cd382f8b macc: Rename 'ports' to 'terms' throughout codebase 2025-03-18 13:25:10 +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
Krystine Sherwin
68adac691d
rtlil.cc: Add comment to log_assert
Because the use of `RTLIL::AttrObject::get_blackbox_attribute()` is deprecated, but the assert is needed in case users are doing weird things.
2025-03-14 14:40:06 +13:00
Krystine Sherwin
a3968d43f0
Drop deprecation on Design::selected_modules()
Instead, change the default `Design::selected_modules()` to match the behaviour (i.e. `selected_unboxed_modules_warn()`) because it's a lot of files to touch and they don't really _need_ to be updated.
Also change `Design::selected_whole_modules()` users over to `Design::selected_unboxed_whole_modules()`, except `attrmap` because I'm not convinced it should be ignoring boxes.  So instead, leave the deprecation warning for that one use and come back to the pass another time.
2025-03-14 14:08:56 +13:00
Krystine Sherwin
add5eba9b2
Design::selection_stack should never be empty
Add a `log_assert` for it in `Design::check()`.
Remove unneeded checks in other places.
2025-03-14 14:08:16 +13:00
Krystine Sherwin
824f7146aa
Selecting a blackbox sets selects_boxes 2025-03-14 14:08:15 +13:00
Krystine Sherwin
a30bacfcb1
Add Selection::complete_selection
Used to select all modules including boxes, set when both `full` and `boxes` are true in the constructor, pulling down `full_selection`.
Add `Selection::selects_all()` method as short hand for `full_selection || complete_selection`.
Update selection operations to account for complete selections.
Add static methods to `Selection` for creating a new empty/full/complete selection to make it clearer to users when doing so.
Use said static methods to replace most instances of the `Selection` constructor.
Update `Selection::optimize` to use
2025-03-14 14:08:15 +13:00
Krystine Sherwin
d09ae42951
Fixing selections 2025-03-14 14:08:14 +13:00
Krystine Sherwin
091e9488fe
rtlil: Design::top_module() can be const
Since it doesn't change anything and is just a lookup.
2025-03-14 14:08:14 +13:00
Krystine Sherwin
dac2bb7d4d
Use selection helpers
Catch more uses of selection constructor without assigning a design.
2025-03-14 14:08:13 +13:00
Krystine Sherwin
a67b57bd64
rtlil: Add selection helpers
New methods on Design to push/pop selection instead of accessing the selection stack directly. Includes methods for pushing a full/complete/empty selection.
Also helper methods on modules to check `is_selected` and `is_selected_whole`.
2025-03-14 14:05:40 +13:00
Krystine Sherwin
3b1b09baf6
Can clean boxed modules
If a selection contains a boxed module, but does not select boxes, it should be removed from the selection.
2025-03-14 14:05:40 +13:00
Krystine Sherwin
2f907e8be4
Unify Design::selected_modules variants
Now uses two enums, one to control whether or not to include partially selected
modules (and what to do if they are encountered), and one to control whether or
not to include boxed modules (and what to do if they are encountered).

Mark Design::selected{modules, whole_modules}() deprecated and make them
provide warnings on boxes. There are a lot of places that use them and I can't
always tell which ones support boxed modules and which don't.
2025-03-14 14:05:40 +13:00
Krystine Sherwin
398afd102e
Refactor full_selection
The `Design::selected_*()` methods no longer unconditionally skip boxed modules.  Instead, selections are now box and design aware.
The selection constructor now optionally takes a design pointer, and has a new `selects_boxes` flag.  If the selection has an assigned design, then `Selection::selected_*()` will only return true for boxed modules if the selects_boxes flag is set.  A warning is raised if a selection is checked and no design is set.  Selections can change design via the `Selection::optimize()` method.
Most places that iterate over `Design::modules()` and check `Selection::selected_module()` should instead use `Design::selected_modules()`.
Since boxed modules should only ever be selected explicitly, and `full_selection` (now) refers to all non-boxed modules, `Selection::optimize()` will clear the `full_selection` flag if the `selects_boxes` flag is enabled, and instead explicitly selects all modules (including boxed modules).  This also means that `full_selection` will only get automatically applied to a design without any boxed modules.

These changes necessitated a number of changes to `select.cc` in order to support this functionality when operating on selections, in particular when combining selections (e.g. by union or difference).
To minimize redundancy, a number of places that previously iterated over `design->modules()` now push the current selection to the design, use `design->selected_modules()`, and then pop the selection when done.

Introduce `RTLIL::NamedObject`, to allow for iterating over all members of a module with a single iterator instead of needing to iterate over wires, cells, memories, and processes separately.
Also implement `Module::selected_{memories, processes, members}()` to match wires and cells methods.  The `selected_members()` method combines each of the other `selected_*()` methods into a single list.
2025-03-14 14:05:39 +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
Martin Povišer
5882055899 macc_v2: Add C port 2025-01-24 12:38:03 +01:00
Martin Povišer
c5fd96ebb0 macc_v2: Start new cell 2025-01-24 12:38:03 +01:00
Martin Povišer
08394c51a2 rtlil: Add const append helper 2025-01-24 12:38:03 +01:00