Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pysim2 doesn't write input signals to VCD #280

Closed
adamgreig opened this issue Dec 4, 2019 · 5 comments
Closed

pysim2 doesn't write input signals to VCD #280

adamgreig opened this issue Dec 4, 2019 · 5 comments

Comments

@adamgreig
Copy link
Contributor

Since updating to pysim2, any signals not driven from inside the fragment being simulated are not written to the VCD. This means signals which are inputs to the fragment and are driven by a sync process added to the simulator do not show up.

I think this is because FragmentCompiler is the only thing that adds signals to signal_names, but it is only called for the fragment the simulator is created with, not for any processes that are then added to the simulator. I might be misunderstanding the code though.

Additionally, as far as I can tell the traces argument to write_vcd is totally unused: it gets passed to _VCDWaveformWriter.__init__, which does nothing with it.

@whitequark
Copy link
Contributor

I think this is because FragmentCompiler is the only thing that adds signals to signal_names, but it is only called for the fragment the simulator is created with, not for any processes that are then added to the simulator. I might be misunderstanding the code though.

This is basically correct, but what it should do instead is also add any inputs. This wouldn't solve signals used for communicating between simulation processes only, but your suggestion wouldn't solve it as well because you can't add new signals in the middle of a vcd file.

Additionally, as far as I can tell the traces argument to write_vcd is totally unused: it gets passed to _VCDWaveformWriter.__init__, which does nothing with it.

Oops, good catch.

@phlipped
Copy link

Would it be possible to just re-write the vcd file after simulation has finished such that the variable definitions section at the start contains any additional signals that were seen along the way?

@whitequark
Copy link
Contributor

Would it be possible to just re-write the vcd file after simulation has finished such that the variable definitions section at the start contains any additional signals that were seen along the way?

Maybe, but I'm not really interested in any solution that requires me to manually manipulate VCD files.

@JarrettBillingsley
Copy link

JarrettBillingsley commented Dec 20, 2019

Seems like the VCDWriter is a bit inflexible in this regard. I can imagine a version which buffers the variable changes and registered variables in memory until it's closed, at which point it then writes everything out. Not sure if that could be done with subclassing...

[edit] or, if not in memory, writing the variable changes to a temp file, and at close, outputs the registered variables and appends the contents of that temp file to the output. Dunno!

@adamgreig
Copy link
Contributor Author

I'm not really fussed about outputting signals that testbenches might create (at least, it doesn't affect me), but not having any input signals at all in the VCD makes my usual debugging/testing with pysim2 basically impossible at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants