From 1494231212425fd09f915d819102ca5cdef0dfcf Mon Sep 17 00:00:00 2001 From: Jack Koenig Date: Thu, 11 Feb 2021 18:12:48 -0800 Subject: [plugin] Implement autoclonetype in the compiler plugin --- .../test/scala/chiselTests/AutoClonetypeSpec.scala | 1 + .../scala/chiselTests/AutoNestedCloneSpec.scala | 1 + .../MissingCloneBindingExceptionSpec.scala | 55 ++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 120000 no-plugin-tests/src/test/scala/chiselTests/AutoClonetypeSpec.scala create mode 120000 no-plugin-tests/src/test/scala/chiselTests/AutoNestedCloneSpec.scala create mode 100644 no-plugin-tests/src/test/scala/chiselTests/MissingCloneBindingExceptionSpec.scala (limited to 'no-plugin-tests/src') diff --git a/no-plugin-tests/src/test/scala/chiselTests/AutoClonetypeSpec.scala b/no-plugin-tests/src/test/scala/chiselTests/AutoClonetypeSpec.scala new file mode 120000 index 00000000..ae3a7597 --- /dev/null +++ b/no-plugin-tests/src/test/scala/chiselTests/AutoClonetypeSpec.scala @@ -0,0 +1 @@ +../../../../../src/test/scala/chiselTests/AutoClonetypeSpec.scala \ No newline at end of file diff --git a/no-plugin-tests/src/test/scala/chiselTests/AutoNestedCloneSpec.scala b/no-plugin-tests/src/test/scala/chiselTests/AutoNestedCloneSpec.scala new file mode 120000 index 00000000..4ff3aa4f --- /dev/null +++ b/no-plugin-tests/src/test/scala/chiselTests/AutoNestedCloneSpec.scala @@ -0,0 +1 @@ +../../../../../src/test/scala/chiselTests/AutoNestedCloneSpec.scala \ No newline at end of file diff --git a/no-plugin-tests/src/test/scala/chiselTests/MissingCloneBindingExceptionSpec.scala b/no-plugin-tests/src/test/scala/chiselTests/MissingCloneBindingExceptionSpec.scala new file mode 100644 index 00000000..28673495 --- /dev/null +++ b/no-plugin-tests/src/test/scala/chiselTests/MissingCloneBindingExceptionSpec.scala @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: Apache-2.0 + +package chiselTests +import Chisel.ChiselException +import chisel3.stage.ChiselStage +import org.scalatest._ +import org.scalatest.matchers.should.Matchers + +class MissingCloneBindingExceptionSpec extends ChiselFlatSpec with Matchers with Utils { + behavior of "missing cloneType in Chisel3" + ( the [ChiselException] thrownBy extractCause[ChiselException] { + import chisel3._ + + class Test extends Module { + class TestIO(w: Int) extends Bundle { + val a = Input(Vec(4, UInt(w.W))) + } + + val io = IO(new TestIO(32)) + } + + class TestTop extends Module { + val io = IO(new Bundle {}) + + val subs = VecInit(Seq.fill(2) { + Module(new Test).io + }) + } + + ChiselStage.elaborate(new TestTop) + }).getMessage should include("make all parameters immutable") + + behavior of "missing cloneType in Chisel2" + ( the [ChiselException] thrownBy extractCause[ChiselException] { + import Chisel._ + + class Test extends Module { + class TestIO(w: Int) extends Bundle { + val a = Vec(4, UInt(width = w)).asInput + } + + val io = IO(new TestIO(32)) + } + + class TestTop extends Module { + val io = IO(new Bundle {}) + + val subs = Vec.fill(2) { + Module(new Test).io + } + } + + ChiselStage.elaborate(new TestTop) + }).getMessage should include("make all parameters immutable") +} -- cgit v1.2.3