-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@fast
attribute to enable early (0-cycle) transitions between alternating dynamic/static groups
#2118
Merged
Merged
@fast
attribute to enable early (0-cycle) transitions between alternating dynamic/static groups
#2118
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
30907da
This actually took me like a week
ethanuppal d7dafc4
Add well-formed check for @fast
ethanuppal 397b650
Merge branch 'main' into fast-1828
ethanuppal 0ecda0c
Prevent from cascading
ethanuppal 70e25d6
Forgot to remove these
ethanuppal 2ee19f7
Add basic tests
ethanuppal 53e567f
There has to be a better way
ethanuppal 7b6c837
Implement Rachit and Caleb's reviews
ethanuppal 0b93447
Oops
ethanuppal fd3ba25
Merge branch 'main' into fast-1828
ethanuppal 648728d
Remove erroneous file
ethanuppal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,9 @@ | ||
---CODE--- | ||
255 | ||
---STDERR--- | ||
[fud] ERROR: `/home/calyx/target/debug/calyx -l /home/calyx -b verilog --disable-verify -p validate -p compile -p lower -d static-promotion' failed: | ||
=====STDERR===== | ||
Error: Malformed Control: `seq` marked `@fast` does not contain alternating static-dynamic control children (see #1828) | ||
|
||
=====STDOUT===== | ||
|
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,46 @@ | ||
import "primitives/core.futil"; | ||
import "primitives/memories/comb.futil"; | ||
|
||
component main(@go go: 1) -> (@done done: 1) { | ||
cells { | ||
@external m = comb_mem_d1(32, 1, 32); | ||
i0 = std_reg(32); | ||
add = std_add(32); | ||
} | ||
wires { | ||
static<1> group init { | ||
i0.in = 32'd0; | ||
i0.write_en = 1'b1; | ||
} | ||
group dyn_inc { | ||
add.left = i0.out; | ||
add.right = 32'd1; | ||
i0.in = add.out; | ||
i0.write_en = 1'b1; | ||
dyn_inc[done] = i0.done; | ||
} | ||
static<1> group static_inc { | ||
add.left = i0.out; | ||
add.right = 32'd1; | ||
i0.in = add.out; | ||
i0.write_en = 1'b1; | ||
} | ||
group write { | ||
m.write_data = i0.out; | ||
m.write_en = 1'b1; | ||
write[done] = m.done; | ||
} | ||
} | ||
control { | ||
@fast seq { | ||
init; | ||
dyn_inc; | ||
dyn_inc; | ||
dyn_inc; | ||
static_inc; | ||
static_inc; | ||
static_inc; | ||
write; | ||
} | ||
} | ||
} |
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,12 @@ | ||
{ | ||
"m": { | ||
"data": [ | ||
0 | ||
], | ||
"format": { | ||
"numeric_type": "bitnum", | ||
"is_signed": false, | ||
"width": 32 | ||
} | ||
} | ||
} |
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,8 @@ | ||
{ | ||
ethanuppal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"cycles": 9, | ||
"memories": { | ||
"m": [ | ||
6 | ||
] | ||
} | ||
} |
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,46 @@ | ||
import "primitives/core.futil"; | ||
import "primitives/memories/comb.futil"; | ||
|
||
component main(@go go: 1) -> (@done done: 1) { | ||
cells { | ||
@external m = comb_mem_d1(32, 1, 32); | ||
i0 = std_reg(32); | ||
add = std_add(32); | ||
} | ||
wires { | ||
static<1> group init { | ||
i0.in = 32'd0; | ||
i0.write_en = 1'b1; | ||
} | ||
group dyn_inc { | ||
add.left = i0.out; | ||
add.right = 32'd1; | ||
i0.in = add.out; | ||
i0.write_en = 1'b1; | ||
dyn_inc[done] = i0.done; | ||
} | ||
static<1> group static_inc { | ||
add.left = i0.out; | ||
add.right = 32'd1; | ||
i0.in = add.out; | ||
i0.write_en = 1'b1; | ||
} | ||
group write { | ||
m.write_data = i0.out; | ||
m.write_en = 1'b1; | ||
write[done] = m.done; | ||
} | ||
} | ||
control { | ||
@fast seq { | ||
init; | ||
dyn_inc; | ||
static_inc; | ||
dyn_inc; | ||
static_inc; | ||
dyn_inc; | ||
static_inc; | ||
write; | ||
} | ||
} | ||
} |
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,12 @@ | ||
{ | ||
"m": { | ||
"data": [ | ||
0 | ||
], | ||
"format": { | ||
"numeric_type": "bitnum", | ||
"is_signed": false, | ||
"width": 32 | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this unconditionally pass
false
instead of threading throughearly_transitions
? Is it because we want to enable this if we see it in aseq
or something?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only want to enable
@fast
on the parent control, I believe, unless you had different semantics in mind?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, that makes sense! We should eventually get rid of the other
early-transition
logic entirely in a follow-up PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, there may be more cases in which we can apply
early-transition
, for example, if (as @sampsyo said) one could prove that two adjacent groups cannot bedone
at the same time; here, we could reuse@fast
's functionality, but there might be another case where it does apply recursively. That can be dealt with later though, it's not too hard to just re-add a parameter to all the functions.