From 1bfca502c69a26edca86d716a1ca9d24e6789e59 Mon Sep 17 00:00:00 2001 From: Richard Lin Date: Fri, 2 Feb 2018 23:30:56 -0800 Subject: Autoclonetype will clone args that are of type data (#768) --- src/test/scala/chiselTests/AutoClonetypeSpec.scala | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/test') diff --git a/src/test/scala/chiselTests/AutoClonetypeSpec.scala b/src/test/scala/chiselTests/AutoClonetypeSpec.scala index 1170ed12..0b02c3ab 100644 --- a/src/test/scala/chiselTests/AutoClonetypeSpec.scala +++ b/src/test/scala/chiselTests/AutoClonetypeSpec.scala @@ -47,6 +47,9 @@ class ModuleWithInner extends Module { require(myWire.i == 14) } +// A Bundle with an argument that is also a field. +// Not necessarily good style (and not necessarily recommended), but allowed to preserve compatibility. +class BundleWithArgumentField(val x: Data, val y: Data) extends Bundle class AutoClonetypeSpec extends ChiselFlatSpec { "Bundles with Scala args" should "not need clonetype" in { @@ -112,4 +115,12 @@ class AutoClonetypeSpec extends ChiselFlatSpec { "Inner bundles with Scala args" should "not need clonetype" in { elaborate { new ModuleWithInner } } + + "Bundles with arguments as fields" should "not need clonetype" in { + elaborate { new Module { + val io = IO(Output(new BundleWithArgumentField(UInt(8.W), UInt(8.W)))) + io.x := 1.U + io.y := 1.U + } } + } } -- cgit v1.2.3