如何从凿子代码生成FIRRTL文件?我已经安装了sbt,firrtl和verilator根据github维基。为简单的加法器创建了一个凿子代码。我想要生成FIRRTL并把它隐藏到Verilog身上?我的问题是如何从凿子代码中获取firrtl文件。谢谢。
源文件: MyQueueTest/src/main/scala/example/MyQueueDriver.scala
package example
import chisel3._
import chisel3.util._
class MyQueue extends Module {
val io = IO(new Bundle {
val a = Flipped(Decoupled(UInt(32.W)))
val b = Flipped(Decoupled(UInt(32.W)))
val z = Decoupled(UInt(32.W))
})
val qa = Queue(io.a)
val qb = Queue(io.b)
qa.nodeq()
qb.nodeq()
when (qa.valid && qb.valid && io.z.ready) {
io.z.enq(qa.deq() + qb.deq())
}
}
object MyQueueDriver extends App {
chisel3.Driver.execute(args, () => new MyQueue)
}发布于 2016-11-29 07:42:00
我问了一个类似的问题,这里。解决方案可以是使用提供了这里的完整模板,或者您可以简单地这样做:
在scala源的末尾添加以下行:
object YourModuleDriver extends App {
chisel3.Driver.execute(args, () => new YourModule)
}将"YourModule“替换为模块的名称。
并在源代码的同一个目录中添加一个build.sbt文件,并使用以下行:
scalaVersion := "2.11.8"
resolvers ++= Seq(
Resolver.sonatypeRepo("snapshots"),
Resolver.sonatypeRepo("releases")
)
libraryDependencies += "edu.berkeley.cs" %% "chisel3" % "3.0-SNAPSHOT"要生成FIRRTL和Verilog,只需执行以下操作:
$ sbt "run-main YourModuleDriver"并且FIRRTL (yourmodule.fir) /Verilog (yourmodule.v)源将位于生成的目录中。
https://stackoverflow.com/questions/40858996
复制相似问题