From c727961ca6461d90858c4c66d8b01897293fc0ab Mon Sep 17 00:00:00 2001 From: Schuyler Eldridge Date: Wed, 19 Dec 2018 16:48:10 -0500 Subject: Require transforms.size >= 1 for Compilers This adds a requirement that all Compilers must have at least one Transform. Without this, there is no way to determine the inputForm or outputForm of a given compiler as these are (rightly) defined in terms of the head/last transform. Signed-off-by: Schuyler Eldridge --- src/main/scala/firrtl/Compiler.scala | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/main/scala/firrtl/Compiler.scala b/src/main/scala/firrtl/Compiler.scala index 80ba42c4..87662800 100644 --- a/src/main/scala/firrtl/Compiler.scala +++ b/src/main/scala/firrtl/Compiler.scala @@ -373,6 +373,10 @@ trait Compiler extends LazyLogging { */ def transforms: Seq[Transform] + require(transforms.size >= 1, + s"Compiler transforms for '${this.getClass.getName}' must have at least ONE Transform! " + + "Use IdentityTransform if you need an identity/no-op transform.") + // Similar to (input|output)Form on [[Transform]] but derived from this Compiler's transforms def inputForm: CircuitForm = transforms.head.inputForm def outputForm: CircuitForm = transforms.last.outputForm -- cgit v1.2.3