Commit Graph
630 Commits
Author SHA1 Message Date
Lars-Peter Clausen 506eaa5415 Add tests for dimensions on named types
Check that packed dimensions are preserved when local and
package-qualified identifiers resolve to types in type parameter values and
system function arguments. Verify that symbolic dimensions are evaluated in
the scope of each module instance.

Check the diagnostics for unsized and queue suffixes, indexed part selects,
and packed dimensions applied to an unpacked named type.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-08-16 17:19:54 -07:00
Lars-Peter Clausen 21bfe06b33 Add tests for named type expression lookup
Check that lookup chooses the nearest visible type or value when an
identifier can denote either. Cover lexical ordering, inherited properties,
and a bracket suffix that must remain a value select after lookup.

Check typed expression and l-value contexts where a type must be rejected
instead of binding an outer value. Check that a hierarchical type reference
is rejected with the type-specific diagnostic.

Check that probing an invalid hierarchical type parameter does not elaborate
its signal prefix and report a false circular dependency.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-08-16 17:19:54 -07:00
Lars-Peter Clausen 9a2106a439 Add regression tests for types during symbol lookup
Check that a visible type prevents lookup from continuing to an outer value
for function and task calls and implicit `.name` and wildcard `.*` port
connections. Check that types are rejected as disable targets, named events,
procedural l-values, and expressions elaborated with a required type.

Also check the opposite lexical-order case where a typedef declared after a
reference does not hide an outer named event or variable. Use diagnostic gold
files for each negative case that emits the type-specific error.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-08-16 13:56:31 -07:00
Lars-Peter Clausen 3ed306bab8 Add regression tests for disable target lookup
Check separately that a local variable, named event, and parameter hide a
compilation-unit task used as a disable target.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-08-16 08:43:32 -07:00
Lars-Peter Clausen b3d0677d08 Add regression tests for task and function call lookup
Check that a closer variable, named event, or parameter hides a task or
function used as a statement. Also check object method lookup and recursive
function calls used as statements.

Check that a later compilation-unit task or function takes precedence over a
matching subroutine in an enclosing instance. Check that different instances
of the same module resolve task calls through their respective enclosing
instances. Check ordinary lexical ordering for a task-call receiver declared
before or after the reference.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-08-16 08:43:32 -07:00
Lars-Peter Clausen e5f2975a97 Add regression tests for compilation-unit lookup order
Check that same-named scopes in the enclosing instance hierarchy do not
interfere with lookup of compilation-unit variables, parameters, named events,
and imported variables. Cover expressions, procedural l-values, implicit and
wildcard port connections, and lookup from module and nested function scopes.

Check task and function calls, including method receivers and chained calls.
Verify that receiver prefixes follow ordinary lexical ordering while direct,
imported, and chained compilation-unit function names can be declared after
their references. Check the enclosing-instance fallback when the compilation
unit has no match.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-08-16 08:15:31 -07:00
Lars-Peter Clausen 1d2aa1b6fa Add regression tests for duplicate class property names
Check that a class property cannot share a name with another property, a
function, a task, a parameter, a type, or an enum named constant. Check
duplicate properties in both separate and comma-separated declarations. The
latter guards the shared declaration type ownership that previously caused a
crash.

Exercise properties in both declaration orders so both member registration
paths are covered.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-08-10 20:30:46 -07:00
Lars-Peter Clausen 2efe188b52 Add regression tests for invalid index component contexts
Consolidating variable dimensions and hierarchy indices into a shared
grammar makes all index component forms parse in either context.

Check that `+:` and `-:` indexed part selects are rejected as dimensions,
and that `[]` and `[$:N]` are rejected as hierarchy indices. These forms
were previously excluded by the context-specific grammar rules.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-08-10 20:17:46 -07:00
Lars-Peter Clausen 008b76eae6 Add regression tests for null array dimensions
Check that source `null` expressions in `[null]` and `[null:N]` are
rejected rather than treated as the `$` marker for unbounded and bounded
queue dimensions.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-08-09 15:08:01 -07:00
Lars-Peter Clausen 72998c5415 Add regression test for inherited non-void function calls
Check that a bare inherited non-void function call used as a statement emits
the required discarded-return warning and executes the function.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-08-08 18:44:26 -07:00
Lars-Peter Clausen aa8f928ffa Add regression tests for initialized const static properties
Check that a `const static` class property with a declaration
initializer is accepted and has the initialized value. Also check that
subsequent assignments through unqualified and object-member lookup are
rejected.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-08-08 18:06:24 -07:00
Lars-Peter Clausen b883f7713c Add regression test for nested const property initialization
Check that a const property can be assigned from a named block inside its
class constructor.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-08-08 18:06:24 -07:00
Lars-Peter Clausen bfc0121fb9 Add regression test for const properties in derived classes
Check that an inherited property does not offset initialization bookkeeping
for a const property assigned in the derived class constructor.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-08-08 18:06:24 -07:00
Lars-Peter Clausen f493076882 Add regression test for nested class method calls
Check that an unqualified method call from a named block uses the implicit
`this` signal from the containing class method. The compiler currently looks
for the signal in the named-block scope and crashes.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-08-05 20:45:56 -07:00
Lars-Peter Clausen c71709d75d Add regression tests for $unit:: reference order
Check separately that `$unit::` references to a variable, named event, and
parameter declared later in the compilation unit are rejected.

Also check that preceding compilation-unit items remain visible and that a
later function name remains visible as permitted by the LRM section 3.12.1
exception.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-08-05 20:45:43 -07:00
Lars-Peter Clausen 8e420f56ff Add regression tests for enum named constant reference order
Check that a reference before an inner enum declaration resolves to a
matching enum named constant in the outer scope, while a reference after the
declaration resolves to the inner constant.

Also check that `-gno-strict-parameter-declaration` continues to allow a
reference to a later enum named constant and identifies it correctly in the
declaration-after-use warning.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-08-04 21:22:08 -07:00
Cary R 591d2c2473 Fix for GH 1140 2026-08-03 21:31:18 -07:00
Lars-Peter Clausen 8cd52ac5be Add regression test for wildcard imports in bare delays
Check that a bare delay identifier before a wildcard package import resolves
an outer constant. Check that a following bare delay activates the import and
resolves the package constant.

Run the test through the native and vlog95 backends.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-08-03 21:20:46 -07:00
Lars-Peter Clausen e4d29bb1c1 Add regression test for cross-unit package imports
Check that value parameters, `localparam` constants, scalar variables,
unpacked arrays, named events, and enum literals imported from a package in
another compilation unit are visible in the importing module. Exercise both
explicit and wildcard imports.

Give the package declarations larger unit-local lexical positions than the
references in the importing unit so that comparing these unrelated positions
exposes the bug.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-08-03 20:56:29 -07:00
Lars-Peter Clausen e393487126 Add regression test for wildcard imports in implicit named ports
Check that an implicit `.name` port connection before a wildcard import
resolves an outer declaration, while a connection after the import
resolves the declaration from the package.

Run the test through the native and vlog95 backends.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-08-03 20:37:59 -07:00
Lars-Peter Clausen c5dbdddf7b Add regression tests for specparam reference order
Check separately that a module-body specparam declaration following a
reference is rejected and that a specparam declared in a specify block
remains visible before its declaration.

Run both tests through the native and vlog95 backends.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-08-03 20:37:46 -07:00
Lars-Peter Clausen 2556b5f073 Add regression test for wildcard import in class copy construction
Check that class copy construction in a nested scope activates a wildcard
package import and resolves the imported source. Check that construction in
the enclosing scope still resolves the same-named local source.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-08-03 20:37:27 -07:00
Lars-Peter Clausen b8b6e225fc Add regression tests for package import reference order
Check separately that explicit and wildcard package imports only affect
following references. Use outer-scope declarations and package declarations
with the same names so references before and after each import resolve
differently.

Also cover implicit named port connections and repeated explicit imports.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-08-01 19:04:31 -07:00
Lars-Peter Clausen eda9fdcd13 Add regression test for imported typedef reference order
Check that a typedef reference in a nested scope keeps the package typedef
selected during parsing when another typedef with the same name is imported
later. Check that a reference following the import selects the new typedef.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-07-26 20:14:31 -07:00
Lars-Peter Clausen 8df804c273 Add regression tests for wildcard port declaration order
Check separately that a wildcard port connection ignores a declaration after
the module instance in strict mode and uses the port default.

Check the exact position of `.*`: an implicit net created by an explicit
connection before `.*` is connected, while one created after `.*` is not.
Check that `-gno-strict-net-var-declaration` preserves relaxed behavior and
binds a declaration introduced after `.*`.

Run all three tests through the native and vlog95 backends.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-07-26 20:14:20 -07:00
mjoekhan afe849249c SV: reverse(), sort(), rsort(), shuffle() for queues/darrays
Add ordering methods for queues and dynamic arrays.  Update ivtest gold
files for always_*_warn, br1005, and br_gh710b LXT per review.

Split from steveicarus/iverilog#1330 (part 06/6).
2026-07-21 11:01:29 +05:00
mjoekhan e628e6c8c5 SV: sum() and product() reductions on queues/darrays
Add integral sum() and product() reductions, including expression
forms, for queues, dynamic arrays, and class properties.

Split from steveicarus/iverilog#1330 (part 05/6).
2026-07-21 10:32:45 +05:00
Cary R. 31d1850bc8 Merge pull request #1445 from larsclausen/procedural-block-prefix-label
Support prefix labels on procedural blocks
2026-07-20 21:32:25 -07:00
Cary R. 402c96583f Merge pull request #1444 from larsclausen/assertion-item-label-type-id-shadow
Support assertion item labels shadowing type identifiers
2026-07-20 21:29:37 -07:00
Lars-Peter Clausen 9c56f0172d Add regression tests for prefix labels on procedural blocks
Check the reproducer from GitHub issue #1321, which uses a prefix label on a
begin-end block inside an `always_comb` process.

Check prefix labels on sequential and parallel blocks. Place attributes between
the labels and block keywords, verify that the sequential label creates a named
scope, cover all fork join types, and use matching closing labels.

Check separately that visible type identifiers can be shadowed by prefix labels
on sequential and parallel blocks.

Check that matching and different block names after `begin` or `fork` are
rejected when a prefix label is already present.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-07-20 20:55:48 -07:00
mjoekhan 243dccc368 SV: locator methods on class queue/darray properties
Extend locator methods to class queue and dynamic-array properties,
including min/max, unique/min/max with-predicates, and VVP array-pattern
object handling. Built on the #1419 locator helpers.

Split from steveicarus/iverilog#1330 (part 04/6).
2026-07-20 20:41:19 +05:00
Lars-Peter Clausen 713ad762af Add regression test for assertion item labels shadowing type identifiers
Check that a visible type identifier can be shadowed by labels on module
level assertion items. Cover both a concurrent assertion item and a
deferred immediate assertion item.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-07-19 20:19:07 -07:00
Lars-Peter Clausen 11af9fb3b3 Add regression tests for procedural labels shadowing type identifiers
Check that a visible type identifier can be reused as a procedural assertion
label after a declaration in both task and block bodies. These are the contexts
where label and declaration parsing meet.

Also check that a null statement ends the declaration portion of a procedural
body and a following declaration is rejected.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-07-19 20:12:11 -07:00
Lars-Peter Clausen 3c3f46099d Add regression tests for interface identifier names
Check separately that a visible interface name can be reused as a member,
modport, interface port, ordinary port, interface instance and procedural block
name.

Also check an attributed forward interface port type after another ANSI port
declaration.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-07-18 11:22:09 -07:00
mjoekhan e3222e77ad SV: queue/darray locator methods (find*, unique*, min/max)
Add find*, unique*, min/max, and with-predicate locator methods for
queues and dynamic arrays, with VVP runtime support and ivtest.

Split from steveicarus/iverilog#1330 (part 03/6).
2026-07-15 22:49:12 +05:00
mjoekhan 4a505546a1 SV: chained method calls a().b()
Add parsing and elaboration for chained calls on expression results,
with sv_call_chain_method1 regression.

Split from steveicarus/iverilog#1330 (part 02/6).
2026-07-13 18:48:30 +05:00
Cary R d376375020 Fix br1005 tests for fsv and vlog95 2026-07-12 10:05:49 -07:00
Cary R. d15f24ff49 Merge pull request #1416 from muhammadjawadkhan/split/01-sv-class-queue-darray-props
SV: class queue/darray property foundation
2026-07-12 08:18:25 -07:00
Lars-Peter Clausen 0e3ac8685c Add regression tests for discipline and nature type identifier names
Check that nature and discipline declaration names can match visible type
identifiers. Also check `potential` and `flow` references to nature names that
are visible as type identifiers.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-07-11 17:47:52 -07:00
Lars-Peter Clausen a540a7a163 Add regression tests for for and foreach type identifier names
Check that a for loop variable declaration can use the same name as a
visible typedef, including references from the loop condition and step
expressions.

Also check that procedural foreach can parse an array expression name that
is initially seen as a type identifier. Declare the array after the loop so
the parser sees the outer typedef while parsing the foreach header, then
elaboration resolves the array declaration as a module item.

Use unsigned variables and omit the foreach iterator because these tests do
not depend on signed values or iteration behavior. This lets both tests run
through the vlog95 backend as normal regressions.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-07-11 15:58:18 -07:00
Lars-Peter Clausen 36a79568b7 Add regression tests for attribute names matching type identifiers
Check that a standard attribute name can match a visible typedef. Also check
that the global `$attribute` extension can target a primitive whose name is
visible as a type identifier.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-07-11 15:58:02 -07:00
Cary R. 0723d9a477 Merge pull request #1435 from larsclausen/br-gh1385-vlog95
ivtest: Run nested enum tests through vlog95
2026-07-10 10:43:04 -07:00
Cary R. f8069416f2 Merge pull request #1434 from larsclausen/parameter-omit-implicit-type
parser: Reject implicit parameter types without parameter
2026-07-10 10:42:15 -07:00
Lars-Peter Clausen c0cf842eb2 ivtest: Move parameter omit tests to JSON
The parameter_omit tests have different expectations depending on whether the
regression is run in the default Verilog mode or with force SystemVerilog.
The old list files modelled this by registering the same tests in both
regress-vlg.list and regress-fsv.list.

Move the tests to JSON descriptors. Use the existing force-sv override for the
forms that are valid SystemVerilog, and keep the implicit type cases as CE in
both modes. This also runs the tests through the additional configurations
supported by vvp_reg.py, providing better coverage in CI.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-07-09 20:49:01 -07:00
Lars-Peter Clausen f870c755fa ivtest: Run nested enum tests through vlog95
The br_gh1385a, br_gh1385b, and br_gh1385c JSON descriptors mark the vlog95
variants as compile errors. The enum typedefs are translated correctly, so the
compile error expectation causes the tests to fail when compilation succeeds.

Remove the stale overrides and run the translated tests through vlog95.

Fixes: 10349287a0 ("Add regression tests for enum typedefs in nested scopes")
Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-07-09 20:45:55 -07:00
Lars-Peter Clausen 3e0c298b25 Add regression tests for named selectors matching typedef names
Check that a named binding selector can have the same text as a visible typedef
name. Cover named module port connections, named parameter overrides, and named
task, function and constructor arguments.

Also check that a modport simple port selector can shadow a visible typedef
name. Modport simple port aliases share the same parser rule but declare the
modport-visible name rather than binding to an existing formal.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-07-09 20:08:25 -07:00
mjoekhan 9880fb8d5e SV: class queue/darray property foundation
Fold in Windows VPI routing for vpip_format_pretty, fix queue method
argument elaboration via elaborate_rval_expr, reject class tasks used as
expressions cleanly, and update br1005 now that class queues compile.

Review follow-up: move vpip_format_pretty to vpip_format.cc with
diagnostic return strings, restore NetNet-based queue method elaboration
with a separate property path, drop spurious /devel/ from .gitignore,
and bump copyright years on touched files.

Formatting pass per inline review: brace style for multi-line if bodies,
||/&& at end-of-line continuations, switch/case indentation, single-line
if returns, NetNet-based sys_task_method_ again, and aligned extern decls.
2026-07-07 00:46:45 +05:00
Lars-Peter Clausen abfb4e83bc Add regression test for event names shadowing type identifiers
Check that event declarations can use visible type identifiers as event names.
Also check that the resulting named event can be triggered and waited on.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-07-05 21:44:44 -07:00
Lars-Peter Clausen f6848300b7 Add regression tests for block labels shadowing type identifiers
Check that visible type identifiers can be reused as named block labels. Cover
procedural `begin` blocks, fork blocks, and conditional generate blocks. Also
check matching end labels where the grammar consumes the shared `label_opt`
rule.

The generate test keeps the existing vlog95 compile-error expectation because
named generate scopes are not translated by the vlog95 target.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-07-05 21:36:32 -07:00
Lars-Peter Clausen 15277c9fa4 Add regression test for package names shadowing type identifiers
Check that a package declaration can use a visible type identifier as its
package name. Also check that the resulting package scope can be selected with
a scope-qualified reference.

Signed-off-by: Lars-Peter Clausen <[email protected]>
2026-07-05 21:36:18 -07:00