3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-12 17:06:15 +00:00
Commit graph

15183 commits

Author SHA1 Message Date
Gary Wong
10bb0f472f docs: mention related effects for multiplexers in the cell library. 2025-05-30 21:43:33 -06:00
Gary Wong
62660b221f docs: restore and update the note about if/case attributes. 2025-05-30 21:18:09 -06: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
Gary Wong
370d5871f4 verilog: implement SystemVerilog unique/unique0/priority if semantics.
There are two elements involved:

1) Apply the relevant full_case and/or parallel_case attribute(s) to
the generated AST_CASE node(s), so that the existing AST frontend and
subsequent passes will generate RTLIL with appropriate behaviour.
(This is handled in the parser "if_attr" non-terminal.)

2) Rearrange the AST_CASE structure when necessary.  For "priority if"
(i.e., full_case), this requires only ensuring that directly nested
"else if" branches also inherit the full_case attribute.  For
"unique if" and "unique0 if" (i.e., parallel_case+full_case and
parallel_case alone), there are two steps:
    a) Flatten the AST_CASE structure such that any direct "else if"
    branches are mapped to additional AST_CONDs in the parent;
    b) Reverse the "direction" of the test: the constant 1 (true)
    is provided in the AST_CASE node, and the expression(s) in the
    if statement(s) are given in each AST_COND.  This is necessary
    because the constant 1, being the common factor, must occupy the
    shared AST_CASE position.
(This is handled in the parser "TOK_IF" expansion of behavioral_stmt.)

Observe that:
 * The generated AST has not been changed for bare "if"s (those
 without unique/priority).  This should minimise the risk of
 unexpected regressions.

 * It is possible that the flattening described in 2) a) above might
 affect the behaviour of expressions with side effects in "unique if"
 statements (consider "unique if( a ) ...; else if( b++ ) ...": if
 a is true, is b incremented?).  While it might be possible to provide
 precise semantics here, IEEE 1800-2012 12.4.2 seems to be deliberately
 vague ("In unique-if and unique0-if, the conditions may be evaluated
 and compared in any order[...] The presence of side effects in
 conditions may cause nondeterministic results.") and so it seems
 doubtful that there is benefit in Yosys providing stronger promises
 on the interpretation of questionable code.
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
github-actions[bot]
e046e3cdbf Bump version 2025-05-28 00:24:34 +00:00
Lofty
6d64e73fe7
Merge pull request #5149 from YosysHQ/lofty/abc_new-genlib
Add genlib support to abc_new
2025-05-27 11:04:47 +01:00
Lofty
e4ab6acb46 Add genlib support to abc_new 2025-05-27 09:47:29 +01:00
github-actions[bot]
4f968c6695 Bump version 2025-05-27 00:24:03 +00: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
gatecat
45a6940f40 cxxrtl: Add debug items for state with private names
Signed-off-by: gatecat <gatecat@ds0.me>
2025-05-26 16:58:13 +02:00
George Rennie
e0c1e88f19 kernel: use try_as_int to implement as_int_compress 2025-05-26 15:34:13 +01:00
George Rennie
353fd0f7f4 tests: test opt_expr for 32 bit unsigned shifts 2025-05-26 15:28:44 +01:00
George Rennie
33a22b5cd1 kernel: fix convertible_to_int for overflowing unsigned values 2025-05-26 15:28:14 +01:00
Emil J
4f7ea38b49
Merge pull request #5127 from RonxBulld/refine_strip
Disable STRIP operations when appropriate.
2025-05-26 15:03:34 +02: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
github-actions[bot]
209df95fb9 Bump version 2025-05-24 00:23:33 +00: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
George Rennie
e05b21cfae
Merge pull request #5140 from garytwong/typo-fix
Fix typo ("exist" -> "exit").
2025-05-23 13:01:57 +01: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
Gary Wong
4f0cbf2ee6 Fix typo ("exist" -> "exit"). 2025-05-22 18:52:33 -06:00
github-actions[bot]
6c67b29bbb Bump version 2025-05-23 00:24:38 +00: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
Emil J
4f33cc52db
Merge pull request #5137 from mikesinouye/assert
Allow reading of gzipped files when not in NDEBUG
2025-05-22 10:39:48 +02:00
mikesinouye
761dc6f62a
Allow reading of gzipped files when not in NDEBUG 2025-05-21 15:18:29 -07:00
RonxBulld
64a115e6f0
Disable STRIP operations when appropriate. 2025-05-18 01:07:06 +08:00
github-actions[bot]
388955031f Bump version 2025-05-17 00:23:43 +00:00
KrystalDelusion
135320a58c
Merge pull request #5123 from cr1901/winstat-fix
Strip trailing slashes when checking for directories on Windows.
2025-05-17 09:33:18 +12: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
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
Emil J
3823157c25
Merge pull request #5080 from akashlevy/muldiv_c
Add `muldiv_c` peepopt
2025-05-15 11:03:25 +02:00
github-actions[bot]
ae47c49af5 Bump version 2025-05-15 00:22:59 +00:00
George Rennie
748600c167
small whitespace cleanup (#5119) 2025-05-14 15:18:57 +02:00
github-actions[bot]
e3ae7b1400 Bump version 2025-05-13 00:24:04 +00:00
KrystalDelusion
5268565410
Merge pull request #5108 from marzoul/adrien-uram
Create a single-port URAM mapping to support memories 2048 x 144b
2025-05-13 09:54:36 +12:00
KrystalDelusion
c590c0c12c
Merge pull request #5111 from YosysHQ/krys/config_python
Makefile: Conditional assignment of python exe
2025-05-13 09:54:26 +12:00
KrystalDelusion
05157b164e
Merge pull request #5113 from YosysHQ/krys/ast_asan
simplify.cc: Fix mem leak
2025-05-13 09:52:51 +12:00
Emil J. Tywoniak
f73c6a9c9a write_verilog: don't dump single_bit_vector attribute 2025-05-12 13:36:25 +02: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
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
cc402ee065
libs/fst: Update upstream
libfst is no longer included in gtkwave and instead has its own repo.  There has also been some refactoring, so the patches need to update to match, as does sim.cc.
2025-05-12 10:21:06 +12:00
Adrien Prost-Boucle
6bf7587338 URAM mapping : Add test for 2048 x 144b 2025-05-10 14:53:56 +02:00
Krystine Sherwin
fe0abb7026
simplify.cc: Fix mem leak 2025-05-10 17:10:47 +12:00
github-actions[bot]
6900818105 Bump version 2025-05-10 00:22:55 +00:00