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 - simulate a circuit with debug "-g" fitool option #3932

Closed
rameloni opened this issue Mar 14, 2024 · 0 comments · Fixed by #3952
Closed

ChiselSim - simulate a circuit with debug "-g" fitool option #3932

rameloni opened this issue Mar 14, 2024 · 0 comments · Fixed by #3952

Comments

@rameloni
Copy link
Contributor

rameloni commented Mar 14, 2024

I have created a new simulator that uses svsim to output a vcd file with the verilator backend. I used the EphemeralSimulator as starting point.

Now I would like to use the "-g" option for the simulation, however I haven't find any way to do that. It seems it is not possible at the moment. I have seen that the annotations passed to chiselStage.execute are fixed.

implicit class ChiselWorkspace(workspace: Workspace) {
def elaborateGeneratedModule[T <: RawModule](
generateModule: () => T
): ElaboratedModule[T] = {
// Use CIRCT to generate SystemVerilog sources, and potentially additional artifacts
var someDut: Option[T] = None
val outputAnnotations = (new circt.stage.ChiselStage).execute(
Array("--target", "systemverilog", "--split-verilog"),
Seq(
chisel3.stage.ChiselGeneratorAnnotation { () =>
val dut = generateModule()
someDut = Some(dut)
dut
},
circt.stage.FirtoolOption("-disable-annotation-unknown"),
firrtl.options.TargetDirAnnotation(workspace.supportArtifactsPath)
)
)

It would be nice to have something that allows to select optimization options or directly passing firtooloptions like here. Either as a field of workspace or of the simulator or as an argument here.

  def elaborateGeneratedModule[T <: RawModule](
      generateModule: () => T
  )(firtoolArgs: Seq[String] = Seq()): ElaboratedModule[T] = {
    // Use CIRCT to generate SystemVerilog sources, and potentially additional artifacts
    var someDut: Option[T] = None

    val firtoolOptions = firtoolArgs.map(circt.stage.FirtoolOption)

    val outputAnnotations = (new circt.stage.ChiselStage).execute(
      Array("--target", "systemverilog", "--split-verilog"),
      Seq(
        chisel3.stage.ChiselGeneratorAnnotation { () =>
          val dut = generateModule()
          someDut = Some(dut)
          dut
        },
        circt.stage.FirtoolOption("-disable-annotation-unknown"),
        firrtl.options.TargetDirAnnotation(workspace.supportArtifactsPath),
      ) ++
        firtoolOptions,
    ) 
    // ....
  }
rameloni added a commit to rameloni/chisel that referenced this issue Mar 26, 2024
jackkoenig pushed a commit that referenced this issue Mar 27, 2024
…rametric (#3952)

Make Workspace parametric: allow running a simulation in ChiselSim with different firtool options i.e. -g (#3932)
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

Successfully merging a pull request may close this issue.

1 participant