searchSignalPathsRegex method
Search for signals whose hierarchical path matches a regex pattern.
The pattern is split on / or . into segments. Each segment is
compiled as a RegExp and matched against the
corresponding depth in the hierarchy tree. Special segments:
**— matches zero or more hierarchy levels (glob-star). Use this to search across hierarchy boundaries, e.g.Top/**/clkfindsTop/CPU/ALU/clk,Top/Memory/clk, etc.- Any other string is compiled as a regex anchored to the full name
(
^…$). Plain names therefore match exactly and regex meta- characters like.*,[0-9]+, etc. work as expected.
Returns up to limit full hierarchical signal paths.
Examples:
'Top/CPU/clk' — exact match at each level
'Top/CPU/.*' — all signals in Top/CPU
'Top/.*/clk' — clk signal one level below Top
'Top/**/clk' — clk signal at any depth below Top
'Top/**/c.*' — signals starting with 'c' at any depth
'**/(clk|reset)' — clk or reset anywhere in hierarchy
'Top/CPU/d[0-9]+' — signals like d0, d1, d12 in Top/CPU
Implementation
List<String> searchSignalPathsRegex(String pattern, {int? limit}) {
final effectiveLimit = limit ?? defaultHierarchySearchLimit;
if (pattern.trim().isEmpty) {
return const [];
}
final segments = _splitRegexPattern(pattern);
final compiled = _compileSegments(segments);
final results = <String>[];
_searchSignalsRegex(
root, [root.name], compiled, 0, results, effectiveLimit);
return results;
}