-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Cider 2] First Pass Multi-component and Invokes (#2119)
* I broke everything by being stupid so here's one big commit oops * Remove unused `is_done` method from `ProgramCounter` * invoke works now maybe? * a silly silly test case
- Loading branch information
1 parent
0954ac2
commit a1d99c2
Showing
14 changed files
with
687 additions
and
100 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"left_reg": [ | ||
5 | ||
], | ||
"result": [ | ||
15 | ||
], | ||
"right_reg": [ | ||
10 | ||
] | ||
} |
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,64 @@ | ||
import "primitives/core.futil"; | ||
import "primitives/binary_operators.futil"; | ||
|
||
component my_add(left: 32, right: 32) -> (out: 32) { | ||
cells { | ||
result = std_reg(32); | ||
add = std_add(32); | ||
} | ||
wires { | ||
group do_add { | ||
add.left = left; | ||
add.right = right; | ||
result.in = add.out; | ||
result.write_en = 1'd1; | ||
do_add[done] = result.done; | ||
} | ||
|
||
out = result.out; | ||
} | ||
|
||
control { | ||
do_add; | ||
} | ||
} | ||
|
||
component main() -> () { | ||
cells { | ||
left_reg = std_reg(32); | ||
right_reg = std_reg(32); | ||
my_add = my_add(); | ||
result = std_reg(32); | ||
} | ||
|
||
wires { | ||
group init_left { | ||
left_reg.in = 32'd5; | ||
left_reg.write_en = 1'd1; | ||
init_left[done] = left_reg.done; | ||
} | ||
|
||
group init_right { | ||
right_reg.in = 32'd10; | ||
right_reg.write_en = 1'd1; | ||
init_right[done] = right_reg.done; | ||
} | ||
|
||
group do_add { | ||
my_add.go = 1'd1; | ||
my_add.left = left_reg.out; | ||
my_add.right = right_reg.out; | ||
result.in = my_add.out; | ||
result.write_en = my_add.done; | ||
do_add[done] = result.done; | ||
} | ||
} | ||
|
||
control { | ||
seq { | ||
init_left; | ||
init_right; | ||
do_add; | ||
} | ||
} | ||
} |
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,11 @@ | ||
{ | ||
"left_reg": [ | ||
5 | ||
], | ||
"result": [ | ||
15 | ||
], | ||
"right_reg": [ | ||
10 | ||
] | ||
} |
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,62 @@ | ||
import "primitives/core.futil"; | ||
import "primitives/binary_operators.futil"; | ||
|
||
component my_add(left: 32, right: 32) -> (out: 32) { | ||
cells { | ||
result = std_reg(32); | ||
add = std_add(32); | ||
} | ||
wires { | ||
group do_add { | ||
add.left = left; | ||
add.right = right; | ||
result.in = add.out; | ||
result.write_en = 1'd1; | ||
do_add[done] = result.done; | ||
} | ||
|
||
out = result.out; | ||
} | ||
|
||
control { | ||
do_add; | ||
} | ||
} | ||
|
||
component main() -> () { | ||
cells { | ||
left_reg = std_reg(32); | ||
right_reg = std_reg(32); | ||
my_add = my_add(); | ||
result = std_reg(32); | ||
} | ||
|
||
wires { | ||
group init_left { | ||
left_reg.in = 32'd5; | ||
left_reg.write_en = 1'd1; | ||
init_left[done] = left_reg.done; | ||
} | ||
|
||
group init_right { | ||
right_reg.in = 32'd10; | ||
right_reg.write_en = 1'd1; | ||
init_right[done] = right_reg.done; | ||
} | ||
|
||
group store_result { | ||
result.in = my_add.out; | ||
result.write_en = 1'd1; | ||
store_result[done] = result.done; | ||
} | ||
} | ||
|
||
control { | ||
seq { | ||
init_left; | ||
init_right; | ||
invoke my_add(left=left_reg.out, right=right_reg.out)(); | ||
store_result; | ||
} | ||
} | ||
} |
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,11 @@ | ||
{ | ||
"left_reg": [ | ||
5 | ||
], | ||
"result": [ | ||
15 | ||
], | ||
"right_reg": [ | ||
10 | ||
] | ||
} |
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,63 @@ | ||
import "primitives/core.futil"; | ||
import "primitives/binary_operators.futil"; | ||
|
||
component my_add(left: 32, right: 32) -> (out: 32) { | ||
cells { | ||
result = std_reg(32); | ||
ref add = std_add(32); | ||
} | ||
wires { | ||
group do_add { | ||
add.left = left; | ||
add.right = right; | ||
result.in = add.out; | ||
result.write_en = 1'd1; | ||
do_add[done] = result.done; | ||
} | ||
|
||
out = result.out; | ||
} | ||
|
||
control { | ||
do_add; | ||
} | ||
} | ||
|
||
component main() -> () { | ||
cells { | ||
left_reg = std_reg(32); | ||
right_reg = std_reg(32); | ||
my_add = my_add(); | ||
result = std_reg(32); | ||
inner_add = std_add(32); | ||
} | ||
|
||
wires { | ||
group init_left { | ||
left_reg.in = 32'd5; | ||
left_reg.write_en = 1'd1; | ||
init_left[done] = left_reg.done; | ||
} | ||
|
||
group init_right { | ||
right_reg.in = 32'd10; | ||
right_reg.write_en = 1'd1; | ||
init_right[done] = right_reg.done; | ||
} | ||
|
||
group store_result { | ||
result.in = my_add.out; | ||
result.write_en = 1'd1; | ||
store_result[done] = result.done; | ||
} | ||
} | ||
|
||
control { | ||
seq { | ||
init_left; | ||
init_right; | ||
invoke my_add[add=inner_add](left=left_reg.out, right=right_reg.out)(); | ||
store_result; | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.