summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests
diff options
context:
space:
mode:
authorJack Koenig2017-12-19 17:33:07 -0800
committerGitHub2017-12-19 17:33:07 -0800
commitd95cb262aefc06458652b227980a3cdc5471d3ba (patch)
tree01c543cb66ae221f648e57909a1c29ea6e9456b8 /src/test/scala/chiselTests
parentd67914ffd4b983903f777c5c033ce84fbdb561f1 (diff)
Add WireInit.apply that accepts DontCare (#731)
Prevents DontCare from affecting type inference Fixes #728
Diffstat (limited to 'src/test/scala/chiselTests')
-rw-r--r--src/test/scala/chiselTests/WireSpec.scala20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/WireSpec.scala b/src/test/scala/chiselTests/WireSpec.scala
new file mode 100644
index 00000000..051880ee
--- /dev/null
+++ b/src/test/scala/chiselTests/WireSpec.scala
@@ -0,0 +1,20 @@
+// See LICENSE for license details.
+
+package chiselTests
+
+import chisel3._
+
+class WireSpec extends ChiselFlatSpec {
+ "WireInit.apply" should "work" in {
+ assertCompiles("WireInit(UInt(4.W), 2.U)")
+ }
+ it should "allow DontCare" in {
+ assertCompiles("WireInit(UInt(4.W), DontCare)")
+ }
+ it should "not allow DontCare to affect type inference" in {
+ assertCompiles("val x: UInt = WireInit(UInt(4.W), DontCare)")
+ }
+ it should "not allow init argument to affect type inference" in {
+ assertDoesNotCompile("val x: UInt = WireInit(UInt(4.W), 2.S)")
+ }
+}