blob: dcd5b03198c1e5540c3c51f7db72bbbd17db6ecd (
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
27
28
|
// SPDX-License-Identifier: Apache-2.0
package firrtl.options.phases
import firrtl.AnnotationSeq
import firrtl.options.{Dependency, Phase, 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 {
override def prerequisites = Seq(Dependency[GetIncludes])
override def optionalPrerequisiteOf = Seq.empty
override def invalidates(a: Phase) = false
def transform(annotations: AnnotationSeq): AnnotationSeq = {
val td = annotations.collectFirst { case a: TargetDirAnnotation => a }.isEmpty
(if (td) Seq(TargetDirAnnotation()) else Seq()) ++
annotations
}
}
|