-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some tests for simplify-invoke-with. found bugs
- Loading branch information
1 parent
eef79a7
commit 7199858
Showing
8 changed files
with
248 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
tests/passes/simplify-invoke-with/conflicting-invokes.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import "primitives/core.futil"; | ||
import "primitives/memories/seq.futil"; | ||
import "primitives/binary_operators.futil"; | ||
component main(@go go: 1, @clk clk: 1, @reset reset: 1) -> (@done done: 1) { | ||
cells { | ||
r = std_reg(32); | ||
x = std_reg(32); | ||
y = std_reg(32); | ||
mul = std_mult_pipe(32); | ||
r2 = std_reg(32); | ||
x2 = std_reg(32); | ||
y2 = std_reg(32); | ||
mul2 = std_mult_pipe(32); | ||
@control @generated @protected mul_active = std_wire(1); | ||
} | ||
wires { | ||
comb group comb_invoke { | ||
mul_active.in = !mul.done ? 1'd1; | ||
} | ||
} | ||
control { | ||
seq { | ||
invoke mul( | ||
left = x.out, | ||
right = y.out | ||
)() with comb_invoke; | ||
invoke mul2( | ||
left = x2.out, | ||
right = y2.out | ||
)() with comb_invoke; | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
tests/passes/simplify-invoke-with/conflicting-invokes.futil
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// -p simplify-invoke-with | ||
|
||
import "primitives/core.futil"; | ||
import "primitives/memories/seq.futil"; | ||
import "primitives/binary_operators.futil"; | ||
component main() -> () { | ||
cells { | ||
r = std_reg(32); | ||
x = std_reg(32); | ||
y = std_reg(32); | ||
mul = std_mult_pipe(32); | ||
r2 = std_reg(32); | ||
x2 = std_reg(32); | ||
y2 = std_reg(32); | ||
mul2 = std_mult_pipe(32); | ||
|
||
@control @generated @protected mul_active = std_wire(1); | ||
} | ||
wires { | ||
comb group comb_invoke { | ||
mul_active.in = !mul.done ? 1'd1; | ||
} | ||
} | ||
control { | ||
seq { | ||
invoke mul(left = x.out, right = y.out)() with comb_invoke; | ||
invoke mul2(left = x2.out, right = y2.out)() with comb_invoke; | ||
} | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
tests/passes/simplify-invoke-with/conflicting-with-while.expect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import "primitives/core.futil"; | ||
import "primitives/memories/seq.futil"; | ||
import "primitives/binary_operators.futil"; | ||
component main(@go go: 1, @clk clk: 1, @reset reset: 1) -> (@done done: 1) { | ||
cells { | ||
r = std_reg(32); | ||
x = std_reg(32); | ||
y = std_reg(32); | ||
mul = std_mult_pipe(32); | ||
r2 = std_reg(32); | ||
x2 = std_reg(32); | ||
y2 = std_reg(32); | ||
mul2 = std_mult_pipe(32); | ||
lt = std_lt(32); | ||
lt_reg = std_reg(1); | ||
@control @generated @protected mul_active = std_wire(1); | ||
} | ||
wires { | ||
group init_x { | ||
x.in = 32'd3; | ||
x.write_en = 1'd1; | ||
init_x[done] = x.done; | ||
} | ||
group init_y { | ||
y.in = 32'd5; | ||
y.write_en = 1'd1; | ||
init_y[done] = y.done; | ||
} | ||
group write_r { | ||
r.in = mul.out; | ||
r.write_en = 1'd1; | ||
write_r[done] = r.done; | ||
} | ||
comb group comb_group { | ||
lt.left = r.out; | ||
lt.right = 32'd25; | ||
mul_active.in = !mul.done ? 1'd1; | ||
} | ||
} | ||
control { | ||
seq { | ||
init_x; | ||
init_y; | ||
while lt.out with comb_group { | ||
seq { | ||
invoke mul( | ||
left = x.out, | ||
right = y.out | ||
)() with comb_group; | ||
write_r; | ||
} | ||
} | ||
} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
tests/passes/simplify-invoke-with/conflicting-with-while.futil
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// -p simplify-invoke-with | ||
|
||
import "primitives/core.futil"; | ||
import "primitives/memories/seq.futil"; | ||
import "primitives/binary_operators.futil"; | ||
component main() -> () { | ||
cells { | ||
r = std_reg(32); | ||
x = std_reg(32); | ||
y = std_reg(32); | ||
mul = std_mult_pipe(32); | ||
r2 = std_reg(32); | ||
x2 = std_reg(32); | ||
y2 = std_reg(32); | ||
mul2 = std_mult_pipe(32); | ||
lt = std_lt(32); | ||
lt_reg = std_reg(1); | ||
|
||
|
||
@control @generated @protected mul_active = std_wire(1); | ||
} | ||
wires { | ||
comb group comb_group { | ||
lt.left = r.out; | ||
lt.right = 32'd25; | ||
mul_active.in = !mul.done ? 1'd1; | ||
} | ||
group init_x { | ||
x.in = 32'd3; | ||
x.write_en = 1'd1; | ||
init_x[done] = x.done; | ||
} | ||
group init_y { | ||
y.in = 32'd5; | ||
y.write_en = 1'd1; | ||
init_y[done] = y.done; | ||
} | ||
group write_r { | ||
r.in = mul.out; | ||
r.write_en = 1'd1; | ||
write_r[done] = r.done; | ||
} | ||
} | ||
control { | ||
seq { | ||
init_x; | ||
init_y; | ||
while lt.out with comb_group { | ||
invoke mul(left = x.out, right = y.out)() with comb_group; | ||
write_r; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import "primitives/core.futil"; | ||
import "primitives/memories/seq.futil"; | ||
import "primitives/binary_operators.futil"; | ||
component main(@go go: 1, @clk clk: 1, @reset reset: 1) -> (@done done: 1) { | ||
cells { | ||
r = std_reg(32); | ||
x = std_reg(32); | ||
y = std_reg(32); | ||
mul = std_mult_pipe(32); | ||
r2 = std_reg(32); | ||
x2 = std_reg(32); | ||
y2 = std_reg(32); | ||
mul2 = std_mult_pipe(32); | ||
@control @generated @protected mul_active = std_wire(1); | ||
@control @generated @protected mul2_active = std_wire(1); | ||
} | ||
wires { | ||
comb group comb_invoke { | ||
mul_active.in = !mul.done ? 1'd1; | ||
} | ||
comb group comb_invoke1 { | ||
mul2_active.in = !1'd0 ? 1'd1; | ||
} | ||
} | ||
control { | ||
seq { | ||
invoke mul( | ||
left = x.out, | ||
right = y.out | ||
)() with comb_invoke; | ||
invoke mul2( | ||
left = x2.out, | ||
right = y2.out | ||
)() with comb_invoke1; | ||
invoke mul( | ||
left = x.out, | ||
right = y.out | ||
)() with comb_invoke; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// -p simplify-invoke-with | ||
|
||
import "primitives/core.futil"; | ||
import "primitives/memories/seq.futil"; | ||
import "primitives/binary_operators.futil"; | ||
component main() -> () { | ||
cells { | ||
r = std_reg(32); | ||
x = std_reg(32); | ||
y = std_reg(32); | ||
mul = std_mult_pipe(32); | ||
r2 = std_reg(32); | ||
x2 = std_reg(32); | ||
y2 = std_reg(32); | ||
mul2 = std_mult_pipe(32); | ||
|
||
@control @generated @protected mul_active = std_wire(1); | ||
@control @generated @protected mul2_active = std_wire(1); | ||
} | ||
wires { | ||
comb group comb_invoke { | ||
mul_active.in = !mul.done ? 1'd1; | ||
} | ||
comb group comb_invoke1 { | ||
mul2_active.in = !mul2.done ? 1'd1; | ||
} | ||
} | ||
control { | ||
seq { | ||
invoke mul(left = x.out, right = y.out)() with comb_invoke; | ||
invoke mul2(left = x2.out, right = y2.out)() with comb_invoke1; | ||
invoke mul(left = x.out, right = y.out)() with comb_invoke; | ||
} | ||
} | ||
} |