Skip to content

Commit

Permalink
invoke ref test
Browse files Browse the repository at this point in the history
  • Loading branch information
rachitnigam committed Aug 23, 2023
1 parent 0654932 commit 9a48f6a
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/passes/compile-invoke/invoke-ref.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import "primitives/compile.futil";
component foo(@go go: 1, @clk clk: 1, @reset reset: 1, r_out: 32, r_done: 1) -> (@done done: 1, r_in: 32, r_write_en: 1) {
cells {
}
wires {
group invoke0 {
r_write_en = 1'd1;
invoke0[done] = r_done;
r_in = 32'd10;
}
}
control {
invoke0;
}
}
component main(@go go: 1, @clk clk: 1, @reset reset: 1) -> (@done done: 1) {
cells {
r0 = std_reg(32);
f = foo();
}
wires {
group invoke0 {
r0.in = f.r_in;
r0.write_en = f.r_write_en;
f.r_out = r0.out;
f.r_done = r0.done;
f.go = 1'd1;
invoke0[done] = f.done;
}
}
control {
invoke0;
}
}
23 changes: 23 additions & 0 deletions tests/passes/compile-invoke/invoke-ref.futil
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// -p validate -p compile-invoke
import "primitives/compile.futil";

component foo() -> () {
cells {
ref r = std_reg(32);
}
wires {}
control {
invoke r(in = 32'd10)();
}
}

component main() -> () {
cells {
r0 = std_reg(32);
f = foo();
}
wires {}
control {
invoke f[r=r0]()();
}
}

0 comments on commit 9a48f6a

Please sign in to comment.