Last active
February 19, 2022 22:07
-
-
Save seldridge/9155a10b6b8e0350b5a1d046818d1664 to your computer and use it in GitHub Desktop.
Example of running the Scala FIRRTL compiler and the MLIR FIRRTL compiler on the same Chisel hardware description using scala-cli. This requires an installation of CIRCT, i.e., `firtool` must be on your `$PATH`.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//> using scala "2.13" | |
//> using lib "edu.berkeley.cs::chisel3:3.5.1" | |
//> using lib "com.sifive::chisel-circt:0.3.0" | |
//> using mainClass "Foo" | |
import chisel3._ | |
import chisel3.stage.{ChiselStage => SFC} | |
import circt.stage.{ChiselStage => MFC} | |
class Foo extends RawModule { | |
val a, b, c, d, e = IO(Input(Bool())) | |
val out1, out2 = IO(Output(Bool())) | |
val x = a ^ b ^ c ^ d ^ e | |
val y = a ^ b ^ c ^ d | |
dontTouch(x) | |
dontTouch(y) | |
out1 := x | |
out2 := y | |
} | |
object Foo extends App { | |
println(SFC.emitVerilog(new Foo)) | |
println(MFC.emitSystemVerilog(new Foo)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment