blob: f0749b22c6f8d270fe82d11662e6824f3f382734 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
// See LICENSE for license details.
package firrtl.options.phases
import firrtl.AnnotationSeq
import firrtl.options.{Phase, StageOption, TargetDirAnnotation}
/** Add default annotations for a [[Stage]]
*
* This currently only adds a [[TargetDirAnnotation]]. This isn't necessary for a [[StageOptionsView]], but downstream
* tools may expect a [[TargetDirAnnotation]] to exist.
*/
object AddDefaults extends Phase {
def transform(annotations: AnnotationSeq): AnnotationSeq = {
var td = true
annotations.collect { case a: StageOption => a }.map {
case _: TargetDirAnnotation => td = false
case _ =>
}
(if (td) Seq(TargetDirAnnotation()) else Seq()) ++
annotations
}
}
|