summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJack Koenig2021-07-08 15:30:28 -0700
committerGitHub2021-07-08 15:30:28 -0700
commit16c0b53e04f3a78ddaaa382936cd660523a57199 (patch)
tree789eb837a11e71c51de86711dee556f47f79a4f6 /src
parentbb520b8573328fda5f7b3c3892e6995fbe1b4239 (diff)
Fix chisel3 <> for Bundles that contain compatibility Bundles (#2023)
BiConnect in chisel3 delegates to FIRRTL <- semantics whenever it hits a Bundle defined in `import Chisel._`. Because chisel3 <> is commutative it needs to be mindful of flippedness when emitting a FIRRTL <- (which is *not* commutative).
Diffstat (limited to 'src')
-rw-r--r--src/test/scala/chiselTests/CompatibilityInteroperabilitySpec.scala38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/CompatibilityInteroperabilitySpec.scala b/src/test/scala/chiselTests/CompatibilityInteroperabilitySpec.scala
index cfcc4608..8e9f9e7e 100644
--- a/src/test/scala/chiselTests/CompatibilityInteroperabilitySpec.scala
+++ b/src/test/scala/chiselTests/CompatibilityInteroperabilitySpec.scala
@@ -289,5 +289,43 @@ class CompatibiltyInteroperabilitySpec extends ChiselFlatSpec {
}
}
}
+
+ "A chisel3 Bundle that instantiates a Chisel Bundle" should "bulk connect correctly" in {
+ compile {
+ object Compat {
+ import Chisel._
+ class Foo extends Bundle {
+ val a = Input(UInt(8.W))
+ val b = Output(UInt(8.W))
+ }
+ }
+ import chisel3._
+ import Compat._
+ class Bar extends Bundle {
+ val foo1 = new Foo
+ val foo2 = Flipped(new Foo)
+ }
+ // Check every connection both ways to see that chisel3 <>'s commutativity holds
+ class Child extends RawModule {
+ val deq = IO(new Bar)
+ val enq = IO(Flipped(new Bar))
+ enq <> deq
+ deq <> enq
+ }
+ new RawModule {
+ val deq = IO(new Bar)
+ val enq = IO(Flipped(new Bar))
+ // Also important to check connections to child ports
+ val c1 = Module(new Child)
+ val c2 = Module(new Child)
+ c1.enq <> enq
+ enq <> c1.enq
+ c2.enq <> c1.deq
+ c1.deq <> c2.enq
+ deq <> c2.deq
+ c2.deq <> deq
+ }
+ }
+ }
}