Skip to content

fix(sv)!: keep Veryl module identity across mixed hierarchy links - #1488

Merged
mergify[bot] merged 1 commit into
masterfrom
stack/tignear/fix/mixed-veryl-identity/keep-veryl-module-identity-across-mixed-hierarchy--f54806fa
Oct 18, 2026
Merged

mergify[bot] merged 1 commit into
masterfrom
stack/tignear/fix/mixed-veryl-identity/keep-veryl-module-identity-across-mixed-hierarchy--f54806fa

Conversation

@tignear

@tignear tignear commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Follow up on #1469. SV-rooted hierarchies lost SV modules instantiated below
a native Veryl child (SV top -> Veryl -> Veryl -> SV), because only direct SV
children of a Veryl module were reported to the SV frontend. Report every SV
instance reached through native Veryl children instead; the Veryl children
themselves still link through the IR.

Modules of the root project and of a dependency may share a source name while
emitting distinct names (app_Child, lib_Child). The mixed bridge round-trip
went through the source name, so one body was silently dropped or bound to
the other's name. External signatures are now registered under emitted names
directly, and the linker and foreign parameter specialization address Veryl
bodies by their position in the IR rather than by name.

Validation:

  • cargo test -p celox -p celox-frontend-veryl --features celox/systemverilog --lib --test systemverilog
  • cargo clippy -p celox -p celox-frontend-veryl --all-targets --features celox/systemverilog --no-deps
  • cargo fmt --all -- --check
  • New tests: an SV leaf below nested Veryl modules (plain and specialized),
    and a path-dependency fixture with same-named modules in both projects
    (plain and specialized); both failed before this change

BREAKING CHANGE: parse_ir_with_external_hierarchy_and_native_modules maps
external module names to indices into the IR components instead of to module
names.

Follow up on #1469. SV-rooted hierarchies lost SV modules instantiated below
a native Veryl child (SV top -> Veryl -> Veryl -> SV), because only direct SV
children of a Veryl module were reported to the SV frontend. Report every SV
instance reached through native Veryl children instead; the Veryl children
themselves still link through the IR.

Modules of the root project and of a dependency may share a source name while
emitting distinct names (`app_Child`, `lib_Child`). The mixed bridge round-trip
went through the source name, so one body was silently dropped or bound to
the other's name. External signatures are now registered under emitted names
directly, and the linker and foreign parameter specialization address Veryl
bodies by their position in the IR rather than by name.

Validation:
- cargo test -p celox -p celox-frontend-veryl --features celox/systemverilog --lib --test systemverilog
- cargo clippy -p celox -p celox-frontend-veryl --all-targets --features celox/systemverilog --no-deps
- cargo fmt --all -- --check
- New tests: an SV leaf below nested Veryl modules (plain and specialized),
  and a path-dependency fixture with same-named modules in both projects
  (plain and specialized); both failed before this change

BREAKING CHANGE: parse_ir_with_external_hierarchy_and_native_modules maps
external module names to indices into the IR components instead of to module
names.

Change-Id: If54806fae722984adcb72bec0eaac44591a8cc41
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T09:35:19.475042Z 9bd1700 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9bd170094e

ℹ️ 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".

let native_module = match native_modules {
Some(names) => names
.get(&external_module.sim_module.name)
.and_then(|&index| match &ir.components[index] {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate native module indices before indexing

When a caller of this public API supplies an out-of-range or stale component index, this direct indexing panics instead of returning a ParserError; the previous name-based lookup simply treated an unknown mapping as absent. Use ir.components.get(index) before matching so malformed mappings cannot abort the host process.

Useful? React with 👍 / 👎.

);
}
}
Component::Module(child) => sv_descendants(child, names, seen),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Cache native descendant traversal

For a large mixed hierarchy where exported Veryl modules share descendants—or form a chain M0 -> M1 -> ... -> Mn—each iteration of external_signatures_named recursively walks the whole subtree again, while seen deduplicates only SV names. A chain therefore performs quadratic native-module visits, and repeated fan-out can be worse, before lowering begins; memoize the SV-descendant set by native module identity/signature instead of recursively recomputing it for every exported root.

Useful? React with 👍 / 👎.

@tignear tignear added the merge-ready Request merging through Mergify after required checks label Oct 18, 2026
@mergify mergify Bot added the queued Mergify queue entry label Oct 18, 2026
@mergify

mergify Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 39 minutes 31 seconds in the queue, including 37 minutes 4 seconds running CI.

Required conditions to merge
  • check-success = Conventional Commit title
  • check-success = Queue validation
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Lint & Format
    • check-neutral = @github-actions/Lint & Format
    • check-skipped = @github-actions/Lint & Format
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-neutral = @github-actions/NAPI Build (Linux ARM64 GNU)
    • check-skipped = @github-actions/NAPI Build (Linux ARM64 GNU)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/NAPI Build (Windows)
    • check-neutral = @github-actions/NAPI Build (Windows)
    • check-skipped = @github-actions/NAPI Build (Windows)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Rust Test & NAPI Build
    • check-neutral = @github-actions/Rust Test & NAPI Build
    • check-skipped = @github-actions/Rust Test & NAPI Build
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/JS Test (Ubuntu)
    • check-neutral = @github-actions/JS Test (Ubuntu)
    • check-skipped = @github-actions/JS Test (Ubuntu)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/JS Test (Windows)
    • check-neutral = @github-actions/JS Test (Windows)
    • check-skipped = @github-actions/JS Test (Windows)
  • any of [🛡 GitHub repository ruleset rule master]:
    • check-success = @github-actions/Conventional Commit title
    • check-neutral = @github-actions/Conventional Commit title
    • check-skipped = @github-actions/Conventional Commit title

@mergify
mergify Bot merged commit 6d17da5 into master Oct 18, 2026
29 checks passed
@mergify
mergify Bot deleted the stack/tignear/fix/mixed-veryl-identity/keep-veryl-module-identity-across-mixed-hierarchy--f54806fa branch October 18, 2026 10:45
@mergify mergify Bot removed the queued Mergify queue entry label Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-ready Request merging through Mergify after required checks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant