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

ChiselSim waveforms #4246

Open
HakamAtassi opened this issue Jul 7, 2024 · 5 comments
Open

ChiselSim waveforms #4246

HakamAtassi opened this issue Jul 7, 2024 · 5 comments

Comments

@HakamAtassi
Copy link

Hello!

I feel like I'm not the first to ask, but I haven't found anything regarding this as an open issue so I'll ask nonetheless.

ChiselSim. Waveforms. Yes or no?

Can I write chisel/scala tests and dump a VCD like ChiselTest?

@zhutmost
Copy link

zhutmost commented Jul 8, 2024

A simple answer is: yes

@HakamAtassi
Copy link
Author

A simple answer is: yes

How? Is there a native way of doing that or does it involve tywaves?

@zhutmost
Copy link

zhutmost commented Jul 8, 2024

Enable traceEnabled when yourunElaboratedModule during simulation. See

traceEnabled: Boolean = false,

And I have some wrapper code to make it much easier. See my example here.

@jackkoenig
Copy link
Contributor

It's not exposed with the existing EphemeralSimulator, but there is work towards simpler user APIs like #4209 which should make this easier.

@edwardcwang
Copy link
Contributor

On vanilla Chisel 6.5 this ended up requiring two separate hacks against EphemeralSimulator:

  1. https://github.com/edwardcwang/decoupled-serializer/blob/master/src/main/scala/VCDHackedEphemeralSimulator.scala#L44
    Inserting traceStyle = Some(verilator.Backend.CompilationSettings.TraceStyle.Vcd(traceUnderscore = true)) into the backendSpecificCompilationSettings of the DefaultSimulator.

  2. https://github.com/edwardcwang/decoupled-serializer/blob/master/src/main/scala/VCDHackedEphemeralSimulator.scala#L31
    The above was not enough as it added support for tracing but did not actually call the functions to enable & start the dumping.
    Hacking the simulate() method to insert a call to module.controller.setTraceEnabled(true) to actually enable the dump of the .vcd file.

Third bonus hack: use the local test_run_dir directory (from older versions of Chisel) instead of a temporary one which gets deleted.
https://github.com/edwardcwang/decoupled-serializer/blob/master/src/main/scala/VCDHackedEphemeralSimulator.scala#L61

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

No branches or pull requests

4 participants