From 1f8a5862c9b1642757af9f2dc0a34532c0a342a6 Mon Sep 17 00:00:00 2001 From: Richard Lin Date: Mon, 25 Mar 2019 14:04:31 -0700 Subject: Check field referential equality in autoclonetype (#1047) --- src/test/scala/chiselTests/AutoClonetypeSpec.scala | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src') diff --git a/src/test/scala/chiselTests/AutoClonetypeSpec.scala b/src/test/scala/chiselTests/AutoClonetypeSpec.scala index 75fb46b8..e533eb94 100644 --- a/src/test/scala/chiselTests/AutoClonetypeSpec.scala +++ b/src/test/scala/chiselTests/AutoClonetypeSpec.scala @@ -172,4 +172,29 @@ class AutoClonetypeSpec extends ChiselFlatSpec { val a = WireDefault(io) } } } + + "Aliased fields" should "be caught" in { + a [ChiselException] should be thrownBy { + elaborate { new Module { + val bundleFieldType = UInt(8.W) + val io = IO(Output(new Bundle { + val a = bundleFieldType + })) + io.a := 0.U + } } + } + } + + "Aliased fields from inadequate autoclonetype" should "be caught" in { + a [ChiselException] should be thrownBy { + class BadBundle(val typeTuple: (Data, Int)) extends Bundle { + val a = typeTuple._1 + } + + elaborate { new Module { + val io = IO(Output(new BadBundle(UInt(8.W), 1))) + io.a := 0.U + } } + } + } } -- cgit v1.2.3