Skip to content

Commit 62c940f

Browse files
committed
Fix SlowState instantiation error on Delay=0
1 parent 526e2f0 commit 62c940f

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

std/control_flow.sus

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,12 @@ module SlowState #(T, int DELAY) {
4949
state bool[DELAY] wait_for_slow
5050

5151
T new_value_slow_d'DELAY
52-
T new_value_slow_0'0 = LatencyOffset#(OFFSET: -DELAY)(new_value_slow_d)
53-
when wait_for_slow[DELAY-1] {
54-
old_is_stable = true
55-
old_v = new_value_slow_0
52+
T new_value_slow_0'0 = LatencyOffset#(OFFSET: -DELAY)(new_value_slow_d)
53+
if DELAY != 0 {
54+
when wait_for_slow[DELAY-1] {
55+
old_is_stable = true
56+
old_v = new_value_slow_0
57+
}
5658
}
5759

5860
action set_slow'0 : T new_value_slow'DELAY {
@@ -66,8 +68,10 @@ module SlowState #(T, int DELAY) {
6668
}
6769
new_value_slow_d = new_value_slow
6870
} else {
69-
wait_for_slow[0] = false
70-
wait_for_slow[1:] = wait_for_slow[0:DELAY-1]
71+
if DELAY != 0 {
72+
wait_for_slow[0] = false
73+
wait_for_slow[1:] = wait_for_slow[0:DELAY-1]
74+
}
7175
}
7276

7377
action set_fast'0 : T new_value_fast'0 {

0 commit comments

Comments
 (0)