Repository navigation
fix(sv)!: name Veryl declarations by their emitted SV names - #1469
Conversation
In a mixed design, SV referred to Veryl modules and interfaces by their Veryl source names, while the Veryl emitter names them `<project>_<Name>` (or `<Name>` with `omit_project_prefix`). SV written against the emitted code did not link, and SV written for Celox did not build with other tools. SV now sees Veryl declarations only by their emitted names: declaration contracts, interface bindings and foreign roots use them, and the hierarchy linker maps each emitted name back to its Veryl body instead of matching names, so an SV module and an emitted Veryl name no longer shadow each other. An SV module named like an emitted Veryl module is reported as a duplicate. A Veryl top is still selected by its Veryl name, and instances keep Veryl module names. 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 mixed tests cover a custom project prefix, omit_project_prefix, rejection of source names, and emitted-name collisions BREAKING CHANGE: SV sources in a mixed design must instantiate Veryl modules and interfaces by their emitted names, such as `prj_Child`, instead of `Child`. parse_ir_with_external_hierarchy_and_native_modules takes a map from external module names to Veryl module names instead of a name set. Change-Id: Ib464695577c60ea747f010607b3bebf6671b2805
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 73bcc1acf9
ℹ️ 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 Component::SystemVerilog(module) = instance.component.as_ref() else { | ||
| return None; |
There was a problem hiding this comment.
Preserve native dependencies when preparing SV-rooted hierarchies
When an SV top instantiates a Veryl module whose Veryl child later instantiates an SV module, filtering the parent signature down to direct SystemVerilog children prevents the SV frontend from discovering that descendant. reachable_external_sv_roots cannot seed it because the selected top is not in the Veryl IR, so the external hierarchy contains the SV top and first Veryl module but not the eventual SV leaf; when the IR linker traverses the native child, its lookup in external.roots fails with MissingExternalModule. Native children therefore still need to contribute their transitive SV dependencies during hierarchy preparation, even though their bodies are linked through the IR.
Useful? React with 👍 / 👎.
| let Some(id) = roots.remove(&module.name.to_string()) else { | ||
| continue; |
There was a problem hiding this comment.
Preserve namespace identity while renaming foreign roots
When the root project and a dependency both define a module with the same terminal name, their Veryl namespaces are distinct and the emitter gives them distinct names such as prj_Child and dep_Child, but this lookup still consumes roots by module.name alone. external_signatures has only a source-name-keyed Child entry, so the first component removes it and the other component is silently skipped; consequently SV written against the emitted code cannot instantiate both declarations and may report one as missing or bind the surviving body. The emitted-name mapping needs to retain the module's symbol/signature identity rather than round-tripping through the unqualified source name.
Useful? React with 👍 / 👎.
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. |
Merge Queue Status
This pull request spent 36 minutes 57 seconds in the queue, including 35 minutes 11 seconds running CI. Required conditions to merge
|
In a mixed design, SV referred to Veryl modules and interfaces by their Veryl
source names, while the Veryl emitter names them
<project>_<Name>(or<Name>withomit_project_prefix). SV written against the emitted code didnot link, and SV written for Celox did not build with other tools. SV now sees
Veryl declarations only by their emitted names: declaration contracts,
interface bindings and foreign roots use them, and the hierarchy linker maps
each emitted name back to its Veryl body instead of matching names, so an SV
module and an emitted Veryl name no longer shadow each other. An SV module
named like an emitted Veryl module is reported as a duplicate. A Veryl top is
still selected by its Veryl name, and instances keep Veryl module names.
Validation:
rejection of source names, and emitted-name collisions
BREAKING CHANGE: SV sources in a mixed design must instantiate Veryl modules
and interfaces by their emitted names, such as
prj_Child, instead ofChild.parse_ir_with_external_hierarchy_and_native_modules takes a map from external
module names to Veryl module names instead of a name set.