Repository navigation
feat(sv): declare implicit nets for continuous assignment targets - #1952
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
An identifier on the left-hand side of a continuous assignment that its scope does not declare is an implicit scalar net of the default net type in that scope (IEEE 1800-2023 6.10). The parser now gives each such identifier of a module or program a net declaration at the start of the scope of the assignment, including in generate blocks, so later stages see an ordinary net. `default_nettype none` keeps it an error, now named at the target (22.8); a scope a wildcard import reaches declares no nets, since the import may supply the name. Implicit nets of interfaces stay unsupported. The sv-tests case 6.10--implicit_continuous_assignment now passes in both state modes. Closes #1946 Change-Id: Ie2dfd625af7422c17170c88c7c2376260bdbb425
tignear
force-pushed
the
feature/feat/1946-sv-implicit-assign-nets
branch
from
October 25, 2026 01:37
ca4fd42 to
a16c4c6
Compare
Contributor
|
Queued — the merge queue status continues in this comment ↓. |
This was referenced Oct 25, 2026
Contributor
Merge Queue Status
This pull request spent 36 minutes 21 seconds in the queue, including 34 minutes 7 seconds running CI. Required conditions to merge
|
This was referenced Oct 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1946.
What
IEEE 1800-2023 6.10, third case: an identifier on the left-hand side of a continuous assignment that its scope does not declare is an implicit scalar net of the default net type, declared in the scope of the assignment. Celox already handled the port-connection case (in the frontend glue) but rejected this one with an unrelated message ("always_ff expression" / "event expression
x"). rtlmeter's C906 relies on it:apb_bridgeassignsbusy_s9without declaring it, andsocassignspad_dtm_jtg_tclk, which only a port connection mentions.assign {p, q[0]} = a;), get a net declaration of thedefault_nettypetype at the start of the scope of the assignment.default_nettype none(22.8) keeps it an error, now reported at the target: "continuous assignment to undeclaredxunder `default_nettype none".How
celox-sv-syntax/src/parser/implicit_nets.rsruns when a module or program unit finishes parsing. It walks the scopes from an explicit stack (deep generate nesting stays off the call stack) and collects:Items this pass does not interpret (unconverted declarations, unbraced generate items) count as declaring every identifier they contain, so they never gain a net by mistake. The pass then adds the synthesized
NetDeclarationbody items, so analysis and lowering see ordinary nets.Validation
synthesizable::continuous_assignment_targets_declare_implicit_nets: module scope, concatenation targets, a generate block, and analways @(x or q)event list reading the implicit nets (the C906 pattern). It passes on every Celox backend,verify-sv-icarus1/1 andverify-sv-verilator1/1.default_nettype_none_rejects_undeclared_assignment_targets. Parser tests cover per-scope declaration and 10,000-deep generate nesting.cargo nextest run -p celox -p celox-sv-syntax -p celox-sv-analyzer -p celox-frontend-sv -p celox-test-suite --features celox/systemverilog: 15262 passed.retained_reportspasses. Clippy (workspace, all targets) and fmt are clean.chapter-6/6.10--implicit_continuous_assignment.svgoes fail → pass in both state modes;expected.tsvis updated. Simulated with a probe:c=1in Celox (2- and 4-state) and Icarus. No other verdict changes.Performance
The pass returns immediately for units without continuous assignments: 52 instructions on
b2_vm_dispatch_bit.sv, whose simulation is unchanged. On C906 (150k lines, thousands ofassigns), callgrind on the release build up to the end of parsing shows the pass at 39.2M instructions: 0.18% of the run and 1.7% ofDeclarations::from_tokens. Most of that is hash-set inserts of the declared names it borrows from the syntax tree.