Commit Graph

10484 Commits

Author SHA1 Message Date
Cary R aafda65b99 Cppcheck cleanup 2026-05-21 05:21:35 -07:00
Cary R. 129a5c980f
Merge pull request #1369 from larsclausen/unpacked-array-assign-strength-delay
Preserve delay and strength in unpacked array continuous assignments
2026-05-20 18:49:41 -07:00
Cary R. da42011b97
Merge pull request #1372 from larsclausen/netevwait-repeat-control
NetEvWait: Don't delete event in destructor
2026-05-20 18:41:38 -07:00
Lars-Peter Clausen e35c857a24 Extend non-blocking event control with <= 0 repeat test
Extend the non-blocking event control assignment tests to check that a 0 or
negative repeat value is handled correctly. In this case the assignment
should be executed like a regular non-blocking assignment and the event
control should be ignored.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-19 21:00:56 -07:00
Lars-Peter Clausen 7e7d0ae94b NetEvWait: Don't delete event in destructor
`NetEvWait` deletes the event that is assigned to it when itself
is deleted. But the event is not owned by the `NetEvWait`, it is shared among
all consumers of the event. Deleting it when the `NetEvWait` is deleted can
result in undefined behavior.

This is mainly a problem for non-blocking event control assignments with a
zero or negative immediate valued repeat. In this case the `NetEvWait` will
be deleted as it is not needed.

```
reg x;
event e;
x <= repeat(1) @e 1'b0;
x <= repeat(0) @e 1'b1; // Assert triggered since in-use event is freed
```

Remove the delete to fix this. Events that end up being unused will be
freed by the nodangle functor.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-19 21:00:39 -07:00
Lars-Peter Clausen 635bdd8eb8 Add regression tests for unpacked array continuous assignment strength and delay
Check that continuous assignments to unpacked net arrays preserve delay and
drive strength on the generated element drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-17 14:46:31 -07:00
Lars-Peter Clausen ab6a0e0799 Preserve delay and strength in unpacked array continuous assignments
Continuous assignments to unpacked arrays are expanded into per-element
BUFZ drivers. Currently this path drops the delay and drive strength from
the original continuous assignment, so `assign #5 a = b` updates the array
immediately and `assign (weak1, weak0) a = b` drives with the default
strength.

Pass the evaluated delay and strength values through the unpacked array
assignment helper and apply them to each generated element driver.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-17 14:34:25 -07:00
Lars-Peter Clausen 85c58d0a7a Use helper types for drive strengths and delays
Drive strengths and delays are often handled as a pair of drive values
and a rise/fall/decay triple. Add small helper types to carry these
groups and use them in the continuous assignment and gate/UDP elaboration
paths.

Use the same helper types when propagating drive and delay values through
netlist links.

Also add helpers for dumping the values in debug output. This keeps the
behavior consistent and fixes one small bug where some of the debug
dumps printed the pointer value for the delays, rather than the actual
delay values.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-17 14:27:45 -07:00
Cary R. cc86f69a89
Merge pull request #1368 from larsclausen/net-decl-consolidation
Support SystemVerilog net declaration assignments
2026-05-17 12:16:25 -07:00
Lars-Peter Clausen 28e121c040 Add regression tests for net declaration assignments
Check that SystemVerilog net declarations can mix entries with and
without initialization.

Check that in SystemVerilog it is possible to do assignments within net array
declarations.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-17 11:12:26 -07:00
Lars-Peter Clausen 02fa1a9978 pform_set_data_type(): Remove `net_type` parameter
`pform_set_data_type()` is now only called on wires that already have the
correct wire type set. There is no need to pass the same type to
`pform_set_data_type()` and set it again.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-17 11:11:54 -07:00
Lars-Peter Clausen 3495889112 Support SystemVerilog net declaration assignments
SystemVerilog allows initialized and uninitialized net declaration entries to
be mixed in the same declaration, e.g. `wire x, y = 1'b1`. In Verilog,
either all nets need to have an initializer or non can have one.

In addition SystemVerilog also allows assignments to arrays of wires during
declaration. E.g. `wire a[3:0] = b;`

Currently there are two different rules for net declarations, one for each
of the Verilog variants. Combine these into a single rule to support
SystemVerilog mixed declarations as well as the assignment to array nets.

When running in Verilog mode still reject mixed initialized and
uninitialized with a check after the parsing.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-17 11:06:44 -07:00
Lars-Peter Clausen e7934d5e66 pform_makewire(): Fix indentation
The assignment handling block uses space-based indentation that does not match
the surrounding code.

Fix the indentation before changing the block.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-17 11:05:02 -07:00
Cary R 86546b5960 Set LD_LIBRARY for BSD so make check works 2026-05-16 23:17:11 -07:00
Cary R ca3a00a51a Update some vlog95 interface configurations 2026-05-16 23:17:11 -07:00
Cary R. e6cfb08dd6
Merge pull request #1367 from larsclausen/uarray-lvalue-concat
Handle single element static unpacked array assignments
2026-05-16 22:04:59 -07:00
Lars-Peter Clausen 74491cfe9f Add regression tests for single element unpacked array assignments
Check that continuous assignment of an assignment pattern to a single element
unpacked array is accepted. Check that assigning a scalar expression to the
whole unpacked array is rejected for both procedural and continuous
assignments.

Check that a selected element of a single element static unpacked array can be
used in a continuous l-value concatenation.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-16 21:11:30 -07:00
Lars-Peter Clausen dea82c5a91 Handle single element static unpacked array assignments
Currently single element static unpacked arrays are not always treated as
unpacked arrays when elaborating assignment l-values. The net only has one pin,
so checks using `pin_count() > 1` treat the array as a scalar value and skip
the unpacked array path.

Use `unpacked_dimensions() > 0` instead of `pin_count() > 1` when checking
whether a signal is an unpacked array. This lets single element arrays follow
the same l-value elaboration paths as other unpacked arrays.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-16 21:06:16 -07:00
Cary R. 8229ce1b49
Merge pull request #1366 from larsclausen/sv2023-type-param-restrictions
Add support for restricted type parameters
2026-05-16 17:44:12 -07:00
Lars-Peter Clausen 08479888b1 Add regression tests for restricted type parameters
Check that enum, struct, union and class restricted type parameters are
accepted. Check that mismatched default values and overrides are rejected.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-16 17:29:32 -07:00
Lars-Peter Clausen 46c0526dab Add support for restricted type parameters
SystemVerilog 2023 allows type parameters to be restricted to a
specific kind of type, e.g. `parameter type struct T = T0`.

This is very similar to the type restrictions that can be applied to
forward typedefs.

Factor the support code from the typedefs into a standalone helper and
reuse it for both.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-16 17:20:40 -07:00
Cary R. 0f75156d37
Merge pull request #1365 from larsclausen/soft-unions
Support soft packed unions
2026-05-16 17:11:41 -07:00
Lars-Peter Clausen f8e9384689 Add regression tests for soft packed unions
Check that soft packed unions can have members with different widths.
Check that the `soft` qualifier implies `packed` and that nested soft
packed unions use the same representation recursively.

Also check that member bits are right-justified and that assignments to
narrower members leave the MSBs beyond the member bits unchanged. Check
that soft packed unions reject default member values.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-16 16:46:57 -07:00
Lars-Peter Clausen fb3be420b4 Support soft packed unions
SystemVerilog 2023 adds soft packed unions. They are pretty much the same
as regular packed unions except they remove the restriction that all
elements have to have the same packed width.

The packed with of the union itself is the maximum packed width of any
element.

The bits of each member are right-justified towards the LSBs and this
representation is applied recursively to nested soft packed unions. The
existing packed union member offsets already use that layout. When
accessing a field that is smaller than the union itself upper bits are
ignored for both reading and writing.

The `soft` qualifier implies a packed union so both `union soft U { ... }`
and `union soft packed U { ... }` declare a soft packed union.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-16 16:43:06 -07:00
Cary R eb45fb6eec Fix Makefile generation warning in tgt-fpga 2026-05-16 16:23:41 -07:00
Cary R. 1f5c7c888a
Merge pull request #1364 from larsclausen/sv2017-2023-generations
Add 2017 and 2023 language flag support
2026-05-16 15:45:52 -07:00
Cary R. 3f0d02350f
Merge pull request #1310 from rhabacker/libvpp-versioned-library
vvp: create libvvp as versioned library
2026-05-16 15:41:59 -07:00
Lars-Peter Clausen 0a6fa449de Add regression tests for `begin_keywords` versions
Check that each valid `begin_keywords` selector is accepted. Only check
that the selector itself is accepted, in these tests there is no check if
the correct keywords are actually accepted or rejected since that would get
pretty exhaustive.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-16 15:40:37 -07:00
Lars-Peter Clausen eadb1d24ae Add 2017 and 2023 language flag support
Add flags to enable IEEE1800-2017 and IEEE1800-2023 languages generations
and also support them in the `begin_keywords macro. Since neither defines
new keywords they'll use the same keyword mask as 2012.

Update the driver, compiler, documentation and regression test harness so
-g2017 and -g2023 are recognized as language generation flags.

There are no specific features from these versions added yet, this is just
the necessary infrastructure to allow gating new features from those
generations when they are added later.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-16 15:40:37 -07:00
Cary R. 00325f3efb
Merge pull request #1348 from jotego/interface-ports
Support SystemVerilog interface-typed module ports
2026-05-16 15:33:56 -07:00
Cary R. b605f42a1e
Update copyright year in parse_misc.h 2026-05-16 15:19:40 -07:00
Cary R. 9f3f35e451
Update copyright year in netmisc.h 2026-05-16 15:19:02 -07:00
Cary R. 73cee3b3e0
Update copyright year in Module.h 2026-05-16 15:18:15 -07:00
Cary R. 9ff4a42171
Update copyright year in Module.cc 2026-05-16 15:17:52 -07:00
Cary R. 84dc4ec99f
Update copyright year in elab_net.cc 2026-05-16 15:16:47 -07:00
Cary R. 1751f4ed0b
Merge pull request #1361 from larsclausen/unpacked-lvalue-concat-error
Reject unpacked l-value concatenation operands
2026-05-16 14:37:36 -07:00
Lars-Peter Clausen 96cea271ba ivtest: Fix VVP regression test metadata
A few JSON regression test entries reference the wrong source or gold
files. There are also two regress-vvp list entries that reference each
other's JSON file.

Use the matching source and gold files for those entries.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-16 13:43:10 -07:00
Lars-Peter Clausen b8eac7fc19 ivtest: Fix source for sv_mixed_assign2 test
The sv_mixed_assign2 JSON entry accidentally references
sv_mixed_assign1.v. Point it at sv_mixed_assign2.v instead.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-16 12:51:43 -07:00
Lars-Peter Clausen f9ab26b3d9 Add regression tests for unpacked l-value concat errors
Check that class objects, dynamic arrays, queues, strings and static
unpacked arrays can not be used as l-value concatenation operands. Check
procedural and continuous assignment concatenations, including single
operand concatenations.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-15 20:48:19 -07:00
Lars-Peter Clausen 208078838e Reject unpacked l-value concatenation operands
L-value concatenation operands must be packed values. Using an unpacked
array, string, class object or other non-packed value as an operand can
reach later assignment code with an invalid l-value representation.

Check the operand type after l-value elaboration and report an
elaboration error instead.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-15 20:44:47 -07:00
Cary R. 73ae5bd1db
Merge pull request #1360 from larsclausen/vvp-case-cmp-e
tgt-vvp: Use `%cmp/e` instead of `%cmp/u` for `case` comparisons
2026-05-15 07:47:46 -07:00
Cary R. 5b62f32ad6
Update copyright year in vvp_process.c 2026-05-15 07:47:24 -07:00
Cary R. a6ba0eef5e
Merge pull request #1359 from larsclausen/remove-unused-parser-union-fields
parse.y: Remove unused fields from union
2026-05-14 22:35:07 -07:00
Lars-Peter Clausen d84f1b9843 tgt-vvp: Use `%cmp/e` instead of `%cmp/u` for `case` comparisons
`%cmp/e` and `%cmp/u` are very similar with `%cmp/e` not setting the lt
flag and being a bit faster due to it. For case comparisons the flag is not
needed so switch to `%cmp/e`. This speeds up simulation time designs which
make use of case comparisons.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-14 20:34:30 -07:00
Lars-Peter Clausen f1c71eff5c parse.y: Remove unused fields from union
The parser union still has a few fields that are not used by any
grammar rule. They do not have matching semantic type tags and no
action references them.

Remove the unused fields.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2026-05-14 20:18:28 -07:00
Cary R. 5fac9fae4d
Merge pull request #1358 from hwhsu1231-fork/edit-this-page
docs: add edit this page to sidebar
2026-05-13 10:01:53 -07:00
Haowei Hsu a042847b38
docs: add edit this page to sidebar 2026-05-13 22:12:30 +08:00
Cary R. 2f1987bded
Merge pull request #1357 from hwhsu1231-fork/add-github-url
docs: add github url to html theme options
2026-05-13 02:46:19 -07:00
Ralf Habacker a1299f7ca8 CI: enable building with libvvp and suffix on MacOSX
Adding these build variants to the platform in question results
in the smallest increase in the number of additional build jobs.
2026-05-13 10:48:24 +02:00
Ralf Habacker 00bb35a0ce CI: Add support to compile on all platforms with libvvp and/or suffix enabled
The specified jobs runs the build, check, install and a post install
test stage.
2026-05-13 10:45:04 +02:00