aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorKevin Laeufer2021-01-19 13:14:24 -0800
committerGitHub2021-01-19 21:14:24 +0000
commit2882912385c744389092b4f8d426379908d01ed7 (patch)
tree2529e0bdc9c76dd9e9754fbeb2d797609cab212a /src/main
parentbbd7fc4115728ecc7cf88bf0524f2126d8220c34 (diff)
smt: run DeadCodeElimination after PropagatePresetAnnotations (#2036)
Diffstat (limited to 'src/main')
-rw-r--r--src/main/scala/firrtl/backends/experimental/smt/FirrtlToTransitionSystem.scala19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/main/scala/firrtl/backends/experimental/smt/FirrtlToTransitionSystem.scala b/src/main/scala/firrtl/backends/experimental/smt/FirrtlToTransitionSystem.scala
index 145b5b0f..9c309917 100644
--- a/src/main/scala/firrtl/backends/experimental/smt/FirrtlToTransitionSystem.scala
+++ b/src/main/scala/firrtl/backends/experimental/smt/FirrtlToTransitionSystem.scala
@@ -10,18 +10,8 @@ import firrtl.options.Dependency
import firrtl.passes.PassException
import firrtl.stage.Forms
import firrtl.stage.TransformManager.TransformDependency
-import firrtl.transforms.PropagatePresetAnnotations
-import firrtl.{
- ir,
- CircuitState,
- DependencyAPIMigration,
- MemoryArrayInit,
- MemoryInitValue,
- MemoryScalarInit,
- Namespace,
- Transform,
- Utils
-}
+import firrtl.transforms.{DeadCodeElimination, PropagatePresetAnnotations}
+import firrtl.{CircuitState, DependencyAPIMigration, MemoryArrayInit, MemoryInitValue, MemoryScalarInit, Namespace, Transform, Utils, ir}
import logger.LazyLogging
import scala.collection.mutable
@@ -67,9 +57,12 @@ object FirrtlToTransitionSystem extends Transform with DependencyAPIMigration {
// Verilog emission passes.
// Ideally we would go in and enable the [[PropagatePresetAnnotations]] to only depend on LowForm.
private val presetPass = new PropagatePresetAnnotations
+ // We also need to run the DeadCodeElimination since PropagatePresets does not remove possible remaining
+ // AsyncReset nodes.
+ private val deadCodeElimination = new DeadCodeElimination
override protected def execute(state: CircuitState): CircuitState = {
// run the preset pass to extract all preset registers and remove preset reset signals
- val afterPreset = presetPass.execute(state)
+ val afterPreset = deadCodeElimination.execute(presetPass.execute(state))
val circuit = afterPreset.circuit
val presetRegs = afterPreset.annotations.collect {
case PresetRegAnnotation(target) if target.module == circuit.main => target.ref