HierarchyOccurrence class

An occurrence of a module definition in the unfolded hierarchy tree.

This is the core structural data model, independent of waveform data. Path strings are computed on demand from parent references rather than stored — call path with your desired separator.

Available extensions

Constructors

HierarchyOccurrence({required String name, String? definition, bool isPrimitive = false, List<SignalOccurrence>? signals, List<HierarchyOccurrence>? children})
Creates a HierarchyOccurrence with the given properties.

Properties

address OccurrenceAddress?
Hierarchical address for this occurrence. Assigned by buildAddresses to enable efficient navigation. Format: child0, child1, ..., childN for nested occurrences.
no setter
children List<HierarchyOccurrence>
Child occurrences. Populated from sub-modules in the hierarchy.
final
computedSignalCount int
Number of computed signals in this subtree.
no setter
definition String?
Definition (module) name for this occurrence.
final
hashCode int
The hash code for this object.
no setterinherited
inouts List<SignalOccurrence>
Returns only inout signals.
no setter
inputs List<SignalOccurrence>
Returns only input signals.
no setter
isPrimitive bool
Whether this occurrence is a primitive cell (gate, operator, register, etc.) whose internal structure is not useful for design navigation.
final
isPrimitiveCell bool
Whether this occurrence represents a primitive cell that should be hidden from the occurrence tree.
no setter
name String
Display name of this occurrence (instance name within its parent).
final
outputs List<SignalOccurrence>
Returns only output signals.
no setter
parent HierarchyOccurrence?
Parent occurrence, or null for the root. Set by buildAddresses.
no setter
portCount int
Number of port signals in this occurrence.
no setter
ports List<SignalOccurrence>
Returns only signals that are ports (have a direction).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
signalCount int
Total number of signals in this subtree (O(n) recursive count).
no setter
signals List<SignalOccurrence>
Signals within this occurrence (includes both internal signals and ports). Empty for leaf occurrences.
final

Methods

buildAddresses([OccurrenceAddress startAddr = OccurrenceAddress.root]) → void
Build hierarchical addresses for this occurrence and all descendants.
childIndexByName(String name) int
Return the offset (index) of the child with name in children, or -1 if not found. Case-sensitive. O(1) after first call (lazily builds index).
childrenMatching({Pattern? pattern, OccurrenceTraversalMode mode = OccurrenceTraversalMode.opaque}) List<HierarchyOccurrence>

Available on HierarchyOccurrence, provided by the HierarchyOccurrenceTraversal extension

Returns child occurrence handles matching pattern.
depthFirstSignals() List<SignalOccurrence>
Collect all signals under this occurrence in depth-first order.
findSubFieldSignals(SignalOccurrence parentSignal) List<({String fieldLabel, SignalOccurrence? signal, int startBit, int width})>
Finds the sub-field SignalOccurrence entries for a struct/array signal.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
path({String separator = hierarchyPathSeparator}) String
Compute the full hierarchical path by walking up the parent chain.
signalIndexByName(String name) int
Return the offset (index) of the signal with name in signals, or -1 if not found. Case-sensitive. O(1) after first call (lazily builds index).
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

isPrimitiveType(String cellType) bool
Whether cellType represents a netlist built-in primitive cell type.