Fix: XML Component Multi-Device Variant With names#1605
Merged
ra3xdh merged 3 commits intora3xdh:dev/xml_devicesfrom Apr 7, 2026
Merged
Conversation
added 3 commits
March 11, 2026 15:02
Persist variant identity of multi-name XML components (e.g. sdfrbp with sg13g2_sdfrbp_1 and sg13g2_sdfrbp_2) through save/load cycles using a hidden _xml_device_name property with name-based serialization. - Append hidden _xml_device_name property with empty Description in XmlComponent constructor for robust name=value serialization - Add recreate() override to detect variant mismatch on load and restore correct variant identity from the hidden property - Add rebuildParameters() to reconstruct conditional parameter list for the restored variant while preserving user-edited values - Clear geometry lists in createSymbol() to prevent doubled ports and graphical elements when called again via recreate() - Trim variant names in module_xml.cpp to strip leading whitespace from comma-separated names attribute Signed-off-by: Abdur Rahman <rahman@ihp-microelectronics.com>
Replace {names} with the actual variant name (a_name) when building
property lists in both the constructor and rebuildParameters(), so that
parameters using default_value="{names}" (e.g. sdfrbp.xml) get the
correct variant-specific value instead of the literal placeholder.
Signed-off-by: Abdur Rahman <rahman@ihp-microelectronics.com>
… component registration
Replace {names} with the actual variant name when constructing XML
components so each variant gets a unique Model and its own entry in
s_modules. This fixes save/load round-trips where all multi-name XML
components were resolving to the first registered variant.
Signed-off-by: Abdur Rahman <rahman@ihp-microelectronics.com>
Owner
|
Merged. |
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.
Problem Statement
When XML components defined multiple device variants via a comma-separated
namesattribute, three critical issues existed:Issue 1: Variant Loss on Load
Issue 2: Placeholder Leakage
{names}showed the literal string"{names}"instead of the actual variant nameIssue 3: Registration Collisions , Solution of Issue 1 escalation
{names}resolution in DefaultModel/SpiceModel, all multi-name XML files registered to the sames_moduleskey: the literal string"{names}"DefaultModel="{names}"Fixes
_xml_device_nameproperty : Commit:1a89db21fdcca17023428486Details on changes is described in the corresponding commit.
XML Authoring Patterns (Usage Model)
The implementation supports three distinct authoring patterns, giving XML authors flexibility:
Pattern 1: Unique Model Per Variant (Using Placeholder)
Result: Each variant gets a unique Model key:
sg13g2_inv_1,sg13g2_inv_2How Mechanisms Work:
{names}resolution creates uniques_modulesentries_xml_device_nameis a safety net (no-op in normal use)When to Use:
Pattern 2: Custom Model Naming (Using Placeholder)
Result: Each variant gets a unique Model with custom naming:
INV_sg13g2_inv_1_custom,INV_sg13g2_inv_2_customHow Mechanisms Work:
{names}resolution creates uniques_modulesentries with custom prefix/suffix_xml_device_nameis a safety netWhen to Use:
Pattern 3: Shared Model (Hardcoded)
Result: Both variants share the same Model key:
nmoscl_2How Mechanisms Work:
s_modules_xml_device_nameis essential - the only way to distinguish variants on loads_modulescheck)When to Use:
nmoscl_2.xml,sdfrbp.xml)Migration & Backward Compatibility
Existing Single-Name XML Files
Impact: No changes required, behavior identical to pre-commit.
Why:
{names}resolves to the single name (harmless)_xml_device_namealways equalsa_name(no-op)Existing Multi-Name XML Files
Impact: Most already work, some improvements.
Case A - Hardcoded DefaultModel (Pattern 3):
_xml_device_nameCase B - Placeholder Without Resolution:
{names}resolutionCase C - Parameter Defaults with Placeholder:
Old Schematics
Behavior: Files saved before these changes may not have
_xml_device_name.Fallback: On load, variant will be the first registered variant (same as pre-commit behavior). Acceptable for backward compatibility.
No Breaking Changes: All existing files and schematics continue to work.