From 76862eb88adb8a056534fe937f2d7e9353feee94 Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Wed, 27 Feb 2019 11:10:31 -0800 Subject: Add --nodedup option to facilitate FIRRTL to verilog regression testing. (#1035) * Add --nodedup option to facilitate FIRRTL to verilog regression testing. * Short-circuit the DedupModules transform if NoCircuitDedupAnnotation exists. --- src/main/scala/firrtl/transforms/Dedup.scala | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/main/scala/firrtl/transforms/Dedup.scala') diff --git a/src/main/scala/firrtl/transforms/Dedup.scala b/src/main/scala/firrtl/transforms/Dedup.scala index 83daad7f..609b5935 100644 --- a/src/main/scala/firrtl/transforms/Dedup.scala +++ b/src/main/scala/firrtl/transforms/Dedup.scala @@ -20,6 +20,8 @@ case class NoDedupAnnotation(target: ModuleName) extends SingleTargetAnnotation[ def duplicate(n: ModuleName): NoDedupAnnotation = NoDedupAnnotation(n) } +case object NoCircuitDedupAnnotation extends NoTargetAnnotation + /** Only use on legal Firrtl. * * Specifically, the restriction of instance loops must have been checked, or else this pass can @@ -34,9 +36,13 @@ class DedupModules extends Transform { * @return A transformed Firrtl AST */ def execute(state: CircuitState): CircuitState = { - val noDedups = state.annotations.collect { case NoDedupAnnotation(ModuleName(m, c)) => m } - val (newC, renameMap) = run(state.circuit, noDedups, state.annotations) - state.copy(circuit = newC, renames = Some(renameMap)) + if (state.annotations.contains(NoCircuitDedupAnnotation)) { + state + } else { + val noDedups = state.annotations.collect { case NoDedupAnnotation(ModuleName(m, c)) => m } + val (newC, renameMap) = run(state.circuit, noDedups, state.annotations) + state.copy(circuit = newC, renames = Some(renameMap)) + } } /** Deduplicates a circuit, and records renaming -- cgit v1.2.3