Skip to content

Commit 78e0031

Browse files
committed
monitor: add repeat loop test without a fork problem
1 parent 1135d89 commit 78e0031

3 files changed

Lines changed: 53 additions & 0 deletions

File tree

monitor/tests/adders/add_var_cyc.err

Whitespace-only changes.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// trace 0
2+
trace {
3+
loop_add(1, 2, 3, 2);
4+
loop_add(10, 20, 30, 0);
5+
}
6+
7+
// trace 1
8+
trace {
9+
loop_add(1, 2, 3, 0);
10+
loop_add(1, 2, 3, 1);
11+
loop_add(10, 20, 30, 0);
12+
}
13+
14+
// trace 2
15+
trace {
16+
loop_add(1, 2, 3, 1);
17+
loop_add(1, 2, 3, 0);
18+
loop_add(10, 20, 30, 0);
19+
}
20+
21+
// trace 3
22+
trace {
23+
loop_add(1, 2, 3, 0);
24+
loop_add(1, 2, 3, 0);
25+
loop_add(1, 2, 3, 0);
26+
loop_add(10, 20, 30, 0);
27+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// ARGS: --wave adders/loop_with_assigns.fst --instances add_d1:Adder
2+
struct Adder {
3+
in a: u32,
4+
in b: u32,
5+
out s: u32,
6+
}
7+
8+
prot loop_add<DUT: Adder>(a: u32, b: u32, s: u32, extra_cycles: uint) {
9+
// first cycle
10+
DUT.a := a;
11+
DUT.b := b;
12+
step();
13+
14+
// extra cycles (keeping inputs constant)
15+
repeat extra_cycles iterations {
16+
assert_eq(s, DUT.s);
17+
step();
18+
}
19+
20+
// final cycle
21+
DUT.a := X;
22+
DUT.b := X;
23+
assert_eq(s, DUT.s);
24+
fork();
25+
step();
26+
}

0 commit comments

Comments
 (0)