summaryrefslogtreecommitdiff
path: root/src/test/scala/chisel3/testers/TestUtils.scala
diff options
context:
space:
mode:
authorJack Koenig2021-02-11 18:12:48 -0800
committerJack Koenig2021-03-12 16:16:45 -0800
commit1494231212425fd09f915d819102ca5cdef0dfcf (patch)
tree2828c723f881775bff0978592e07d3d52d78d4a9 /src/test/scala/chisel3/testers/TestUtils.scala
parente80e9a3ba775efd2121b17a39b6d712e1cf8fac2 (diff)
[plugin] Implement autoclonetype in the compiler plugin
Diffstat (limited to 'src/test/scala/chisel3/testers/TestUtils.scala')
-rw-r--r--src/test/scala/chisel3/testers/TestUtils.scala12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/scala/chisel3/testers/TestUtils.scala b/src/test/scala/chisel3/testers/TestUtils.scala
index 12712bf7..c72c779a 100644
--- a/src/test/scala/chisel3/testers/TestUtils.scala
+++ b/src/test/scala/chisel3/testers/TestUtils.scala
@@ -3,10 +3,22 @@
package chisel3.testers
import TesterDriver.Backend
+import chisel3.{Bundle, RawModule}
+import chisel3.internal.firrtl.Circuit
+import chisel3.stage.ChiselStage
import firrtl.AnnotationSeq
object TestUtils {
// Useful because TesterDriver.Backend is chisel3 package private
def containsBackend(annos: AnnotationSeq): Boolean =
annos.collectFirst { case b: Backend => b }.isDefined
+
+ // Allows us to check that the compiler plugin cloneType is actually working
+ val usingPlugin: Boolean = (new Bundle { def check = _usingPlugin }).check
+ def elaborateNoReflectiveAutoCloneType(f: => RawModule): Circuit = {
+ ChiselStage.elaborate {
+ chisel3.internal.Builder.allowReflectiveAutoCloneType = !usingPlugin
+ f
+ }
+ }
}