Repository navigation
feat(sv)!: report SystemVerilog compilation warnings - #1432
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7fbae2d0da
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7aad8861ad
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
7aad886 to
1ca5208
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1ca52087cb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
ec85136 to
aa048d5
Compare
1ca5208 to
d04f056
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d04f056fde
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
d04f056 to
572b1a7
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 572b1a7974
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
5dbe252 to
e1b5ef1
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e1b5ef1315
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Queued — the merge queue status continues in this comment ↓. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a6a7eac041
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
a6a7eac to
bd0f0bc
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bd0f0bc689
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The SystemVerilog frontend had no way to report a non-fatal diagnostic: the SV build path returned no compilation warnings, and the `$readmem` word-count mismatch that IEEE 1800-2023 21.4 requires a warning for only went to `tracing`. Lowering now collects `FrontendWarning`s, and the SV and mixed build paths return them as `CompilationWarning::SystemVerilog`, also on error. Repeats from module specializations and retried lowerings are dropped. BREAKING CHANGE: `CompilationWarning` gains a `SystemVerilog` variant with the `systemverilog` feature. Change-Id: I59220d8e108d4bcfc52c5f7b8da7bc0794b09989
A `$readmem` warning did not say which call it came from, and two calls reading the same file into equally sized ranges gave identical warnings that were merged into one. System task statements now keep the span of the call in the source, and a `FrontendWarning` carries its file, line, column and source snippet. Warnings are deduplicated by call site, so repeated lowerings of one call collapse while separate calls stay separate. Lowering writes warnings into one sink passed down from the frontend entry points, so warnings found before a later lowering error are kept. BREAKING CHANGE: `Stmt::SystemTask` of the SV analyzer IR gains a `site` field, and `FrontendWarning` becomes a struct of a `FrontendWarningKind` and an optional `WarningLocation`. Change-Id: Idc622a1e6b7e0f6c7248f502ffeb66b69129246d
IEEE 1800-2023 24.7 ignores `$exit` outside a program block and allows a warning. Celox has no program blocks, so every call is ignored; each now reports an `ExitOutsideProgram` warning at the call. Change-Id: I6237a6ddf9ea602596be02e81e921b44240077c2
…ction $exit A $exit in a constant function warns at its call. Interface probes and earlier mixed-language passes keep their warnings when the build fails before the design lowers again. Change-Id: I57950c1a34f32ff98d495831919bd9df293f8d70
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Merge Queue Status
This pull request spent 54 minutes 28 seconds in the queue, including 46 minutes 21 seconds running CI. ReasonThe merge conditions cannot be satisfied due to failing checks
Failing checks: HintYou may have to fix your CI before adding the pull request to the queue again. Waiting for
All conditions
Requeued — the merge queue status continues in this comment ↓. |
d7568d9 to
6914595
Compare
|
Fixed the failure that dequeued this PR from draft #1518 in The ARM64 job failed in "Check x86-64 cross-codegen from AArch64": Validation:
Native AArch64 checks will run again in the queue. Removed @Mergifyio queue |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 69145954f8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| analyze::analyze_source(source) | ||
| }) | ||
| }); | ||
| ir.map(|ir| ir.with_warnings(warnings)) |
There was a problem hiding this comment.
Carry package warnings into expression-override IR
Fresh evidence beyond the earlier public-entry-point fix: when analyze_source_module_with_parameter_expr_overrides analyzes a source containing a package whose constant initializer executes $exit, analyze_packages stores that diagnostic in Packages::warnings(), but this return attaches only warnings collected during the subsequent module analysis. Because the package collector has already ended, the returned Ir::warnings() silently omits the package warning; merge the internally created package warnings into the IR on this path.
Useful? React with 👍 / 👎.
Merge Queue Status
This pull request spent 8 minutes 23 seconds in the queue, with no time running CI. ReasonPull request #1432 has been dequeued Queue conditions are not satisfied:
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Waiting for
All conditions
Requeued — the merge queue status continues in this comment ↓. |
|
@Mergifyio dequeue Pausing this PR while replacing the thread-local warning collector with explicit diagnostic ownership, as requested in review. Validation and queueing will resume after the revision. |
Derive constant-function diagnostics from declarations without a thread-local collector or interpreter side effects. Cache immutable per-component metadata in ParsedSource and publish warnings through IR and AnalyzerError on success and failure. Preserve underlying error classification and source chaining. Diagnose ignored $exit calls in function declarations even when unused; document this policy and test module isolation and failed package/interface analyses. Preserve warnings through interface probing, simulator initialization and test-runner validation errors. Deduplicate by source call and category across parameterized specializations, retaining payload identity for unlocated calls. Keep foreign-codegen builds warning-free. Track interface-probe diagnostic provenance investigation in #1512. AnalyzerError gains WithWarnings with warnings() and into_error() accessors; the unreleased ambient collect_warnings API is removed. Change-Id: I44fd6f2cc3ae57cf1c231bb8fa13bfa264c5d300
6914595 to
841d49f
Compare
|
Revised at 841d49f: removed the warning-specific Function diagnostics are now derived from declarations. Behavior policy: ignored Validation passed:
The queue was paused while replacing the diagnostic architecture. Restoring the queue request for this validated revision. @Mergifyio queue |
Merge Queue Status
This pull request spent 1 hour 3 minutes in the queue, including 1 hour 1 minute 14 seconds running CI. Required conditions to merge
|
Summary
The SystemVerilog frontend had no way to report a non-fatal diagnostic. The SV build path returned an empty warning list, so
Simulator::warnings()was always empty for SV designs. The$readmemh/$readmembword-count mismatch, which IEEE 1800-2023 21.4 requires a warning for, only went totracing::warn!.celox_frontend_sv::FrontendWarning, re-exported ascelox::SvFrontendWarning. It is aFrontendWarningKindplus an optionalWarningLocation(file, line, column and a source snippet), rendered by miette as a Warning.Stmt::SystemTask::site). They are the first SV IR construct with a source location.schedule_sourcesandprepare_external_hierarchy*, so warnings found before a later lowering error are kept.CompilationWarning::SystemVerilog, also attached to errors. The mixed path lowers SV modules again on each pass; a successful pass replaces the previous pass's warnings, and a failing pass's warnings are merged with them. Warnings from the interface-signature probe are attached when the build fails before the design is lowered again.MemoryFileWordCount: the$readmemword-count mismatch, with the task, the memory file and the counts.ExitOutsideProgram: each$exitcall, which 24.7 ignores outside a program block and allows a warning for. Celox has no program blocks, so every call warns. A call in a constant function warns too: the analyzer reports it throughIr::warnings()/Packages::warnings()(newAnalyzerWarning).CompilationWarning, so TypeScript gets these warnings with no extra change.Compatibility
Breaking changes:
CompilationWarninggains aSystemVerilogvariant with thesystemverilogfeature, so exhaustive matches downstream need a new arm.Stmt::SystemTaskof the SV analyzer IR (celox-sv-analyzer) gains asitefield.celox_frontend_sv::interface_signatures_fortakes awarningsout-parameter, andcelox_sv_analyzer::InterfacePrototypegains awarningsfield.Testing
readmem_count_mismatch_preserves_unwritten_wordschecks each call's warning, with its file and line.readmem_count_mismatch_warns_once_per_call: two calls reading the same file into equal ranges warn separately; a call in a module specialized twice warns once; the rendered snippet points atfile:line:column.readmem_warnings_survive_a_later_lowering_error: a later lowering error (an inout top port) still carries the warning.exit_outside_a_program_block_is_ignoredchecks that each$exitcall ininitialandalways_ffwarns once, at its line.exit_in_a_timed_process_warns_at_the_call(a$exitafter a delay, ininitialand in a timedalways) andexit_in_a_constant_function_warns_at_the_call(module and package constant functions).warnings_of_rewritten_specializations_point_at_their_call: specializations bound by type and assignment-pattern parameters report the call once, at its position in the file.mixed::locates_sv_interface_warnings_at_their_call: warnings in an SV interface (a constant function's$exit,$readmemhand$exitininitial) point at their call in the interface's file, under an SV top and under a Veryl top.mixed::keeps_sv_interface_warnings_when_its_signature_fails: a warning found while probing an SV interface survives a failing interface contract.readmem_descending_ranges_and_absolute_addresseschecks that address directives, or exactly one word per address, give no warning.mixed::reports_sv_warnings_of_a_veryl_topchecks that an SV child under a Veryl top reports its warning, at its location.cargo test -p celox --features systemverilog --test systemverilog(2837 passed),cargo test -p celox-sv-analyzer -p celox-frontend-sv.cargo clippy --workspace --all-targets,-p celox --features systemverilog --all-targetsand-p celox-test-suite --features external --all-targets;cargo fmt --check.