diff options
| author | Schuyler Eldridge | 2018-12-19 16:48:10 -0500 |
|---|---|---|
| committer | Schuyler Eldridge | 2018-12-20 11:55:23 -0500 |
| commit | c727961ca6461d90858c4c66d8b01897293fc0ab (patch) | |
| tree | d6da0dfea409d43c2c271fd1de729a88a04da554 | |
| parent | 0cfd0eb27d2b92796c3173e5a34d8f4e954b2911 (diff) | |
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 <schuyler.eldridge@ibm.com>
| -rw-r--r-- | src/main/scala/firrtl/Compiler.scala | 4 |
1 files changed, 4 insertions, 0 deletions
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 |
