You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it make sense to have a way to capture simulation output in a python object, rather than having to use a vcd file and a separate reader program?
I'm building a physics simulator in nmigen and it would be super helpful when debugging to be able to plot a signal's trace (over eg 1000 timesteps) in matplotlib, within the same python session as the simulation.
Does this make sense as a workflow?
Is there already a way to do this?
The text was updated successfully, but these errors were encountered:
I'd like us to make sure that this can be used incrementally - that is, run for N clock ticks and return the traces, do something with them, then run for M more clock ticks and return those traces. This ties into my dream of an interactive simulator.
Note that I don't think the context manager API is incompatible with the above, just making a use case known. run_until and step in place of run should cover it.
Yes, that would be awesome! I was thinking of the possibility of making interactive simulations with ipywidgets, but if making it iterative will complicate the API or the implementation of the simple case, perhaps the simple case should take priority.
I think it would be an appropriate and highly useful feature to have: your workaround is... let's say suboptimal (no shade but it's pretty inefficient), and what @awygle wants here is also very reasonable.
Adds an Observer interface to the simulator, allowing arbitrary code
to receive values from the simulation.
The implementation is based on the implementation of write_vcd. An
obvious next step would be to make _VCDWriter a subclass of Observer,
- rewrite Simulator.write_vcd() as a call to Simulator.oberve()
- remove PySimEngine._vcd_writers and associated code.
This commit is an RFC for amaranth-lang#327.
It is not intended to be submitted as-is.