-
Notifications
You must be signed in to change notification settings - Fork 53
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
Piezo, PIFOTree: static option! #1783
Conversation
@rachitnigam just tagging you in case you see an easy way to reengineer the
|
add_cell.left = reg.out | ||
add_cell.right = const(width, val) | ||
reg.write_en = 1 | ||
reg.in_ = add_cell.out |
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.
It would have been nice to have reused the existing incr
with a static
flag as an argument. I got a good way through it, but then the issue is that the dynamic version needs a line incr_group.done = ...
but the static version does not.
I'd usually do that with the Python idiom of X if b else Y
, but that doesn't tango super well with the eDSL's own with foo as bar: baz
idiom.
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.
Just paging @sampsyo in case he knows a neat way! Like basically is there some Y
such that I could do:
with foo as bar:
...
...
X if not static else Y
and the Y
would be a no-op, ignored when generating Calyx code?
If I had a nice way of doing this, I could go through and do it for lots of helpers in the eDSL!
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.
Thank you for the sync chat; it worked like a charm!
Regarding the |
|
||
with stats.continuous: | ||
stats.this().count_0 = count_0_sto.out | ||
stats.this().count_1 = count_1_sto.out | ||
eq_cell.left = flow |
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.
For now I have just written, desugared, the code that I needed. It is easy to imagine a little sugar like:
static_if_while(CellAndGroup, IfBody, ElseBody)
, that:
- Snaps apart the
CellAndGroup
intoCell
andGroup
. - Puts all of
Group
's assignments into continuous assignment land. - Finally turns itself into
static_if(Cell.out, IfBody, ElseBody)
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.
This is now #1785
@rachitnigam yes I see how this solves my Any thoughts about the |
Sorry, what does the |
Thanks Rachit! Yes so the For now I have just gone with a new trio of files ( |
I have updated the frontmatter of the PR to reflect the latest state of affairs. I think this is ready for review. |
We now have a variant of the PIFOtree-controller-dataplane setup (hereby dubbed "SDN", somewhat grandly) where the stats component is static.
I have made small improvements to the eDSL library, adding static variants as needed. The goal was to continue to do everything through
builder.py
, never needing to directly access the Calyx AST. I've been successful in that. Other programs could eventually use my new additions for cleaner code.Overall this looks successful to me: the static version is producing the same output as the dynamic version upon being fed 100 commands.