From 1bf80040825e96ce04c15374304c144b9d48e902 Mon Sep 17 00:00:00 2001 From: Schuyler Eldridge Date: Tue, 21 Apr 2020 22:40:48 -0400 Subject: Add ExpandPrepares wrapper Signed-off-by: Schuyler Eldridge --- .../firrtl/stage/transforms/ExpandPrepares.scala | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/main/scala/firrtl/stage/transforms/ExpandPrepares.scala (limited to 'src') diff --git a/src/main/scala/firrtl/stage/transforms/ExpandPrepares.scala b/src/main/scala/firrtl/stage/transforms/ExpandPrepares.scala new file mode 100644 index 00000000..7a0621e4 --- /dev/null +++ b/src/main/scala/firrtl/stage/transforms/ExpandPrepares.scala @@ -0,0 +1,26 @@ +// See LICENSE for license details. + +package firrtl.stage.transforms + +import firrtl.{CircuitState, Transform} + +class ExpandPrepares(val underlying: Transform) extends Transform with WrappedTransform { + + /* Assert that this is not wrapping other transforms. */ + underlying match { + case _: WrappedTransform => throw new Exception( + s"'ExpandPrepares' must not wrap other 'WrappedTransforms', but wraps '${underlying.getClass.getName}'") + case _ => + } + + override def execute(c: CircuitState): CircuitState = { + underlying.transform(underlying.prepare(c)) + } + +} + +object ExpandPrepares { + + def apply(a: Transform): ExpandPrepares = new ExpandPrepares(a) + +} -- cgit v1.2.3