The unified simulation interface.
S is the per-design simulator state (e.g. Foo.Sim.Simulator).
I is the typed input record, O the output record. Both are
outParams so writing sim.step inp lets Lean infer them.
All four methods are IO-monadic; backends that don't need
to run effects (pure-Lean) still wrap their work in IO so
the call-site signature is identical across backends.
Restore the simulator to its initial state (cycle 0, registers at their declared
initvalues).Drive the inputs and advance one clock cycle.
- read : S → IO O
Read the current outputs.
Release any resources (close the dlopen handle, free Verilator obj_dir, ...). Implementations should be idempotent.
Instances
Run n cycles with a constant input. Handy when the
input is "no inputs" (a SimInput with no fields), since
callers can write sim.run 100 {}.
Equations
- Sparkle.Core.Sim.Sim.run sim n i = Sparkle.Core.Sim.Sim.trace sim (List.replicate n i)