-
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
1 parent
e8cb4ba
commit 7262a54
Showing
2 changed files
with
75 additions
and
0 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,38 @@ | ||
import "primitives/core.futil"; | ||
component my_comp() -> () { | ||
cells { | ||
|
||
} | ||
wires { | ||
group my_group { | ||
|
||
} | ||
group my_group2 { | ||
|
||
} | ||
group my_group3 { | ||
|
||
} | ||
} | ||
control { | ||
par { | ||
seq { | ||
par { | ||
my_group; | ||
my_group2; | ||
my_group3; | ||
my_group2; | ||
my_group3; | ||
} | ||
my_group; | ||
my_group2; | ||
my_group; | ||
my_group3; | ||
} | ||
seq { | ||
my_group2; | ||
my_group3; | ||
} | ||
} | ||
} | ||
} |
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,37 @@ | ||
# This is meant to test the `__add__` and `__mul__` functionality of | ||
# the builder's ControlBuilder. In particular we look at `+=` and `*=` | ||
from calyx.builder import ( | ||
Builder, | ||
par, | ||
) | ||
|
||
|
||
def add_par_thing(prog): | ||
my_comp = prog.component("my_comp") | ||
|
||
my_group = my_comp.group("my_group") | ||
my_group2 = my_comp.group("my_group2") | ||
my_group3 = my_comp.group("my_group3") | ||
|
||
my_par = par(my_group2, my_group3) | ||
|
||
my_comp.control *= my_group | ||
# Make sure that an ast.ParComp and CompBuilder par get flattened. | ||
my_comp.control *= my_par | ||
my_comp.control *= par(my_group2, my_group3) | ||
# Turn into seq of par group then [my_group, my_group2] | ||
my_comp.control += [my_group, my_group2] | ||
my_comp.control += my_group | ||
my_comp.control += [my_group3] | ||
# Check going from seq to par block | ||
my_comp.control *= [my_group2, my_group3] | ||
|
||
|
||
def build(): | ||
prog = Builder() | ||
add_par_thing(prog) | ||
return prog.program | ||
|
||
|
||
if __name__ == "__main__": | ||
build().emit() |