Conversation
ayakayorihiro
requested changes
Feb 19, 2026
Contributor
ayakayorihiro
left a comment
There was a problem hiding this comment.
This is looking good! I left a couple of comments about things we should change before we merge.
| } | ||
| } | ||
| ``` | ||
|
|
Contributor
There was a problem hiding this comment.
Sorry, since we're writing all of this - can you also add some documentation about adding primitives to firrtl option too (which is to just add the SystemVerilog implementation of the primitive to primitives-for-firrtl.sv)?
docs/running-calyx/firrtl.md
Outdated
| ### Adding Primitives for `firrtl-with-primitives` | ||
|
|
||
| 1. **Create a Template:** Add a `.fir` file to `tools/firrtl/templates/`. The filename should match the primitive name (e.g., `std_add.fir`). | ||
| 2. **Define the Interface:** The template must define a `module` whose ports (names and widths) exactly match the `extmodule` emitted by the Calyx backend in `calyx/backend/src/firrtl.rs`. |
Contributor
There was a problem hiding this comment.
Hm, I don't think the FIRRTL backend emits extmodules when we use it for firrtl-with-primitives (the build.ninja file in the generated fud2 directory will show you this, we can look through this next wednesday if you'd like). Maybe you mean something else?
| 1. **Create a Template:** Add a `.fir` file to `tools/firrtl/templates/`. The filename should match the primitive name (e.g., `std_add.fir`). | ||
| 2. **Define the Interface:** The template must define a `module` whose ports (names and widths) exactly match the `extmodule` emitted by the Calyx backend in `calyx/backend/src/firrtl.rs`. | ||
| 3. **Update the Replacement Map:** If your primitive uses unique parameters, update the replacement map logic in `tools/firrtl/generate-firrtl-with-primitives.py`. | ||
| 4. **Testing:** Add a `runt` test in `tests/firrtl/primitive-templates` to ensure the new implementation generates valid FIRRTL and produces correct simulation results. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.