From d359b47a461dd84937d1655803ddfae955da6a4e Mon Sep 17 00:00:00 2001 From: Jack Koenig Date: Tue, 30 May 2017 11:25:11 -0700 Subject: Dont try to instantiate firrtl.Transform from Annotation Also make transform instantiation deterministic --- src/main/scala/chisel3/Driver.scala | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/main/scala/chisel3/Driver.scala b/src/main/scala/chisel3/Driver.scala index 8a2256df..f3ba6534 100644 --- a/src/main/scala/chisel3/Driver.scala +++ b/src/main/scala/chisel3/Driver.scala @@ -146,10 +146,16 @@ object Driver extends BackendCompilationUtilities { af.write(circuit.annotations.toArray.toYaml.prettyPrint) af.close() - /* create custom transforms by finding the set of transform classes associated with annotations - * then instantiate them into actual transforms - */ - val transforms = circuit.annotations.map(_.transform).toSet.map { transformClass: Class[_ <: Transform] => + /** Find the set of transform classes associated with annotations then + * instantiate an instance of each transform + * @note Annotations targeting firrtl.Transform will not result in any + * transform being instantiated + */ + val transforms = circuit.annotations + .map(_.transform) + .distinct + .filterNot(_ == classOf[firrtl.Transform]) + .map { transformClass: Class[_ <: Transform] => transformClass.newInstance() } /* This passes the firrtl source and annotations directly to firrtl */ -- cgit v1.2.3