diff options
| author | Albert Magyar | 2019-11-18 12:14:45 -0700 |
|---|---|---|
| committer | GitHub | 2019-11-18 12:14:45 -0700 |
| commit | f817260a6bd6b3f5681ef14eb4a9a448237201e3 (patch) | |
| tree | 51b4a906f004225f7c83aa401cce27a7c5fbbc58 /src/test | |
| parent | 54dc03c95e4ead3e25499b00e54fefd8b654f439 (diff) | |
| parent | 5e6d985b27e283868bc2b990c8b6a5888c74422a (diff) | |
Merge branch 'master' into automate-backports
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/scala/firrtlTests/CustomTransformSpec.scala | 27 |
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) + } +} |
