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.
(Same changes as #5557, just using my own fork instead of Andrew's ... sorry for confusing way of doing this).
Two small changes in
SCFToCalyx
(they're unrelated but both pretty small so I thought both could go in a single PR)When we see a memref w/o dimensions (e.g.,
memref<i32>
), we should lower it in Calyx to a 1 dimensional memory of size 1, since Calyx memories must have explicitly defined dimensions. Before it was erroring out when trying to export to Calyx, complaining that Calyx doesn't support "0-dimensional" memories.This is a bit nuanced, but I also changed the way we compile binOps (e.g., multiply, divide, etc.) to be more correct.
Previously, binOps were compiled into groups as follows:
However, this is technically triggering
binOp.go
for the entire group, which means that it's being triggered even for the cycle that we spend writing into the register. The binOp being triggered for an extra cycle normally doesn't matter, but it does sometimes affect thebinOp.out
value when we try to read from it later on. Specifically, I was running into tricky bugs when thebinOp
was a signed division, but this fixed it:Just as an FYI, this way of compiling groups (with the
binOp.go = !binOp.done ? 1'd1;
) is the standard way to perform a "binOp then write to register" in Calyx. For example, the Dahlia->Calyx compiler does this same behavior