aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSchuyler Eldridge2019-11-07 12:40:38 -0500
committerSchuyler Eldridge2019-11-14 13:47:03 -0500
commit4d80f5d41a6cd05838999b7b64389fc053325a18 (patch)
treecbec4a55ed063df50a02d1b0e13dd6aacca628cd /src
parent5373173d055e2916cd8867fd91dee7251192ebc9 (diff)
Add test with Transform inside object
Signed-off-by: Schuyler Eldridge <schuyler.eldridge@ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/test/scala/firrtlTests/CustomTransformSpec.scala27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/test/scala/firrtlTests/CustomTransformSpec.scala b/src/test/scala/firrtlTests/CustomTransformSpec.scala
index 1b0e8190..e0ed6fdb 100644
--- a/src/test/scala/firrtlTests/CustomTransformSpec.scala
+++ b/src/test/scala/firrtlTests/CustomTransformSpec.scala
@@ -6,6 +6,8 @@ import firrtl.ir.Circuit
import firrtl._
import firrtl.passes.Pass
import firrtl.ir._
+import firrtl.annotations.{Annotation, NoTargetAnnotation}
+import firrtl.stage.{FirrtlSourceAnnotation, FirrtlStage, RunFirrtlTransformAnnotation}
class CustomTransformSpec extends FirrtlFlatSpec {
behavior of "Custom Transforms"
@@ -71,5 +73,28 @@ class CustomTransformSpec extends FirrtlFlatSpec {
Driver.execute(optionsManager)
}).getMessage should include (errorString)
}
-}
+ object Foo {
+ class A extends Transform {
+ def inputForm = HighForm
+ def outputForm = HighForm
+ def execute(s: CircuitState) = {
+ println(name)
+ s
+ }
+ }
+ }
+
+ they should "work if placed inside an object" in {
+ val input =
+ """|circuit Foo:
+ | module Foo:
+ | node a = UInt<1>(0)
+ |""".stripMargin
+ val annotations = Seq(
+ RunFirrtlTransformAnnotation(new Foo.A),
+ FirrtlSourceAnnotation(input)
+ )
+ (new FirrtlStage).execute(Array.empty, annotations)
+ }
+}