diff options
| author | chick | 2020-08-14 19:47:53 -0700 |
|---|---|---|
| committer | Jack Koenig | 2020-08-14 19:47:53 -0700 |
| commit | 6fc742bfaf5ee508a34189400a1a7dbffe3f1cac (patch) | |
| tree | 2ed103ee80b0fba613c88a66af854ae9952610ce /src/test/scala/firrtlTests/CustomTransformSpec.scala | |
| parent | b516293f703c4de86397862fee1897aded2ae140 (diff) | |
All of src/ formatted with scalafmt
Diffstat (limited to 'src/test/scala/firrtlTests/CustomTransformSpec.scala')
| -rw-r--r-- | src/test/scala/firrtlTests/CustomTransformSpec.scala | 71 |
1 files changed, 36 insertions, 35 deletions
diff --git a/src/test/scala/firrtlTests/CustomTransformSpec.scala b/src/test/scala/firrtlTests/CustomTransformSpec.scala index 3e5fd254..6edd212d 100644 --- a/src/test/scala/firrtlTests/CustomTransformSpec.scala +++ b/src/test/scala/firrtlTests/CustomTransformSpec.scala @@ -19,28 +19,28 @@ object CustomTransformSpec { class ReplaceExtModuleTransform extends SeqTransform with FirrtlMatchers { // Simple module val delayModuleString = """ - |circuit Delay : - | module Delay : - | input clock : Clock - | input reset : UInt<1> - | input a : UInt<32> - | input en : UInt<1> - | output b : UInt<32> - | - | reg r : UInt<32>, clock - | r <= r - | when en : - | r <= a - | b <= r - |""".stripMargin + |circuit Delay : + | module Delay : + | input clock : Clock + | input reset : UInt<1> + | input a : UInt<32> + | input en : UInt<1> + | output b : UInt<32> + | + | reg r : UInt<32>, clock + | r <= r + | when en : + | r <= a + | b <= r + |""".stripMargin val delayModuleCircuit = parse(delayModuleString) val delayModule = delayModuleCircuit.modules.find(_.name == delayModuleCircuit.main).get class ReplaceExtModule extends Pass { def run(c: Circuit): Circuit = c.copy( - modules = c.modules map { + modules = c.modules.map { case ExtModule(_, "Delay", _, _, _) => delayModule - case other => other + case other => other } ) } @@ -50,10 +50,10 @@ object CustomTransformSpec { } val input = """ - |circuit test : - | module test : - | output out : UInt - | out <= UInt(123)""".stripMargin + |circuit test : + | module test : + | output out : UInt + | out <= UInt(123)""".stripMargin val errorString = "My Custom Transform failed!" class ErroringTransform extends Transform { def inputForm = HighForm @@ -122,7 +122,7 @@ class CustomTransformSpec extends FirrtlFlatSpec { import CustomTransformSpec._ - behavior of "Custom Transforms" + behavior.of("Custom Transforms") they should "be able to introduce high firrtl" in { runFirrtlTest("CustomTransform", "/features", customTransforms = List(new ReplaceExtModuleTransform)) @@ -130,22 +130,24 @@ class CustomTransformSpec extends FirrtlFlatSpec { they should "not cause \"Internal Errors\"" in { val optionsManager = new ExecutionOptionsManager("test") with HasFirrtlOptions { - firrtlOptions = FirrtlExecutionOptions( - firrtlSource = Some(input), - customTransforms = List(new ErroringTransform)) + firrtlOptions = FirrtlExecutionOptions(firrtlSource = Some(input), customTransforms = List(new ErroringTransform)) } - (the [java.lang.IllegalArgumentException] thrownBy { + (the[java.lang.IllegalArgumentException] thrownBy { Driver.execute(optionsManager) - }).getMessage should include (errorString) + }).getMessage should include(errorString) } they should "preserve the input order" in { - runFirrtlTest("CustomTransform", "/features", customTransforms = List( - new FirstTransform, - new SecondTransform, - new ThirdTransform, - new ReplaceExtModuleTransform - )) + runFirrtlTest( + "CustomTransform", + "/features", + customTransforms = List( + new FirstTransform, + new SecondTransform, + new ThirdTransform, + new ReplaceExtModuleTransform + ) + ) } they should "run right before the emitter* when inputForm=LowForm" in { @@ -159,11 +161,10 @@ class CustomTransformSpec extends FirrtlFlatSpec { val custom = Dependency[IdentityLowForm] val tm = new firrtl.stage.transforms.Compiler(custom :: emitter :: Nil) info(s"when using ${emitter.getObject.name}") - tm - .flattenedTransformOrder + tm.flattenedTransformOrder .map(Dependency.fromTransform) .sliding(2) - .toList should contain (Seq(custom, emitter)) + .toList should contain(Seq(custom, emitter)) } } |
