blob: 790891946599b96d3f1f97f697cc962e4cdcfee9 (
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.{Dependency, Phase, PreservesAll, 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.
*/
class AddDefaults extends Phase with PreservesAll[Phase] {
override def prerequisites = Seq(Dependency[GetIncludes], Dependency[ConvertLegacyAnnotations])
override def optionalPrerequisiteOf = Seq.empty
def transform(annotations: AnnotationSeq): AnnotationSeq = {
val td = annotations.collectFirst{ case a: TargetDirAnnotation => a}.isEmpty
(if (td) Seq(TargetDirAnnotation()) else Seq()) ++
annotations
}
}
|