Skip to content

Commit 87190f5

Browse files
committed
tests/while has event statement in a while statement.
1 parent 4b367d6 commit 87190f5

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

sample/tests/while/led.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ def mkTest():
99
rst = m.Reg('RST')
1010
count = m.Reg('count', width=32)
1111

12+
m.Initial(
13+
Systask('dumpfile', 'uut.vcd'),
14+
Systask('dumpvars', 0, clk, rst, count),
15+
)
16+
1217
m.Initial(
1318
clk(0),
1419
Forever(clk(Not(clk), ldelay=5)) # forever #5 CLK = ~CLK;
@@ -25,7 +30,8 @@ def mkTest():
2530
count(0),
2631

2732
While(count < 1024)(
28-
count( count + 1 )
33+
count( count + 1 ),
34+
Event(Posedge(clk))
2935
),
3036

3137
Systask('finish'),

sample/tests/while/test_led.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
reg RST;
77
reg [32-1:0] count;
88
9+
initial begin
10+
$dumpfile("uut.vcd");
11+
$dumpvars(0, CLK, RST, count);
12+
end
13+
914
initial begin
1015
CLK = 0;
1116
forever begin
@@ -24,6 +29,7 @@
2429
count = 0;
2530
while(count < 1024) begin
2631
count = count + 1;
32+
@(posedge CLK);
2733
end
2834
2935
$finish;

0 commit comments

Comments
 (0)