diff options
| author | Jared Barocsi | 2021-07-14 13:10:15 -0700 |
|---|---|---|
| committer | GitHub | 2021-07-14 13:10:15 -0700 |
| commit | 4081d9f45a30d9f9e5711563b828f34257d4c19d (patch) | |
| tree | 5e9e47ff023d816cea66f10b44d5ecb23fd314b6 /src/main/scala/firrtl/annotations/Annotation.scala | |
| parent | 87ab555023760e7fe6f517c5776975bbc93ebe8c (diff) | |
Fix memory annotation deduplication (#2286)
* Add transform to deduplicate memory annotations
* Add annotation deduplication to Dedup stage
* ResolveAnnotationPaths and EliminateTargetPaths now invalidate the dedup annotations transform
* Verilog emitter now throws exception when memory annotations fail to dedup
Co-authored-by: Jack Koenig <koenig@sifive.com>
Diffstat (limited to 'src/main/scala/firrtl/annotations/Annotation.scala')
| -rw-r--r-- | src/main/scala/firrtl/annotations/Annotation.scala | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/scala/firrtl/annotations/Annotation.scala b/src/main/scala/firrtl/annotations/Annotation.scala index 08555a84..f4d6ee55 100644 --- a/src/main/scala/firrtl/annotations/Annotation.scala +++ b/src/main/scala/firrtl/annotations/Annotation.scala @@ -38,6 +38,21 @@ trait Annotation extends Product { * @return */ def getTargets: Seq[Target] = extractComponents(productIterator.toIterable).toSeq + + /** Returns a deduplicable representation of this [[Annotation]]: a 3-tuple of the + * deduplicated annotation's "dedup key", the deduplicated [[Annotation]], and the + * [[firrtl.annotations.ReferenceTarget ReferenceTarget]](s) to the annotated objects. + * + * If two absolute instances of this [[Annotation]] would deduplicate to the same + * local form, both of their "dedup key"s must be equivalent. + * + * A deduplication key is typically taken to be a 2-tuple of the pathless target and + * the annotation's value. + * + * Returning None signifies this annotation will not deduplicate. + * @return + */ + private[firrtl] def dedup: Option[(Any, Annotation, ReferenceTarget)] = None } /** If an Annotation does not target any [[Named]] thing in the circuit, then all updates just |
