Skip to content
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-Backend] Use Morty to link external libraries #2378

Merged
merged 12 commits into from
Jan 24, 2025

Conversation

jiahanxie353
Copy link
Collaborator

This patch is the first half of #1928

We use Morty: https://github.com/pulp-platform/morty to pickle Verilog/System Verilog files needed as libraries.

Acknowledgement to @evanmwilliams for the original implementation.

calyx-backend/src/verilog.rs Outdated Show resolved Hide resolved
@jiahanxie353
Copy link
Collaborator Author

Also added HardFloat as a compilation library; as well as corresponding tests cases.

Ready for another round of review, thanks!

calyx-backend/src/verilog.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@ekiwi ekiwi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions / potential for improvement.

Copy link
Contributor

@ekiwi ekiwi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All my comments have been addressed. We need to hear from @rachitnigam before this is merged, since it is a pretty major change to a part of the codebase that I am not familiar with.

@jiahanxie353
Copy link
Collaborator Author

All my comments have been addressed. We need to hear from @rachitnigam before this is merged, since it is a pretty major change to a part of the codebase that I am not familiar with.

sounds good, thank you!

@jiahanxie353
Copy link
Collaborator Author

Hey @rachitnigam , could you review it when you are available?
There are a couple of CIRCT/Calyx users already reaching out to us regarding Calyx's support for floating-point computations. It'll be helpful to get this merged soon and your review is crucial!

@rachitnigam
Copy link
Contributor

will try to take a look tonighta

@@ -0,0 +1,97 @@
`ifndef __ADDFN_V__
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these files committed to the repo? I thought there is a script below that will download the file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the scripts will download additions/multiplications in the "Recoded formats" (such as addRecFN.sv), which is not IEEE standard formats:

Rather than operate on the standard formats directly, HardFloat prefers to translate IEEE-encoded values into equivalent recoded formats and operate on those alternative representations instead. The main purpose of the recoding is to make subnormals be normalized, aligned with other floating-point values, thus reducing the complexity of floating-point operations.

New files like addFN.sv is a wrapper for addRecFN by doing internal format-transformations so that users can pass in standard IEEE formats.

@@ -0,0 +1,19 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a documentation section under the standard library that tells people that they need to run this command to get the floating-point libraries?

Also, this will be tricky to make work with the Compiler release (cargo install calyx) which essentially bundle all the Verilog files and save them on the user's computer. It might make sense to expose a subcommand to the calyx binary to download these kinds of dependencies. Can you open an issue about this part (and add the documentation to this PR)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, no problem!

Copy link
Contributor

@rachitnigam rachitnigam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your hardwork on this @jiahanxie353! It is really cool to see this actually working so great work on getting the tricky parts of morty sorted out.

I've left a couple of top-level comments. @ekiwi can you shepherd them through and approve the merge when they are done?

@jiahanxie353
Copy link
Collaborator Author

Thank you so much for the review @rachitnigam !

I have made changes based on the request, and ready for another round of review @ekiwi !

Copy link
Contributor

@ekiwi ekiwi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :shipit:

@ekiwi ekiwi merged commit 13a942b into calyxir:main Jan 24, 2025
9 checks passed
@jiahanxie353 jiahanxie353 deleted the morty-multi-file branch January 24, 2025 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants