Skip to content

Commit 541ec36

Browse files
authored
Overload Stage methods to use Seq[Annotation] (#5030)
Also deprecate the older forms using AnnotationSeq.
1 parent 77c03ed commit 541ec36

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

firrtl/src/main/scala/firrtl/options/Stage.scala

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
package firrtl.options
44

5-
import firrtl.{seqToAnnoSeq, AnnotationSeq}
5+
import firrtl.{annoSeqToSeq, seqToAnnoSeq, AnnotationSeq}
6+
import firrtl.annotations.Annotation
67

78
import logger.Logger
89

@@ -31,7 +32,17 @@ abstract class Stage extends Phase {
3132
* @return output annotations
3233
* @throws firrtl.options.OptionsException if command line or annotation validation fails
3334
*/
35+
@deprecated("Use the form that taks Seq[Annotation]", "Chisel 7.1.0")
3436
final def transform(annotations: AnnotationSeq): AnnotationSeq = {
37+
seqToAnnoSeq(transform(annotations.toSeq))
38+
}
39+
40+
/** Execute this stage on some input annotations. Annotations will be read from any input annotation files.
41+
* @param annotations input annotations
42+
* @return output annotations
43+
* @throws firrtl.options.OptionsException if command line or annotation validation fails
44+
*/
45+
final def transform(annotations: Seq[Annotation]): Seq[Annotation] = {
3546
val annotationsx =
3647
Seq(new phases.GetIncludes)
3748
.foldLeft(annotations)((a, p) => p.transform(a))
@@ -53,9 +64,18 @@ abstract class Stage extends Phase {
5364
* @return output annotations
5465
* @throws firrtl.options.OptionsException if command line or annotation validation fails
5566
*/
67+
@deprecated("Use the form that taks Seq[Annotation]", "Chisel 7.1.0")
5668
final def execute(args: Array[String], annotations: AnnotationSeq): AnnotationSeq =
57-
transform(shell.parse(args, annotations))
69+
seqToAnnoSeq(execute(args, annotations.toSeq))
5870

71+
/** Run this stage on on a mix of arguments and annotations
72+
* @param args command line arguments
73+
* @param initialAnnotations annotation
74+
* @return output annotations
75+
* @throws firrtl.options.OptionsException if command line or annotation validation fails
76+
*/
77+
final def execute(args: Array[String], annotations: Seq[Annotation]): Seq[Annotation] =
78+
transform(shell.parse(args, annotations))
5979
}
6080

6181
/** Provides a main method for a [[Stage]]

0 commit comments

Comments
 (0)