summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/Direction.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/scala/chiselTests/Direction.scala')
-rw-r--r--src/test/scala/chiselTests/Direction.scala16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/Direction.scala b/src/test/scala/chiselTests/Direction.scala
index 83ef7088..9b353840 100644
--- a/src/test/scala/chiselTests/Direction.scala
+++ b/src/test/scala/chiselTests/Direction.scala
@@ -8,21 +8,34 @@ import org.scalatest.matchers._
import org.scalatest.prop._
import chisel3.testers.BasicTester
+class DirectionedBundle extends Bundle {
+ val in = Input(UInt(32.W))
+ val out = Output(UInt(32.W))
+}
+
class DirectionHaver extends Module {
val io = IO(new Bundle {
val in = Input(UInt(32.W))
val out = Output(UInt(32.W))
+ val inBundle = Input(new DirectionedBundle) // should override elements
+ val outBundle = Output(new DirectionedBundle) // should override elements
})
}
class GoodDirection extends DirectionHaver {
io.out := 0.U
+ io.outBundle.in := 0.U
+ io.outBundle.out := 0.U
}
class BadDirection extends DirectionHaver {
io.in := 0.U
}
+class BadSubDirection extends DirectionHaver {
+ io.inBundle.out := 0.U
+}
+
class DirectionSpec extends ChiselPropSpec with Matchers {
//TODO: In Chisel3 these are actually FIRRTL errors. Remove from tests?
@@ -35,5 +48,8 @@ class DirectionSpec extends ChiselPropSpec with Matchers {
a[Exception] should be thrownBy {
elaborate(new BadDirection)
}
+ a[Exception] should be thrownBy {
+ elaborate(new BadSubDirection)
+ }
}
}