【问题标题】:how to set generated directory of emitVerilog?如何设置 emitVerilog 的生成目录?
【发布时间】:2021-05-26 00:17:59
【问题描述】:

我刚开始使用凿模板。

我根据 stackoverflow post 在 DecoupledGCD.scala 中添加了以下语句。

object DecoupledGcdDriver extends App {
    (new ChiselStage)emitVerilog(new DecoupledGcd(16))
}

我跑的时候

sbt run

verilog 文件本身是在当前目录中生成的。

但是我要么跑了

sbt "runMain gcd.DecoupledGcdDriver --help"

sbt "runMain gcd.DecoupledGcdDriver --target-dir <my dir>"

不会改变任何东西。

我的 build.sbt 来自最新的模板:

ThisBuild / scalaVersion     := "2.12.13"
ThisBuild / version          := "0.1.0"
ThisBuild / organization     := "com.github.riggy2013"

lazy val root = (project in file("."))
  .settings(
    name := "chisel-gcd",
    libraryDependencies ++= Seq(
      "edu.berkeley.cs" %% "chisel3" % "3.4.3",
      "edu.berkeley.cs" %% "chiseltest" % "0.3.3" % "test"

我没有足够的“声誉”,所以在这里开始一个新线程。

【问题讨论】:

    标签: chisel


    【解决方案1】:

    将参数设置为对ChiselStage 的调用。下面是一个例子。这会将 Verilog 和 FIRRTL 放在输出目录中。如果输出目录不存在,将创建它。

    object MyAsyncResetModuleGen extends App {  
      val myverilog = (new ChiselStage).emitVerilog(
        new MyAsyncResetModule,
         
        //args
        Array("--target-dir", "output/")
      )
    }
    

    【讨论】:

      【解决方案2】:

      扩展App 只是编写带有args: Array[String] 参数的main 函数的语法糖。如果您希望参数传播到ChiseStage,则需要传播它们:

      object DecoupledGcdDriver extends App {
          (new ChiselStage)emitVerilog(new DecoupledGcd(16), args)
      }
      

      您可以看到ChiselStage.emitVerilogChisel API Docs 中接受args

      【讨论】:

        猜你喜欢
        • 2022-08-16
        • 1970-01-01
        • 2017-10-02
        • 1970-01-01
        • 2013-12-16
        • 1970-01-01
        • 2011-08-22
        • 2010-10-16
        • 2011-02-10
        相关资源
        最近更新 更多