Commit Graph

2613 Commits

Author SHA1 Message Date
rhanqtl 11b829ba70 fix(parse): #5234 adjust width of rhs according to lhs 2025-09-16 15:24:23 +02:00
Robert O'Callahan 29810f1e7c Make Const::is_*() functions work on packed bits without decaying to vector<State> 2025-09-16 03:17:24 +00:00
Robert O'Callahan caaf9a4400 Const::decode_string() doesn't need to call bitvectorize 2025-09-16 03:17:24 +00:00
Robert O'Callahan cb1186aac5 Make Const::as_string work without reducing packed bits to vector<State> 2025-09-16 03:17:24 +00:00
Robert O'Callahan 67a274ed1f Optimize Const::hash_into to hash packed bits efficiently 2025-09-16 03:17:24 +00:00
Robert O'Callahan 9ad83cc67b Fast path for Const::operator== 2025-09-16 03:17:24 +00:00
Robert O'Callahan b597ad777e Make Const::as_bool and Const::as_int work with packed bits without decaying to vector<State> 2025-09-16 03:17:24 +00:00
Robert O'Callahan b06085ab6c Make Const::Const(long long) constructor use packed bits internally if possible 2025-09-16 03:17:24 +00:00
Robert O'Callahan 9493292690 Update tests to avoid bits() 2025-09-16 03:17:23 +00:00
Robert O'Callahan 662a3df987 Update Const API with alternatives to direct use of bits()
In particular, `Const::resize()`, `Const::set()`, and `Const::iterator`.
2025-09-16 03:17:22 +00:00
Robert O'Callahan 03127173c6 Fix const_iterator postincrement behavior 2025-09-16 03:17:22 +00:00
Akash Levy 1f9013aad0
Merge branch 'YosysHQ:main' into main 2025-09-15 08:04:00 -07:00
Emil J. Tywoniak bc24947a84 tests: replace CC and gcc with CXX and g++ 2025-09-11 16:50:23 +02:00
Akash Levy e25492e87a Smallfixes 2025-09-11 04:50:58 -07:00
Akash Levy b1f4d0d8aa Small adjustments 2025-09-11 04:47:28 -07:00
Akash Levy 8f5b20c423
Apply suggestions from code review
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2025-09-11 04:46:32 -07:00
Akash Levy 54a1862fbe
Apply suggestions from code review
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2025-09-11 04:32:18 -07:00
Akash Levy c1557950ef Support external fanout for addsub_c 2025-09-11 03:48:14 -07:00
Akash Levy ccf3909982 Initial implementation of addsub_c with no intermediate fanout allowed 2025-09-11 03:28:50 -07:00
Akash Levy a43de44f9d Merge upstream changes 2025-09-10 23:02:15 -07:00
Emil J 5278b9cfe1
Merge pull request #5332 from YosysHQ/parse_specify-rebased
Add state_dependent_path_declaration so that `ifnone` can be parsed (rebased)
2025-09-09 21:53:04 +02:00
Akash Levy 41dfe4fc61 Run toposort in both directions for better results 2025-09-09 07:45:25 -07:00
Akash Levy 1b3375d8df Merge upstream in 2025-09-09 05:50:48 -07:00
Akash Levy bb6823fdd8 Smallfix to test that was affected by wreduce 2025-09-09 05:34:09 -07:00
Akash Levy eb4539f151 Smallfixes 2025-09-09 04:50:57 -07:00
Akash Levy b7a4ce8b42 Fix opt balance tree and wreduce 2025-09-09 04:32:15 -07:00
Michael Kupfer 75316e8c49 Add state_dependent_path_declaration so that `ifnone` can be parsed 2025-09-09 13:04:52 +02:00
Jannis Harder 985b9164da Disable flaky arch/anlogic/mux test 2025-09-09 10:04:08 +12:00
Jannis Harder c468ee7add
Merge pull request #5304 from rocallahan/idstring-stringf
Support `IdString` parameters in `stringf()` and remove `.c_str()` in a lot of places
2025-09-08 20:29:20 +02:00
George Rennie 8fb3f88842 tests: remove -seq 1 from sat with -tempinduct where possible
* When used with -tempinduct mode, -seq <N> causes assertions to be
  ignored in the first N steps. While this has uses for reset modelling,
  for these test cases it is unnecessary and could lead to failures
  slipping through uncaught
2025-09-08 18:04:32 +02:00
Akash Levy 8204fd1d0b Update Yosys to latest 2025-09-06 16:49:39 -07:00
Emil J. Tywoniak 62120bda06 verilog: test cases that look like SVA labels #862 2025-09-05 12:34:38 +02:00
Krystine Sherwin bc77b6213b autoname: Fix selection arg 2025-09-05 00:15:26 +02:00
Krystine Sherwin f45255f5a2 tests: More autoname tests 2025-09-05 00:15:26 +02:00
Robert O'Callahan c41ba912d8 Support IdString parameters in stringf 2025-09-01 23:34:42 +00:00
Emil J 5aa71505fc
Merge pull request #5287 from Anhijkt/opt_dff-fix-5279
opt_dff: fix timeout issue
2025-09-01 11:20:35 +02:00
Akash Levy dc52f6ca1c
Merge branch 'YosysHQ:main' into main 2025-08-27 11:10:13 -07:00
Emil J. Tywoniak 8333a83cef opt_dff: more explicit testing, typo 2025-08-27 11:29:57 +02:00
Emil J a67a3ca49c
Merge pull request #4497 from YosysHQ/emil/bitpattern-comments
bitpattern: comments
2025-08-25 15:25:37 +02:00
Akash Levy e54fa487b8 Merge from upstream 2025-08-21 17:56:55 -07:00
Emil J. Tywoniak 01de9fb453 hashlib: extend unit test with subset collisions, shorten runtime 2025-08-20 00:08:23 +02:00
Robert O'Callahan 3a5742ffd2 Improve commutative hashing.
The simple XOR `commutative_eat()` implementation produces a lot of collisions.
https://www.preprints.org/manuscript/201710.0192/v1/download is a useful reference on this topic.

Running the included `hashTest.cc` without the hashlib changes, I get 49,580,349 collisions.
The 49,995,000 (i,j) pairs (0 <= i < 10000, i < j < 10000) hash into only 414,651 unique hash values.
We get simple collisions like (0,1) colliding with (2,3).

With the hashlib changes, we get only 707,099 collisions and 49,287,901 unique hash values.
Much better! The `commutative_hash` implementation corresponds to `Sum(4)` in the paper
mentioned above.
2025-08-19 21:45:52 +00:00
Anhijkt e1276560cd opt_dff: add another test 2025-08-19 23:48:45 +03:00
Emil J b0d709f6cf
Merge pull request #5294 from rocallahan/precision-tests
Add tests for dynamic precision and with with an int parameter
2025-08-19 16:42:49 +02:00
Emil J. Tywoniak 7ee62c832b bitpattern: unit test 2025-08-18 19:57:45 +02:00
Jannis Harder 7c409e2d5a
Merge pull request #5285 from jix/abstract_initstates
abstract: Add -initstates option
2025-08-18 15:39:09 +02:00
KrystalDelusion 6d55ca204b
Merge pull request #5281 from suisseWalter/add_parameterised_cells_stat
STAT: Add parameterised cells
2025-08-18 09:21:45 +12:00
clemens 9278bed853 removed copyright notice on lib file.
Should be covered by the yosys license not  anything else.
2025-08-16 09:40:03 +02:00
clemens 73d1177665 testcases
one testcase for single parameter cells.
one testcase for double parameter cells.
2025-08-16 09:40:03 +02:00
clemens d8fb4da437 updated testcase 2025-08-16 09:32:08 +02:00
Robert O'Callahan e906ea3f1b Add tests for dynamic precision and with with an int parameter 2025-08-15 23:58:58 +00:00
Krystine Sherwin ec18d1aede
rename.cc: Fixup ports after -unescape 2025-08-15 10:48:32 +12:00
Akash Levy 3cd1cc157a Bump Yosys to latest 2025-08-14 10:54:48 -07:00
Emil J 195d3ef940
Merge pull request #5100 from jix/rename_move_to_cell
rename: add -move-to-cell option in -wire mode
2025-08-14 16:45:33 +02:00
Anhijkt e486994f60 opt_dff: add test 2025-08-14 00:13:23 +03:00
Akash Levy 56caf7cd84 Bump Yosys to latest 2025-08-13 13:37:37 -07:00
clemens 71307b4a51 add Testcases
Fix existing testcases
Fix edgecase where modules where counted as cells.
2025-08-13 14:46:01 +02:00
Jannis Harder 77089a8d03 rename: add -move-to-cell option in -wire mode 2025-08-13 11:11:52 +02:00
Jannis Harder 1f876f3a22 abstract: Add -initstates option 2025-08-12 15:37:12 +02:00
Emil J. Tywoniak 6042ae0e8a simplify: add smoke test for system function calls 2025-08-12 12:59:31 +02:00
Akash Levy d0ab898e88
Merge branch 'YosysHQ:main' into main 2025-08-10 22:46:15 -07:00
KrystalDelusion 1ae82d7b9d
Merge pull request #5233 from YosysHQ/krys/equiv_assume
Assumptions for equiv_*
2025-08-09 10:39:04 +12:00
Akash Levy 613dfcc6b4
Merge branch 'YosysHQ:main' into main 2025-08-08 10:37:08 -07:00
Emil J d68d28d05e
Merge pull request #5183 from YosysHQ/emil/test-diagnostics
logger: add -expect types prefix-log, prefix-warning, prefix-error
2025-08-08 14:46:25 +02:00
Akash Levy 77be4d7be7 Bump Yosys to latest 2025-08-07 17:22:25 -07:00
KrystalDelusion 7f0e864d44
Merge pull request #5265 from bhagwat-rahul/fix-package-import
Support package import
2025-08-08 09:32:54 +12:00
Emil J 1e58443397
Merge pull request #5264 from YosysHQ/krys/raise_error_always
raise_error: Add -always
2025-08-07 11:43:04 +02:00
Rahul Bhagwat 5cc1365b32
add newline - whitespace 2025-08-06 19:00:11 -04:00
Rahul Bhagwat d3c8e6c14c
use more standard naming conventions 2025-08-06 15:39:30 -04:00
Rahul Bhagwat 7e0157ba2b
fix whitespace issues 2025-08-06 15:32:36 -04:00
Emil J 8576d2d147
Merge pull request #5263 from rocallahan/stringf-width
Making `stringf()` use the format conversion specs as-is without widening them
2025-08-06 11:36:28 +02:00
Krystine Sherwin af7d1d3f4f
cutpoint_blackbox.ys: Extra edge case 2025-08-06 18:11:35 +12:00
Krystine Sherwin 1bf9530fcc
cutpoint_blackbox.ys: Add verific-style unknown module 2025-08-06 16:51:14 +12:00
Krystine Sherwin f9e8127e2b
tests: Add equiv_induct to equiv_assume.ys 2025-08-06 15:13:04 +12:00
Akash Levy 347d7b6524
Merge branch 'YosysHQ:main' into main 2025-08-04 15:28:01 -07:00
Lofty 7537a49f0d
Merge pull request #5241 from Anhijkt/opt_dff-simplify-pt
opt_dff: implement simplify_patterns
2025-08-04 09:44:57 +01:00
Rahul Bhagwat 761015b23e
add separate module test 2025-08-03 23:48:33 -04:00
Krystine Sherwin f78cd9d13f
raise_error: Extra test 2025-08-02 14:54:32 +12:00
Krystine Sherwin 895dfd963f
raise_error: Add -always 2025-08-02 14:53:36 +12:00
Robert O'Callahan ffd52a0d8e Making `stringf()` use the format conversion specs as-is without widening them.
And make sure our fast-path for `%d` and `%u` narrows to `int` correctly.

Resolves #5260
2025-07-31 10:54:56 +00:00
Akash Levy cc733fd11b Merge from upstream 2025-07-30 22:50:14 -07:00
KrystalDelusion a18acaca82
Merge pull request #5068 from YosysHQ/krys/bugpoint_fixes
Updates to bugpoint
2025-07-30 10:05:22 +12:00
Krystine Sherwin fe07d390f1
tests/bugpoint: More tests
More coverage.
2025-07-29 11:39:52 +12:00
Krystine Sherwin 93f7429f4f
tests: Add bugpoint to MK_TEST_DIRS
Also change `-err_grep` to `-err-grep` for consistency with `-expect-return`.
2025-07-29 11:39:51 +12:00
Krystine Sherwin b5a13ae95b
bugpoint.cc: Rename to -err_grep 2025-07-29 11:39:51 +12:00
Krystine Sherwin fb92eabdcd
bugpoint: Add -greperr option
`-greperr <string>` redirects stderr to 'bugpoint-case.err', and then searches that file for `<string>`.
Move `-runner` option up with the other options to reduce ambiguity (i.e. so it doesn't look like it's another design parts constraint).
Also some shuffling of `err.ys`.
2025-07-29 11:39:51 +12:00
Krystine Sherwin 8d5dbae06e
raise_error.cc: Option for direct to stderr
Add more to help text to describe usage.
Add test for no value (should `exit(1)`).
2025-07-29 11:39:50 +12:00
Krystine Sherwin 134da811f7
Add raise_error pass
Raise errors from attributes for testing.
I want it for bugpoint tests but it could be useful elsewhere.
2025-07-29 11:39:50 +12:00
Akash Levy 721214c55b
Merge branch 'YosysHQ:main' into main 2025-07-27 03:39:36 -07:00
Robert O'Callahan 8b75c06141 Add a general tests/.gitignore and remove redundant entries in subdirectory .gitignore files. 2025-07-22 10:38:38 +00:00
Akash Levy d5f34b5c61 Remove chformal test from verific since it requires initial value preservation 2025-07-21 18:07:49 -07:00
Akash Levy d9fb46b5ac Use a better method of fixing up Verific run-test.mk 2025-07-21 17:08:38 -07:00
Anhijkt ca8af1f8c8 opt_dff: implement simplify_patterns 2025-07-21 14:15:26 +03:00
KrystalDelusion 5b8b5292ee
Merge pull request #4959 from YosysHQ/krys/primitive_array_error
simplify: Skip AST_PRIMITIVE in AST_CELLARRAY
2025-07-21 10:26:00 +12:00
Akash Levy 3cfbc0d7af
Merge branch 'YosysHQ:main' into main 2025-07-18 09:38:39 -07:00
Martin Povišer 9ab1946799
Merge pull request #5209 from povik/hieropt
Start `opt_hier` to enable hierarchical optimization
2025-07-17 14:12:18 +02:00
N. Engelhardt d009bcc9b6
Merge pull request #5198 from YosysHQ/nak/lcov 2025-07-17 11:57:58 +02:00
Akash Levy 37806d5ea7
Merge branch 'YosysHQ:main' into main 2025-07-16 14:59:29 -07:00
N. Engelhardt fb6974dcd7 print summary of line coverage to log 2025-07-16 13:40:07 +02:00
Krystine Sherwin 5ec189a2f5
Tests: Extra equiv_assume tests 2025-07-16 21:06:04 +12:00
Krystine Sherwin d30f934d0d
equiv_simple: Add -set-assumes option
Based on existing code for input cone and the `sat` handling of `-set-assumes`.
Update `equiv_assume.ys` to use `-set-assumes` option.
2025-07-16 21:04:41 +12:00
Krystine Sherwin a57c593c41
tests: Add equiv_assume.ys 2025-07-16 15:32:47 +12:00
Emil J. Tywoniak c7a3abbcc4 libparse: LibertyExpression unit test 2025-07-15 12:53:30 +02:00
Emil J. Tywoniak e960428587 unit tests: fix run failure detection 2025-07-15 12:21:01 +02:00
Akash Levy 082adf8684
Merge branch 'YosysHQ:main' into main 2025-07-15 00:04:28 -04:00
Emil J. Tywoniak 6ee01308f2 dfflibmap: show dffe inference is broken by space ANDs 2025-07-11 00:33:01 +02:00
Emil J 14aad097f0
Merge pull request #5190 from YosysHQ/emil/dfflibmap-fix-negated-next_state
dfflibmap: propagate negated next_state to output correctly
2025-07-10 19:50:02 +02:00
Emil J. Tywoniak 7fe817c52f dfflibmap: test negated state next_state with mixed polarities 2025-07-10 18:54:43 +02:00
N. Engelhardt 02323295b0
Merge pull request #5179 from YosysHQ/krys/assert2cover 2025-07-10 14:53:22 +02:00
Emil J 66035f706e
Merge pull request #5177 from YosysHQ/emil/rename-unescape
rename: add -unescape
2025-07-08 10:45:11 +02:00
Krystine Sherwin 108a4ed496
tests/functional: Reduce CI to 100 steps
Takes approx half the time, at least when testing locally.
2025-07-07 10:45:51 +12:00
Krystine Sherwin 3c54d8aef7
tests/functional: Auto parallelize
Use the unique cell name (cell type + parameters) for the vcd filename to avoid collisions when converting to fst.
2025-07-07 10:38:32 +12:00
Martin Povišer 22a44e4333 Start `opt_hier` 2025-07-05 16:45:52 +02:00
Gary Wong 5feb1a1752 verilog: add support for SystemVerilog string literals.
Differences are new escape sequences (including escaped newline
continuations and hex escapes) and triple-quoted literals.
2025-07-03 20:51:12 -06:00
Akash Levy 3d4bf57745 Merge from upstream 2025-07-02 11:25:18 -07:00
N. Engelhardt 8a4f465143 update test to use suggested selection for assertions 2025-07-01 11:46:27 +02:00
Krystine Sherwin 017524d7a2
tests/verific: Don't ASAN verific 2025-06-28 11:33:18 +12:00
Gus Smith a1d68fe3bc Add option for using assoc list helpers in tests 2025-06-26 17:44:12 -07:00
N. Engelhardt ef3f541501 add linecoverage command to generate lcov report from selection 2025-06-26 13:21:53 +02:00
Emil J. Tywoniak 2b659626a3 rename: add -unescape 2025-06-24 12:33:33 +02:00
Emil J. Tywoniak 73cbcffbbb fixup! dfflibmap: propagate negated next_state to output correctly 2025-06-24 12:31:30 +02:00
Emil J. Tywoniak 778079b058 dfflibmap: propagate negated next_state to output correctly 2025-06-24 12:01:12 +02:00
Gus Smith 8a9d724873 Finish up functions and tests, TODO: CLI 2025-06-23 19:20:06 -07:00
Akash Levy 7e9e4c7afe
Merge branch 'YosysHQ:main' into main 2025-06-23 02:30:24 -07:00
George Rennie 170933ecb0
Merge pull request #5165 from georgerennie/george/opt_dff_uaf
opt_dff: don't remove cells until all have been visited to prevent UAF
2025-06-20 23:33:26 +01:00
garytwong 834a7294b7
verilog: fix string literal regular expression (#5187)
* verilog: fix string literal regular expression.

A backslash was improperly quoted, causing string literal matching
to fail when the final token before a closing quote was an escaped
backslash.

* verilog: add regression test for string literal regex bug.

Test for bug triggered by escaped backslash immediately before
closing quote (introduced in ca7d94af and fixed by 40aa7eaf).
2025-06-19 12:41:18 -04:00
Emil J. Tywoniak 4276756f32 fixup! const2ast: add diagnostics tests 2025-06-16 22:50:31 +02:00
Emil J. Tywoniak 49cd3887a7 const2ast: add diagnostics tests 2025-06-16 21:48:12 +02:00
Krystine Sherwin fa68299b25
tests/verific: Add chformal tests 2025-06-14 11:06:38 +12:00
Krystine Sherwin 45131f4425
chformal: Add -assert2cover option
Also add to chformal tests.
2025-06-14 10:54:23 +12:00
Akash Levy 283faf3bf9 Merge from upstream 2025-06-13 10:19:49 -07:00
KrystalDelusion 82888580ac
Merge pull request #5152 from garytwong/unique-if
verilog: implement SystemVerilog unique/unique0/priority if semantics.
2025-06-13 09:56:53 +12:00
Emil J c0f52c6ead
Merge pull request #5167 from YosysHQ/emil/fix-splitnets-single-bit-vector
splitnets: handle single-bit vectors consistently
2025-06-11 22:47:48 +02:00
George Rennie 7160c91800 tests: add test for #5164 opt_dff -sat UAF 2025-06-06 23:46:23 +01:00
Emil J. Tywoniak 239c265093 splitnets: handle single-bit vectors consistently 2025-06-05 10:58:06 +02:00
Akash Levy 6530a3d150
Merge branch 'YosysHQ:main' into main 2025-06-04 11:10:27 -07:00
George Rennie 0fcf5c080d
Merge pull request #5158 from georgerennie/george/task_inout
read_verilog/astsimplify: copy inout ports in and out of functions/tasks
2025-06-04 14:23:08 +01:00
George Rennie ab40403d90
Merge pull request #5154 from georgerennie/george/post_incdec_undo_fix
read_verilog: fix -1 constant used to correct post increment/decrement
2025-06-04 14:22:32 +01:00
Akash Levy e3a6b920d4
Merge branch 'YosysHQ:main' into main 2025-06-02 18:47:14 +02:00
Emil J c21cd300a0
Merge pull request #5109 from YosysHQ/emil/aiger-map-fix-outputs
aiger: fix -map and -vmap
2025-06-02 15:07:19 +02:00
George Rennie 97f51bb4b7 tests: add tests for task/function argument input/output copying 2025-05-31 01:21:06 +01:00
KrystalDelusion 545753cc5a
Merge pull request #5143 from YosysHQ/krys/typedef_struct_global
SystemVerilog: Fix typedef struct in global space
2025-05-31 09:59:26 +12:00
George Rennie 3790be114f tests: add tests for verilog pre/post increment/decrement in expressions 2025-05-30 14:38:25 +01:00
Akash Levy c172eea61f
Merge branch 'YosysHQ:main' into main 2025-05-30 05:00:06 +02:00
Gary Wong 7b09dc31af tests: add cases covering full_case and parallel_case semantics
This is @KrystalDelusion's suggestion in PR #5141 to verify
sensible implementation of all 4 possible full_case/parallel_case
combinations.

(Also including two similar tests to check the Verilog frontend
applies the correct attributes when given SystemVerilog
priority/unique case and if statements.)
2025-05-29 20:45:57 -06: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
Akash Levy 3fc74be3e2
Merge branch 'YosysHQ:main' into main 2025-05-28 01:54:49 +02:00
Gus Smith 51560b0bf6 Start adding Rosette simulation facilties 2025-05-26 21:47:59 -07:00
Gus Smith 9faa61dfc6 Remove gate on smt and rkt tests
as per
https://github.com/YosysHQ/yosys/pull/5128#issuecomment-2896280647
2025-05-26 20:43:32 -07: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 353fd0f7f4 tests: test opt_expr for 32 bit unsigned shifts 2025-05-26 15:28:44 +01:00
Krystine Sherwin 995a893afd
Tests: Add svtypes/typedef_struct_global.ys 2025-05-26 12:16:58 +12:00
Akash Levy 3a23e772dd
Merge branch 'YosysHQ:main' into main 2025-05-24 12:11:52 -07:00
Gary Wong 73e45d29d6 Add semantic test cases for SystemVerilog priority/unique/unique0 "if".
The tests/verilog/*_if_enc.ys scripts instantiate simple encoder
modules, both with and without the SystemVerilog priority/unique/unique0
keywords, and check for consistency between the two for the subset
of inputs where the priority/unique/unique0 "if" result is
well-defined.

These tests vacuously succeed at the moment, since priority/unique
keywords are silently ignored and therefore the generated logic is
trivially identical.  But the test cases will be capable of detecting
certain types of unsound optimisation if priority/unique handling is
introduced later.
2025-05-24 08:44:04 -06:00
Emil J 18abf2d4f7
Merge pull request #5138 from YosysHQ/emil/libcache-verbose
libcache: add -quiet and -verbose
2025-05-24 00:05:46 +02: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
Akash Levy d520cb42cc
Merge branch 'YosysHQ:main' into main 2025-05-22 10:30:58 -07: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
Akash Levy 3f94486a1c
Merge pull request #82 from donn/splitlarge
splitlarge: new pass to split wide arithmetic operators
2025-05-15 15:00:45 -07:00
Akash Levy 1f00bf0057 Bump yosys to latest 2025-05-15 14:44:26 -07:00
KrystalDelusion 4c72b0ecd8
Merge pull request #5116 from YosysHQ/krys/update_fst
Update fstlib
2025-05-16 09:22:52 +12:00
KrystalDelusion f7888c607b
Merge pull request #5089 from YosysHQ/krys/cutpoint_whole
cutpoint: Re-add whole module optimization
2025-05-16 09:22:28 +12:00
Mohamed Gaber 1d9fbb6143 misc: review feedback, remove MUL vestiges 2025-05-15 18:01:13 +03:00
Mohamed Gaber 46ba89059a splitlarge: new pass to split wide arithmetic operators
Adds a new pass, `splitlarge`, that recursively divides $add/$sub
cells into smaller cells until each cell's width doesn't exceed a
given max_width (128 by default.) An $add/$sub cell's width for
this purpose is defined as the higher of the widths of its two
inputs.

A test was written in Tcl for it, which tests this matrix:
- cell: $add/$sub
- b: unsigned, signed
- a: unsigned, signed

This is the first test for a Silimate pass in Tcl and thus
`run-test.sh` was modified to include it.
2025-05-15 17:45:08 +03:00
Emil J 3823157c25
Merge pull request #5080 from akashlevy/muldiv_c
Add `muldiv_c` peepopt
2025-05-15 11:03:25 +02:00
Akash Levy ccc2ba41f2
Merge branch 'YosysHQ:main' into main 2025-05-12 15:02:55 -07:00
Emil J. Tywoniak e5171d6aa1 verific: support single_bit_vector 2025-05-12 13:23:29 +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
williamzhu17 fc86bd8e74 finalized tests 2025-05-11 11:16:50 -07:00
williamzhu17 39be4f29bd opt_balance_tree test cases 2025-05-11 10:58:29 -07:00
williamzhu17 51a951d614 wip tests 2025-05-11 10:17:08 -07:00
williamzhu17 e0714ca714 Merge branch 'main' into opt_balance_tree-tests 2025-05-11 09:07:17 -07:00
Adrien Prost-Boucle 6bf7587338 URAM mapping : Add test for 2048 x 144b 2025-05-10 14:53:56 +02:00
Emil Jiří Tywoniak cbf069849e aiger: add regression test for sliced output segfault 2025-05-09 16:01:47 +02:00
Emil J. Tywoniak 9d2f9f7557 libcache: fix test 2025-05-09 12:40:38 +02:00
Akash Levy b88cff68d7
Merge pull request #79 from williamzhu17/new-muxorder-tests
Added new muxorder tests
2025-05-08 17:40:55 -07:00
williamzhu17 b265ea9dcf removed comma 2025-05-08 17:39:16 -07:00
williamzhu17 8d20ed0637 updated tests a bit 2025-05-08 17:38:42 -07:00
williamzhu17 d10e42c4bf added some tests 2025-05-08 17:36:35 -07:00
williamzhu17 82fa68aa2d added new muxorder tests 2025-05-08 14:05:13 -07:00
George Rennie d59380b3a0 tests: more complete testing of shift edgecases 2025-05-08 11:09:01 +02:00
George Rennie af933b4f38 tests: check shifts by amounts that overflow int 2025-05-07 15:12:33 +02:00
Akash Levy 7191be492c
Merge branch 'YosysHQ:main' into main 2025-05-05 15:36:40 -07:00
Krystine Sherwin 7c89355b70
cutpoint: Re-add whole module optimization
Also add a test script for it.
2025-05-06 09:57:34 +12:00
Krystine Sherwin 7c2b00c448
tests: Add default param test file
Just loads, fails ASAN without fix.
2025-05-05 10:18:52 +12:00
Akash Levy 4bd91fbb11 Add `muldiv_c` peepopt pass 2025-04-30 08:06:59 -07:00
Akash Levy 5e0d59ca90
Merge branch 'YosysHQ:main' into main 2025-04-28 18:12:42 -07:00
KrystalDelusion bfe05965f9
Merge pull request #5066 from YosysHQ/george/opt_expr_shr_sign
opt_expr: fix sign extension for shifts
2025-04-29 09:29:10 +12:00
Akash Levy 618cf9d372
Merge branch 'YosysHQ:main' into main 2025-04-28 13:57:29 -07:00
N. Engelhardt 84c49e1f33
Merge pull request #5041 from jix/declockgate-v2 2025-04-28 13:31:11 +00:00
Akash Levy 94bc6937d3
Merge branch 'YosysHQ:main' into main 2025-04-27 15:24:30 -07:00
George Rennie 70a44f035c tests: test opt_expr constant shift edge cases 2025-04-26 12:40:04 +02:00
KrystalDelusion 6564810ae3
Merge pull request #4992 from Anhijkt/fix-ice40dsp-unsigned
ice40_dsp: fix const handling
2025-04-26 11:15:02 +12:00
Akash Levy f67da2df2f
Merge branch 'YosysHQ:main' into main 2025-04-23 15:22:38 -07:00
Emil J. Tywoniak 9631f6ece5 liberty: fix tests 2025-04-23 20:20:43 +00:00
Mike Inouye bf8aece4e4 Add test to verify that the liberty format is properly parsed. 2025-04-23 18:40:35 +00:00
Akash Levy e9bf25f333 Undo flatten -scopeinfo to -noscopeinfo 2025-04-22 16:32:22 -07:00
Akash Levy 10ac596a51 Disable failing cutpoint_blackbox 2025-04-21 19:49:57 -07:00
Akash Levy 5f5ed1b29e Merge upstream yosys 2025-04-21 17:36:24 -07:00
Emil J 6a2f2f1818
Merge pull request #5031 from suisseWalter/fix_sequential_area
stat: fix sequential area not being included in addition/multiplication
2025-04-21 11:02:40 +02:00
cwalter 41375a5f05 create testcase to check correct addition of areas. 2025-04-20 16:44:22 +02:00
clemens 01d80c7403 add testcase 2025-04-19 20:41:10 +02:00
Jannis Harder 31d6d0ac17 formalff: Fix -declockgate test and missing emit for memories 2025-04-18 18:57:59 +02:00
Jannis Harder bd154a7188 formalff: Add -declockgate option 2025-04-18 17:44:34 +02:00
Jannis Harder 7f7ad87b7b
Merge pull request #5033 from jix/liberty-fixes
liberty: More robust parsing
2025-04-17 09:24:42 +02:00
Emil J. Tywoniak c555add231 liberty: Test non-ascii characters 2025-04-17 00:20:18 +02:00
KrystalDelusion 026d161f91
Merge pull request #4923 from KelvinChung2000/const-wrap
feat: Allow full constant wrapping for hilomap
2025-04-17 10:16:59 +12:00
Jannis Harder 4b273a4ae9 share: Cleanup and additional testing
Fixes a typo and adds another test case that triggers the fallback
behavior as the existing tests all trigger the new optimization.
2025-04-15 12:34:46 +02:00
Kelvin Chung 81f3369f24 Add check at constmap and merge test 2025-04-14 11:44:52 +01:00
Akash Levy e241c9d513
Merge branch 'YosysHQ:main' into main 2025-04-10 14:28:10 -07:00
Krystine Sherwin 87d3b09988
cutpoint.cc: Fold -instances into -blackbox
Replace `cutpoint -blackbox` behaviour with `cutpoint -blackbox -instances` behaviour.
Drop `-instances` flag.
Add `-noscopeinfo` flag.
Use `RTLIL::Selection::boxed_module()` helper to shortcut blackbox check.
Update `cutpoint_blackbox.ys` tests to match.
2025-04-11 04:12:35 +12:00
Krystine Sherwin 779a1fddf6
Testing cutpoint with boxed selections 2025-04-11 04:12:34 +12:00
Krystine Sherwin cf44a9124f
cutpoint: Test -blackbox with parameter
Modify `cutpoint_blackbox.ys` to check that parameters on blackbox modules are maintained after the cutpoint.
Also adjusts the test to check that each instance gets the `$anyseq` cell.
2025-04-11 04:12:34 +12:00
Krystine Sherwin 583771ef5b
cutpoint: Add -blackbox option
Replace the contents of all blackboxes in the design with a formal cut point.
Includes test script.
2025-04-11 04:12:34 +12:00
N. Engelhardt 3410e10ed5
Merge pull request #5000 from YosysHQ/krys/re_refactor_selections 2025-04-10 16:06:36 +00:00
Akash Levy e391707d0a Merge remote-tracking branch 'upstream/main' 2025-04-10 00:19:00 -07:00
Kelvin Chung 414dc85573 Correct and more test 2025-04-10 00:01:50 +01:00
Emil J a5e8f52ce5
Merge pull request #4976 from Logikable/main
Support array ranges for identifiers in the Liberty parser.
2025-04-09 22:49:52 +02:00
Anhijkt 41a7d4bb81 ice40_dsp: add test 2025-04-09 21:21:46 +03:00
Krystine Sherwin 078602d711
tests/arch/xilinx: Fix for warnings on boxes
The two test scripts affected use boxed modules directly; under normal usage the warning shouldn't appear.
2025-04-08 16:58:59 +12:00
Krystine Sherwin 237e454131
design.cc: Fix selections when copying
Use `Design::selected_modules()` directly, popping at the end instead of copying the selection.
Also default to a complete selection so that boxes work as before.
Simplify to using `RTLIL::SELECT_WHOLE_CMDERR` instead of doing it manually.
Also add tests for importing selections with boxes.
2025-04-08 16:35:12 +12:00
Krystine Sherwin 911a3ae759
setattr.cc: Use new selection helpers
Also test they work as expected.
2025-04-08 15:34:48 +12:00
Krystine Sherwin dbc2611dd6
test_select: Add and exercise test_select pass
Developer facing, intended to check internal selection semantics work as expected.  i.e. it would have revealed the bug in the now reverted PR.
2025-04-08 11:59:45 +12:00
Krystine Sherwin f410f98d89
clean ignores boxes 2025-04-08 11:59:40 +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
Akash Levy c0a6985adb
Merge branch 'YosysHQ:main' into main 2025-04-07 14:48:16 -07:00
KrystalDelusion e08aeae1d0
Merge pull request #4989 from YosysHQ/krys/fix_4590
opt_expr: Fix #4590
2025-04-08 08:30:18 +12:00
Akash Levy 06c614a010
Merge branch 'YosysHQ:main' into main 2025-04-07 07:28:06 -07:00
Emil J cc8fd3efc3
Merge pull request #4986 from jix/faster-liberty-caching
Liberty file caching with new `libcache` command
2025-04-07 15:15:41 +02:00
Miodrag Milanović d49364d96f
Revert "Refactor full_selection" 2025-04-07 12:11:55 +02:00
Akash Levy 0dab4308a3 Actual merge here 2025-04-06 18:53:43 -07:00
KrystalDelusion 98d4355b82
Merge pull request #4768 from YosysHQ/krys/refactor_selections
Refactor full_selection
2025-04-05 14:15:27 +13:00
Akash Levy c3657eee6d Fix Silimate tests 2025-04-04 03:21:53 -07:00
Krystine Sherwin 406b400458
opt_expr: Fix #4590
If all the (non-select) inputs of a `$_MUX{4,8,16}_` are undefined, replace it, just like we do for `$mux` and `$_MUX_`.
Add `tests/opt/opt_expr_mux_undef.ys` to verify this.

This doesn't do any const folding on the wide muxes, or shrinking to less wide muxes.  It only handles the case where all inputs are 'x and the mux can be completely removed.
2025-04-04 12:25:31 +13:00
Akash Levy 809a38a597
Merge pull request #78 from williamzhu17/extract_reduce-tests
extract_reduce tests and removed XNOR functionality from extract_reduce
2025-04-03 15:23:09 -07:00
Akash Levy 439d859bba
Merge branch 'YosysHQ:main' into main 2025-04-03 10:48:42 -07:00
williamzhu17 05a3c28f39 small name change 2025-04-03 10:38:55 -07:00
williamzhu17 ba709dc0ed added stress tests 2025-04-03 10:37:32 -07:00
Sean Luchen 307db1ec50 Add tests for #4976. 2025-04-03 10:01:34 -07:00
Sean Luchen bdcbbf2db6 Fix existing tests/liberty tests, and add them to Makefile. 2025-04-03 09:56:24 -07:00
George Rennie 63b3ce0c77
Merge pull request #4971 from Anhijkt/pow-optimization
opt_expr: optimize pow of 2 cells
2025-04-03 14:34:36 +02:00
Jannis Harder 0f13b55173 Liberty file caching with new `libcache` command
This adds optional in-memory caching of parsed liberty files to speed up
flows that repeatedly parse the same liberty files. To avoid increasing
the memory overhead by default, the caching is disabled by default. The
caching can be controlled globally or on a per path basis using the new
`libcache` command, which also allows purging cached data.
2025-04-03 13:39:35 +02:00
williamzhu17 58d903eee6 deleted old file 2025-04-01 17:19:04 -07:00
williamzhu17 776479d7aa wip tests 2025-04-01 17:17:39 -07:00
Anhijkt c57cbfa8f9 opt_expr: add test 2025-04-01 21:54:46 +03:00
williamzhu17 bc2d9d1f33 added deeper cases for gates 2025-04-01 11:10:50 -07:00
williamzhu17 2f9e6e08f0 added tests with constants 2025-04-01 10:39:33 -07:00
williamzhu17 8991707dee zero indexed wires 2025-04-01 10:19:54 -07:00
williamzhu17 101f775b64 added extra test for muxes 2025-04-01 10:18:20 -07:00
williamzhu17 8f5f4ecab4 inital extract_reduce tests 2025-04-01 10:11:17 -07:00
Akash Levy 027a4cec13
Merge branch 'YosysHQ:main' into main 2025-03-31 14:07:26 -07:00
Emil J 3a1255546a
Merge pull request #4975 from YosysHQ/emil/opt_expr-cover-with-tests
opt_expr: expand test coverage
2025-03-31 20:13:16 +02:00
Emil J. Tywoniak 6194eb939d opt_expr: expand test coverage 2025-03-31 19:31:53 +02:00
Akash Levy f488b0e74c Add lut2bmux, annotate_unqcoef, and seed tests 2025-03-31 05:55:54 -07:00
Akash Levy 161ff0fa3f Add muxmode pass and tests 2025-03-30 17:54:18 -07:00
Akash Levy 4d7581bc0b
Merge pull request #77 from williamzhu17/breaksop-tests
Added breaksop tests
2025-03-28 15:58:56 -07:00
williamzhu17 1628a22195 added extra test for multiple sops 2025-03-28 14:58:17 -07:00
Akash Levy 1a5415b5a2
Merge branch 'YosysHQ:main' into main 2025-03-28 14:56:36 -07:00
williamzhu17 a4a4544223 Merge branch 'breaksop-tests' of github.com:williamzhu17/yosys into breaksop-tests 2025-03-28 14:54:21 -07:00
williamzhu17 727c6a51be added comment about one test case 2025-03-28 14:54:00 -07:00
William Zhu ddb621d011
Merge branch 'Silimate:main' into breaksop-tests 2025-03-28 14:50:35 -07:00
williamzhu17 5987454eac added breaksop-tests 2025-03-28 14:50:02 -07:00
williamzhu17 ebb7a1b548 added reduce XNOR test cases 2025-03-28 10:52:56 -07:00
williamzhu17 baaa90993e added breakreduce tests 2025-03-28 10:43:10 -07:00
Emil J 1b25e1cee0
Merge pull request #4942 from Anhijkt/fix-ice40dsp
ice40_dsp: fix log_assert issue
2025-03-28 13:32:17 +01:00
Emil J b2816b22c5
Merge pull request #4965 from YosysHQ/krys/gen_err_files
More *.err files in test failures
2025-03-28 13:08:44 +01:00
Emil J ec8b745929
Merge pull request #4733 from antmicro/fix-setundef-pass-for-params
Fix setting bits of parameters in setundef pass
2025-03-28 13:06:04 +01:00
Akash Levy 7bbd7ef3eb
Merge pull request #75 from williamzhu17/test-yosys-fix
Fixes for the test-yosys
2025-03-27 17:23:49 -07:00
williamzhu17 7208e05bdf fixes for the yosys test 2025-03-27 17:19:08 -07:00
williamzhu17 770eecb4f7 code cleanup 2025-03-27 15:27:15 -07:00
William Zhu eefdcbfe81 added ornot tests 2025-03-27 15:23:18 -07:00
William Zhu 7f04cc6755 removed dump verilog 2025-03-27 15:14:28 -07:00
William Zhu 8666e9ae45 tests for mux_andnot 2025-03-27 15:13:57 -07:00
William Zhu d493a55025 forgot to add some things to previous commit 2025-03-27 12:40:41 -07:00
William Zhu 3b8330c44f reverted some extra unneccessary checks 2025-03-27 12:40:21 -07:00
William Zhu a03553b54e added some extra comments and checks 2025-03-27 12:36:15 -07:00
William Zhu cc4c9c4eba first tests for opt_expand 2025-03-27 12:31:37 -07:00
Kelvin Chung a0dabf9203 Add extra test 2025-03-26 22:24:41 +00:00
Akash Levy 3d13f7aae2 Bump to latest 2025-03-26 14:56:10 -07:00
KrystalDelusion 5b6b3d01bf
Update gen-tests-makefile.sh
Keep file extensions so that e.g. tribuf.ys and tribuf.sh don't try to output to the same log file.
2025-03-27 10:33:51 +13:00
KrystalDelusion 8a68ae6023
Update gen-tests-makefile.sh 2025-03-27 10:10:49 +13:00
Anhijkt cb03a1ec21 ice40_dsp: fix test 2025-03-26 15:13:05 +02:00
Kelvin Chung 7bbdf6049a Move implementation to constmap and add test 2025-03-26 11:52:55 +00:00
Scott Ashcroft 518986d45c Make cxxrtl tests work on 32-bit by using __builtin_clzll when needed 2025-03-25 13:12:04 +00:00
Krystine Sherwin 0a1c664f02
simplify: Skip AST_PRIMITIVE in AST_CELLARRAY
Otherwise the `AST_PRIMITIVE` simplifies to the corresponding function and is no longer caught by the check for `AST_PRIMITIVE`s, raising an assertion error instead of an input error.
Add bug4785.ys to tests/verilog to demonstrate.
2025-03-25 12:15:54 +13:00
KrystalDelusion a647731812
Merge pull request #4677 from YosysHQ/emil/opt_merge-hashing
opt_merge: hashing performance and correctness
2025-03-25 10:36:02 +13:00
Akash Levy 95f489beec Merge nice gzip refactor 2025-03-20 16:47:12 -07:00
Emil J. Tywoniak 980a0a15c1 stat: allow gzipped liberty files 2025-03-19 13:43:44 +01:00
Anhijkt 5ae32efca5 ice40_dsp: add test 2025-03-15 20:05:57 +02:00
Akash Levy 1c0d4a43b3
Merge branch 'YosysHQ:main' into main 2025-03-14 18:07:55 -07:00
KrystalDelusion 9f1271bee0
Merge pull request #4922 from Anhijkt/fix-splitcells-assert
splitcells: Fix the assertion bug caused by out-of-bound offset
2025-03-14 16:52:38 +13:00
Krystine Sherwin 8405b3b723
select: Fix -none and -clear
If the selection stack only has one element (which it normally does), then
`design->pop_selection()` automatically resets to the default full selection.
This is a problem for `select [-none | -clear]` which were trying to replace the
current selection, but because the pop added an extra element when the `execute`
returned, the extra selection (the one we actually wanted) gets popped too. So
instead, reassign `design->selection()` in the same way as if we called `select
[selection]`.

Also adds selection stack tests, and removes the accidentally-committed
`boxes_dummy.ys`.
2025-03-14 16:32:18 +13:00
Krystine Sherwin 9a9cd05f6c
tests: Fixes for boxes
cxxrtl `test_unconnected_output` and simple_abc9 `abc9.v` both expect boxed modules in the outputs, so make sure they work as expected.
2025-03-14 14:08:15 +13:00
Krystine Sherwin 061c234559
tests/select: Add tests for selections with boxes 2025-03-14 14:05:40 +13:00
Alain Dargelas 68312d046a Fix Yosys test failures 2025-03-13 14:15:13 -07:00
Akash Levy 6f818af110 Ignore test collateral 2025-03-13 01:55:22 -07:00
Akash Levy 0a68eb32b3 Disable sub-neg peepopt 2025-03-13 01:55:14 -07:00
Akash Levy e4066b784d Merge remote-tracking branch 'upstream/main' 2025-03-12 19:21:32 -07:00