Skip to content

Commit 1d416e7

Browse files
author
Oron Port
committed
fix ToED sequential process so that reset will always be considered if configured
1 parent b097a89 commit 1d416e7

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

compiler/stages/src/main/scala/dfhdl/compiler/stages/ToED.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,7 @@ case object ToED extends Stage:
260260
clkCfg != None && (dclREGList.nonEmpty || processBlockAllMembers.nonEmpty && domainIsPureSequential)
261261

262262
if (hasSeqProcess)
263-
val dclREGsHaveRst = dclREGList.exists(_.hasNonBubbleInit)
264-
if (rstCfg != None && dclREGsHaveRst)
263+
if (rstCfg != None)
265264
val RstCfg.Explicit(mode = mode) = rstCfg: @unchecked
266265
mode match
267266
case RstCfg.Mode.Sync =>

compiler/stages/src/test/scala/StagesSpec/ToEDSpec.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,10 @@ class ToEDSpec extends StageSpec(stageCreatesUnrefAnons = true):
188188
| r := x + r
189189
| y_din := r
190190
| process(clk):
191-
| if (clk.actual.rising) y :== y_din
191+
| if (clk.actual.rising)
192+
| if (rst.actual == 1) {}
193+
| else y :== y_din
194+
| end if
192195
|end ID
193196
|
194197
|class IDTop extends EDDesign:
@@ -868,7 +871,10 @@ class ToEDSpec extends StageSpec(stageCreatesUnrefAnons = true):
868871
| val rst = Rst_default <> IN
869872
| val child = FooChild()
870873
| process(clk):
871-
| if (clk.actual.rising) println(s"${child.y}")
874+
| if (clk.actual.rising)
875+
| if (rst.actual == 1) {}
876+
| else println(s"${child.y}")
877+
| end if
872878
|end Foo""".stripMargin
873879
)
874880
}

0 commit comments

Comments
 (0)