summaryrefslogtreecommitdiff
path: root/src/test/scala/chiselTests/BlackBox.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/scala/chiselTests/BlackBox.scala')
-rw-r--r--src/test/scala/chiselTests/BlackBox.scala20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/BlackBox.scala b/src/test/scala/chiselTests/BlackBox.scala
index 983039c5..27895a54 100644
--- a/src/test/scala/chiselTests/BlackBox.scala
+++ b/src/test/scala/chiselTests/BlackBox.scala
@@ -25,6 +25,14 @@ class BlackBoxPassthrough extends BlackBox {
})
}
+// Test Flip on top-level IO
+class BlackBoxPassthrough2 extends BlackBox {
+ val io = IO(Flipped(new Bundle() {
+ val in = Output(Bool())
+ val out = Input(Bool())
+ }))
+}
+
class BlackBoxRegister extends BlackBox {
val io = IO(new Bundle() {
val clock = Input(Clock())
@@ -45,6 +53,14 @@ class BlackBoxTester extends BasicTester {
stop()
}
+class BlackBoxFlipTester extends BasicTester {
+ val blackBox = Module(new BlackBoxPassthrough2)
+
+ blackBox.io.in := 1.U
+ assert(blackBox.io.out === 1.U)
+ stop()
+}
+
/** Instantiate multiple BlackBoxes with similar interfaces but different
* functionality. Used to detect failures in BlackBox naming and module
* deduplication.
@@ -140,6 +156,10 @@ class BlackBoxSpec extends ChiselFlatSpec {
assertTesterPasses({ new BlackBoxTester },
Seq("/chisel3/BlackBoxTest.v"))
}
+ "A BlackBoxed with flipped IO" should "work" in {
+ assertTesterPasses({ new BlackBoxFlipTester },
+ Seq("/chisel3/BlackBoxTest.v"))
+ }
"Multiple BlackBoxes" should "work" in {
assertTesterPasses({ new MultiBlackBoxTester },
Seq("/chisel3/BlackBoxTest.v"))