nvc icon indicating copy to clipboard operation
nvc copied to clipboard

Interactive simulation

Open oscargus opened this issue 1 year ago • 5 comments

CXXRTL has defined a protocol for simulator-waveform viewer interaction: https://cxxrtl.org/protocol.html (the protocol and simulator seems to share the same name) and, e.g., Surfer, https://surfer-project.org/ , has some preliminary support for interacting with a simulator and showing the waveforms through it.

I believe that it would be really nice if NVC supports interactive simulation, one way or the other. I believe that from the Surfer side we can probably support other protocols as well, but CXXRTL will make it a bit simpler as there is some support already and one can avoid reinventing something else.

The main benefit is that you can start looking at your waveform early, even though your complete test bench may take a long time to simulate...

(Currently, there is no way defined to set signal values through CXXRTL, but that may of course also be a nice feature in the long run, to quickly simulate something without writing a test bench.)

oscargus avatar Nov 01 '24 13:11 oscargus

This feature would be very much appreciated!!! This would be yet another plus to move away from expensive and slow simulators ;)

tasgomes avatar Jan 06 '25 13:01 tasgomes

My preference for implementing this sort of thing would be through a VHPI plugin (I think that's how the commercial simulator GUIs work anyway). Since you're already using Rust in surfer I tried hacking together a Rust example at https://github.com/nickg/cxxrtl-vhpi but I don't really know Rust at all so didn't get very far. The plugin could probably live in the Surfer repository, perhaps with a VHPI wrapper library split out with easier to use bindings.

nickg avatar Jul 13 '25 12:07 nickg

Thanks! I agree that it makes sense to use a VHPI plugin (as far as I can tell with limited detailed knowledge about VHPI and, primarily, I trust you). I'll try to look more into it, although it may take some time.

oscargus avatar Jul 13 '25 12:07 oscargus

I put my attempt at some Rust bindings here: https://github.com/nickg/rust-vhpi

nickg avatar Jul 13 '25 20:07 nickg

It'd be also cool to use NVC like ModelSim where for example the Surfer acts as the GUI if it's opened for example via VUnit. Instead of dumping the VCD or FST file and open it manually.

nselvara avatar Sep 01 '25 08:09 nselvara