-
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.
- Loading branch information
Showing
8 changed files
with
162 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import "primitives/core.futil"; | ||
import "primitives/memories/comb.futil"; | ||
component main(@go go: 1, @clk clk: 1, @reset reset: 1) -> (@done done: 1) { | ||
cells { | ||
@protected add0 = std_add(32); | ||
add1 = std_add(32); | ||
x_0 = std_reg(32); | ||
} | ||
wires { | ||
group upd0 { | ||
add0.left = x_0.out; | ||
add0.right = 32'd1; | ||
x_0.in = add0.out; | ||
x_0.write_en = 1'd1; | ||
upd0[done] = x_0.done ? 1'd1; | ||
} | ||
group upd1 { | ||
add1.left = x_0.out; | ||
add1.right = 32'd1; | ||
x_0.in = add1.out; | ||
x_0.write_en = 1'd1; | ||
upd1[done] = x_0.done ? 1'd1; | ||
} | ||
} | ||
control { | ||
seq { | ||
upd0; | ||
upd1; | ||
} | ||
} | ||
} |
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 cell-share -p remove-ids | ||
|
||
import "primitives/core.futil"; | ||
import "primitives/memories/comb.futil"; | ||
|
||
// testing that @protected overrides @share | ||
component main() -> () { | ||
cells { | ||
@protected add0 = std_add(32); | ||
add1 = std_add(32); | ||
x_0 = std_reg(32); | ||
} | ||
wires { | ||
group upd0 { | ||
add0.left = x_0.out; | ||
add0.right = 32'd1; | ||
x_0.in = add0.out; | ||
x_0.write_en = 1'd1; | ||
upd0[done] = x_0.done ? 1'd1; | ||
} | ||
group upd1 { | ||
add1.left = x_0.out; | ||
add1.right = 32'd1; | ||
x_0.in = add1.out; | ||
x_0.write_en = 1'd1; | ||
upd1[done] = x_0.done ? 1'd1; | ||
} | ||
} | ||
control { | ||
seq { | ||
upd0; | ||
upd1; | ||
} | ||
} | ||
} |
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/comb.futil"; | ||
component add(left: 32, right: 32, @go go: 1, @clk clk: 1, @reset reset: 1) -> (out: 32, @done done: 1) { | ||
cells { | ||
adder = std_add(32); | ||
outpt = std_reg(32); | ||
} | ||
wires { | ||
group do_add { | ||
adder.left = left; | ||
adder.right = right; | ||
outpt.in = adder.out; | ||
outpt.write_en = 1'd1; | ||
do_add[done] = outpt.done; | ||
} | ||
} | ||
control { | ||
seq { | ||
do_add; | ||
} | ||
} | ||
} | ||
component main(@go go: 1, @clk clk: 1, @reset reset: 1) -> (out: 32, @done done: 1) { | ||
cells { | ||
used_reg = std_reg(32); | ||
used_le = std_le(1); | ||
@protected unused_reg = std_reg(32); | ||
my_add = add(); | ||
add_input = std_reg(32); | ||
} | ||
wires { | ||
used_reg.in = used_le.out ? 32'd10; | ||
out = used_reg.out; | ||
} | ||
control { | ||
invoke my_add( | ||
left = add_input.out, | ||
right = add_input.out | ||
)(); | ||
} | ||
} |
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 @@ | ||
// -p dead-cell-removal | ||
import "primitives/core.futil"; | ||
import "primitives/memories/comb.futil"; | ||
|
||
component add(left: 32, right: 32) -> (out: 32) { | ||
cells { | ||
adder = std_add(32); | ||
outpt = std_reg(32); | ||
} | ||
wires { | ||
group do_add { | ||
adder.left = left; | ||
adder.right = right; | ||
outpt.in = adder.out; | ||
outpt.write_en = 1'd1; | ||
do_add[done] = outpt.done; | ||
} | ||
} | ||
control { | ||
seq { | ||
do_add; | ||
} | ||
} | ||
} | ||
|
||
component main() -> (out: 32) { | ||
cells { | ||
used_reg = std_reg(32); | ||
used_le = std_le(1); | ||
@protected unused_reg = std_reg(32); | ||
my_add = add(); | ||
add_input = std_reg(32); | ||
} | ||
wires { | ||
used_reg.in = used_le.out ? 32'd10; | ||
out = used_reg.out; | ||
} | ||
control { | ||
invoke my_add(left = add_input.out, right = add_input.out)(); | ||
} | ||
} |