pub struct InstanceNode {
pub id: InstanceId,
pub template: TemplateId,
pub parent: Option<InstanceId>,
pub name: String,
pub array_path: Vec<u32>,
pub children: Vec<InstanceId>,
}Expand description
One elaborated instance. children is populated in DFS visitation order
(== declaration order), never re-sorted.
Fields§
§id: InstanceId§template: TemplateId§parent: Option<InstanceId>§name: String§array_path: Vec<u32>Two distinct sources, both folded into one field (NL-023;
Deviation #7 in the plan): Symbol::instance_array_path() is
non-empty only for genuine instance-array syntax (modname name[hi:lo](...) applied to the instance’s own declaration) — it is
empty for every instance inside a generate for, because a loop
iteration’s index lives on the enclosing GenerateBlockArray’s
GenerateBlock entries, not on the child instance itself. So
array_path is built by array_path_of (this module, crate-private) as:
instance_array_path().collect() if non-empty (true instance-array
syntax); else walk Symbol::parent() outward from the instance
collecting generate_block_array_index() from every enclosing
GenerateBlock produced by loop-generate (skipping non-loop
GenerateBlocks, e.g. an if/case-generate branch, which have no
array index), stopping at the innermost enclosing InstanceBody (or,
for a top-level instance with no enclosing InstanceBody at all, at
the design’s Root), then reversing (outermost loop first) — empty
Vec if the instance is neither array-instantiated nor inside any
loop-generate.
children: Vec<InstanceId>