Skip to content

[ENG-1969] Resim each instance independently#162

Merged
akashlevy merged 9 commits into
mainfrom
feat/chunk-parallel-sim
May 12, 2026
Merged

[ENG-1969] Resim each instance independently#162
akashlevy merged 9 commits into
mainfrom
feat/chunk-parallel-sim

Conversation

@hsiang20
Copy link
Copy Markdown

Summary

Extend sim to support boundary-cut, multi-root co-simulation so a single FST/VCD can be replayed in parallel. Activity-factor capture also gains a clock-period override for workers that only see a partial design.

Changes

  • Added -bb to cut every parent↔child boundary and source both sides from the FST; skips parent→child input copies and parent output pull-ups, and feeds each child's port inputs from VCD handles.
  • Added -instance <module>:<scope> (repeatable) to root one SimInstance
    per spec instead of recursing from the design top.
  • Added -clk-period <seconds> to bypass the highest-toggling-signal heuristic when computing activity-factor frequency.
  • Generalized SimWorker from a single top to a tops vector.

@linear
Copy link
Copy Markdown

linear Bot commented May 11, 2026

ENG-1969

@hsiang20 hsiang20 marked this pull request as ready for review May 12, 2026 01:23
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 12, 2026

Greptile Summary

This PR extends the sim pass with three new flags (-bb, -instance, -clk-period) that enable boundary-cut, multi-root co-simulation from a single FST/VCD, and generalises SimWorker from a single top pointer to a tops vector so multiple SimInstance roots can be driven in parallel.

  • -bb: cuts every parent↔child module boundary; child outputs are sourced from the FST rather than driven by the parent, enabling each root to simulate its own logic in isolation.
  • -instance <module>:<scope> (repeatable): directly roots a SimInstance at the named module/scope, bypassing design-top traversal; requires FST cosim.
  • -clk-period <seconds>: overrides the highest-toggling-signal heuristic used by AnnotateActivity to compute clock frequency, which is otherwise unreliable when a worker sees only a partial design.

Confidence Score: 4/5

Safe to merge after fixing the null-pointer dereference in sim_cell_unevaluated; all other paths in the new multi-root logic are correctly guarded.

The new -bb guard in sim_cell_unevaluated dereferences mod->name without a null check. Any cell whose type is absent from the design will crash the simulator in -bb mode rather than emitting the existing log_error. That is a real, reproducible crash on any design containing external or library cells not loaded into the current Yosys session. The rest of the multi-root plumbing looks correctly handled.

passes/sat/sim.cc — specifically the new guard block added inside sim_cell_unevaluated around line 652.

Important Files Changed

Filename Overview
passes/sat/sim.cc Adds -bb, -instance, and -clk-period flags; generalises SimWorker from a single top to a tops vector. Contains a null-pointer dereference in sim_cell_unevaluated when -bb is active and a cell's type is not present in the design.

Reviews (2): Last reviewed commit: "chore: add comments and log" | Re-trigger Greptile

Comment thread passes/sat/sim.cc
Comment thread passes/sat/sim.cc
Comment thread passes/sat/sim.cc
@akashlevy akashlevy requested review from akashlevy and stanminlee May 12, 2026 01:27
@hsiang20
Copy link
Copy Markdown
Author

@greptile could you review again

Comment thread passes/sat/sim.cc
@akashlevy akashlevy merged commit 1cc35aa into main May 12, 2026
10 checks passed
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.

2 participants