From 04210ee30acd437bccfe694ddd895e5f450ba01f Mon Sep 17 00:00:00 2001 From: Jared Barocsi Date: Thu, 29 Jul 2021 16:31:08 -0700 Subject: Dedup attribute annos (#2297) * Add new util "groupByIntoSeq" * Restore annotation order when dedupping annotations * Attribute annotations now deduplicate * Implement doc string anno dedup Co-authored-by: Jack Koenig --- src/main/scala/firrtl/backends/verilog/VerilogEmitter.scala | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/main/scala/firrtl/backends') diff --git a/src/main/scala/firrtl/backends/verilog/VerilogEmitter.scala b/src/main/scala/firrtl/backends/verilog/VerilogEmitter.scala index 8b20d365..4f62f27e 100644 --- a/src/main/scala/firrtl/backends/verilog/VerilogEmitter.scala +++ b/src/main/scala/firrtl/backends/verilog/VerilogEmitter.scala @@ -8,6 +8,7 @@ import firrtl.Utils._ import firrtl.WrappedExpression._ import firrtl.traversals.Foreachers._ import firrtl.annotations.{ + Annotation, CircuitTarget, MemoryInitAnnotation, MemoryLoadFileType, @@ -509,14 +510,14 @@ class VerilogEmitter extends SeqTransform with Emitter { case m: SingleTargetAnnotation[ReferenceTarget] @unchecked with EmissionOption => m } - // Check for non-local memory annotations (error if found) - emissionAnnos.foreach { - case a: MemoryInitAnnotation => { - if (!a.target.isLocal) + annotations.foreach { + case a: Annotation if a.dedup.nonEmpty => + val (_, _, target) = a.dedup.get + if (!target.isLocal) { throw new FirrtlUserException( - "At least one memory annotation did not deduplicate: got non-local annotation $a from [[DedupAnnotationsTransform]]" + "At least one dedupable annotation did not deduplicate: got non-local annotation $a from [[DedupAnnotationsTransform]]" ) - } + } case _ => } -- cgit v1.2.3