-
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
[Calyx-FIRRTL backend] Primitive Cells #1835
Conversation
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.
Looks good to me! I only had very minor nits. Merge this whenever you're ready
Thanks for the comments @EclecticGriffin ! Fixed and merged :) |
Wow! This is AWESOME!!! Just calling out the important bit in the generated FIRRTL:
Wahoo! This means, of course, is that "all we need" is an implementation of To summarize something @ayakayorihiro and I discussed synchronously, it probably makes sense to approach this in two steps:
|
Thanks @sampsyo !! In my attempts to get Step 1 (from your above comment) going I realized there's a bug in the generated |
* Initial commit: added barebones firrtl.rs as a backend option. * Fix formatting errors and try to leverage VerilogBackend * Fix formatting * first pass on inputs and outputs * fix CI formatting issue * more CI formatting fixes * temporary commit before fixing up starter code * Clean up starter firrtl translation code * Fix CI errors * Barebones test containing input/output ports and single assignment * Fix test failure caused by whitespace * clean up unnecessary comments * Port guard support and some refactoring for converting ports to FIRRTL * First steps for recursive guard building + more refactoring * Guard support and tests * Updating firrtl.rs to support guards * Fix formatting issues * additional formatting fix * Added default assignment to 0 for guard failure and fixed expected output * Added default initialization statements for assignments with guards * adding test to make sure that there's only one invalid initialization per unique dest * fixing attributes and "is invalid" initialization * First steps to support non-primitive cells * Fixing hardcoding of main as the top level component * Fix formatting errors * More formatting fixes * Remove unnecessary FIXME * Create extmodule name from primitive information. Need to extract into a function * extracted function to get a FIRRTL module name given internal primitive data * emit extmodule declarations * Fix formatting errors * Add test for instantiating cells and creating extmodules for primitive cells * merged main and made changes based on PR comments * Fix typo * add another simple test * Fixes from PR comments
Note: I'm making this PR now so that I don't have any unfinished business left in 2023 😅 Please feel free to ignore until 2024!
I added support for cells that instantiate primitives! The approach involves (1) converting each unique primitive instantiation into a unique identifier (ex.
std_add(32)
→std_add_32
), (2) creating anextmodule
declaration at the beginning of the FIRRTL file for such identifiers, and (3) converting each cell instantiation to a correspondinginst ...
statement in FIRRTL.I also incorporated @EclecticGriffin 's feedback from the last PR into this one. Thanks again for the feedback!!