How to emit vcd file when using chisel3.simulator
for testing?
#3957
-
I'm using chisel version // TopTest.scala
package test
import Serial.Top
import chisel3._
import chisel3.simulator.EphemeralSimulator._
import org.scalatest.flatspec.AnyFlatSpec
class TopSpec extends AnyFlatSpec {
behavior of "Top"
it should "do something" in {
simulate(new Top) { top =>
top.clock.step(1)
top.io.rxWire.poke(true.B)
top.clock.step(1)
top.io.rxWire.poke(false.B)
top.clock.step(1)
}
}
} But I cannot find any vcd file generated when Is there anything I am missing? I guess it is related with #3952? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
I was also looking for an answer and here is what I have found: Currently it is not possible to dump vcd files without extending the existing simulator. Existing one is EphemeralSimulator object which uses a DefaultSimulator class which extends SingleBackendSimulator with a verilator.Backend. In the DefaultSimulator class, the backendSpecificCompilationSettings is set to verilator.Backend.CompilationSettings(), which is the default settings. To enable VCD generation, you would need to modify these settings to include:
However, the DefaultSimulator class is private and its settings are not exposed for modification. Therefore, you might need to create your own simulator class that extends SingleBackendSimulator and allows you to specify your own backendSpecificCompilationSettings. It is unfortunate that chisel-template is using svsim. Mostly new users use the template and they do not know anything about chisel test frameworks. I also assume most users expect at least a traditional testing framework that supports waveforms. So, offering a half-done simulator with a subpar functionality is doing more bad than good for the adoption of Chisel. |
Beta Was this translation helpful? Give feedback.
-
I also find a demo here: https://github.com/rameloni/tywaves-chisel-demo |
Beta Was this translation helpful? Give feedback.
-
The missing thing is an object like |
Beta Was this translation helpful? Give feedback.
-
I recently updated For general usage you can make use of While |
Beta Was this translation helpful? Give feedback.
-
Adding a solution for vanilla Chisel 6.5 if we want to avoid importing any additional libraries beyond just Chisel. |
Beta Was this translation helpful? Give feedback.
I was also looking for an answer and here is what I have found:
Currently it is not possible to dump vcd files without extending the existing simulator. Existing one is EphemeralSimulator object which uses a DefaultSimulator class which extends SingleBackendSimulator with a verilator.Backend.
https://github.com/chipsalliance/chisel/blob/ce05462c239deec8aee0704efbd3a71e8b64ec49/src/main/scala/chisel3/simulator/EphemeralSimulator.scala
In the DefaultSimulator class, the backendSpecificCompilationSettings is set to verilator.Backend.CompilationSettings(), which is the default settings. To enable VCD generation, you would need to modify these settings to include: