blob: 5881001f3445686421a5a4f57372cd9db6483f5e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
// See LICENSE for license details.
package firrtl
package annotations
import firrtl.ir._
case class AnnotationException(message: String) extends Exception(message)
final case class Annotation(target: Named, transform: Class[_ <: Transform], value: String) {
val targetString: String = target.serialize
val transformClass: String = transform.getName
def serialize: String = this.toString
def update(tos: Seq[Named]): Seq[Annotation] = {
check(target, tos, this)
propagate(target, tos, duplicate)
}
def propagate(from: Named, tos: Seq[Named], dup: Named=>Annotation): Seq[Annotation] = tos.map(dup(_))
def check(from: Named, tos: Seq[Named], which: Annotation): Unit = {}
def duplicate(n: Named) = new Annotation(n, transform, value)
}
|