diff options
| author | Jim Lawson | 2019-02-27 11:10:31 -0800 |
|---|---|---|
| committer | mergify[bot] | 2019-02-27 19:10:31 +0000 |
| commit | 76862eb88adb8a056534fe937f2d7e9353feee94 (patch) | |
| tree | 81683619e1ba2e6c3a71f8e85f3513c11fbf059f /src/main/scala/firrtl/transforms/Dedup.scala | |
| parent | aec54ed72d02932f8fdb3aa857e82a23507aecd2 (diff) | |
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.
Diffstat (limited to 'src/main/scala/firrtl/transforms/Dedup.scala')
| -rw-r--r-- | src/main/scala/firrtl/transforms/Dedup.scala | 12 |
1 files changed, 9 insertions, 3 deletions
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 |
