From 7be9b1c681558695b95fccb22a60c34101c86118 Mon Sep 17 00:00:00 2001 From: Richard Lin Date: Wed, 7 Feb 2018 12:04:09 -0800 Subject: Better support for autoclonetype of nested Bundles (#769) * Better support for autoclonetype of nested Bundles * Move bundleStack to dynamicContext * prefer $outer if available, make guesses distinct * Catch IllegalAccessException in autoclonetype In strange circumstances this type of exception can occur when accessing $outer --- src/test/scala/chiselTests/AutoNestedCloneSpec.scala | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/test/scala/chiselTests/AutoNestedCloneSpec.scala b/src/test/scala/chiselTests/AutoNestedCloneSpec.scala index 746780be..236de101 100644 --- a/src/test/scala/chiselTests/AutoNestedCloneSpec.scala +++ b/src/test/scala/chiselTests/AutoNestedCloneSpec.scala @@ -89,6 +89,19 @@ class AutoNestedCloneSpec extends ChiselFlatSpec with Matchers { } } + it should "clone a double-nested anonymous Bundle" in { + elaborate { + class TestModule() extends Module { + val io = IO(new Bundle { + val inner = Input(new Bundle { + val x = UInt(8.W) + }) + }) + } + new TestModule() + } + } + behavior of "anonymous doubly-nested inner bundle fails with clear error" ( the[ChiselException] thrownBy { elaborate { @@ -104,5 +117,4 @@ class AutoNestedCloneSpec extends ChiselFlatSpec with Matchers { new Outer(2) } }).getMessage should include("Unable to determine instance") - } -- cgit v1.2.3