summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests
diff options
context:
space:
mode:
authorMartin Schoeberl2021-06-16 19:33:26 +0200
committerGitHub2021-06-16 17:33:26 +0000
commita3ddd4b98049b624080422717c6822ec9ab43e07 (patch)
tree89113a35672b3f00ae0dccdca0bfa09d1df2c42d /src/test/scala/chiselTests
parent1db0a3552ae697efdb8e8b7f59d45b67db80675e (diff)
getVerilog in Chisel3 (#1921)
Diffstat (limited to 'src/test/scala/chiselTests')
-rw-r--r--src/test/scala/chiselTests/Module.scala13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/Module.scala b/src/test/scala/chiselTests/Module.scala
index bc9c524a..7703e876 100644
--- a/src/test/scala/chiselTests/Module.scala
+++ b/src/test/scala/chiselTests/Module.scala
@@ -8,6 +8,8 @@ import chisel3.stage.{ChiselGeneratorAnnotation, ChiselStage, NoRunFirrtlCompile
import firrtl.annotations.NoTargetAnnotation
import firrtl.options.Unserializable
+import scala.io.Source
+
class SimpleIO extends Bundle {
val in = Input(UInt(32.W))
val out = Output(UInt(32.W))
@@ -187,4 +189,15 @@ class ModuleSpec extends ChiselPropSpec with Utils {
}
ChiselStage.elaborate(new RawModule with Foo)
}
+
+ property("getVerilogString(new PlusOne() should produce a valid Verilog string") {
+ val s = getVerilogString(new PlusOne())
+ assert(s.contains("assign io_out = io_in + 32'h1"))
+ }
+
+ property("emitVerilog((new PlusOne()..) shall produce a valid Verilog file in a subfolder") {
+ emitVerilog(new PlusOne(), Array("--target-dir", "generated"))
+ val s = Source.fromFile("generated/PlusOne.v").mkString("")
+ assert(s.contains("assign io_out = io_in + 32'h1"))
+ }
}