Skip to content

Load FSDB scopes lazily and nest struct fields - #196

Open
amikhalev wants to merge 2 commits into
Lramseyer:mainfrom
amikhalev:fsdb-lazy-scope-hierarchy
Open

Load FSDB scopes lazily and nest struct fields#196
amikhalev wants to merge 2 commits into
Lramseyer:mainfrom
amikhalev:fsdb-lazy-scope-hierarchy

Conversation

@amikhalev

Copy link
Copy Markdown

Summary

  • Keep a compact native FSDB scope index during ffrReadScopeTree instead of eagerly building millions of NetlistItems over IPC (avoids extension-host OOM on large dumps).
  • Load child scopes on expand via getScopeChildren, then vars via ffrReadVarByLogUOff (same on-demand pattern as VCD/FST).
  • Emit FSDB STRUCT/RECORD as nested netlist scopes so leaf names like aw_ready are not flattened into duplicates under the parent module.

Test plan

  • Rebuild FSDB addon (npm run compile-addon) with Verdi FSDB reader libs/headers
  • Open a small FSDB and confirm hierarchy expands (modules → children → signals)
  • Open a large multi-million-scope FSDB and confirm “Reading Scopes” completes without JS heap OOM
  • Expand a scope that contains SV structs/AXI interfaces and confirm signals appear under struct folders (no repeated aw_ready at the parent level)
  • Add a few signals to the viewer and confirm waveforms still load

Eagerly materializing millions of scopes over IPC OOMs the extension host
on large dumps. Keep a compact native hierarchy index, fetch children on
expand, and treat FSDB STRUCT/RECORD as nested scopes so leaf names like
aw_ready are not flattened into duplicates under the parent.
@amikhalev
amikhalev marked this pull request as ready for review July 15, 2026 03:09
let label = name;

// field is already included in signal name for fsdb
if (!isFsdb) label = name + field;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not need to be removed

@Lramseyer

Copy link
Copy Markdown
Owner

@heyfey - Can you review this? This looks (mostly) good from my end.

@heyfey

heyfey commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Hi @amikhalev , thanks for your contribution! I will review it soon.

And yes it's a great idea to defer NetlistItem creation to when we actually need it. I built eveything in JS side to avoid duplicating tree data in JS & C++, but turn out it's really slow for JS to create millions of treeitems.

Your changes have one more benifit: by keeping a copy of scope tree in C++ side, we can easily implement "find scope/instance" there (#152) (I hesitate for "find signal" for fsdb)

Serialize getChildren loads so concurrent scope expansion can't interleave
vars through the shared readVars callback state, mark merged bus parents as
loaded so expanding them doesn't wipe nested bits, and key var dedup on
signalId+label so aliased vars aren't dropped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants