diff options
| author | Richard Lin | 2019-03-25 14:04:31 -0700 |
|---|---|---|
| committer | GitHub | 2019-03-25 14:04:31 -0700 |
| commit | 1f8a5862c9b1642757af9f2dc0a34532c0a342a6 (patch) | |
| tree | 0963b2b43d887ff71f0ffc05c25b90fc76afb02f /src | |
| parent | 9cc5a7d567e4a3038dbb2f603aa44d1d435967a1 (diff) | |
Check field referential equality in autoclonetype (#1047)
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/scala/chiselTests/AutoClonetypeSpec.scala | 25 |
1 files changed, 25 insertions, 0 deletions
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 + } } + } + } } |
