-
Notifications
You must be signed in to change notification settings - Fork 78
feat: add generator for capstone #1209
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1209 +/- ##
=======================================
Coverage 46.05% 46.05%
=======================================
Files 11 11
Lines 4942 4942
Branches 1345 1345
=======================================
Hits 2276 2276
Misses 2666 2666
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Cool, thanks. A few requests:
- There is a background effort to try to move what is in
backendstotools. Since this is a new tool, could you please move it there? Something liketools/python-packages/udb-capstone. - Give yourself credit! Add copyright/license information to the new files. See other files in the repo for an example that is Reuse-compatible.
- Add a regression test so that we can make sure this continues to work going forward.
I would agree that since they're all part of a switch statement, the "extra" CSRs will have no effect.
If you only need the name and the CSR address, maybe you could add incomplete YAML files for each of these CSRs that has the information you need (and anything else you are willing to add). What do you think? |
Indeed!
Thinking about this, it's not straightforward, given you are generating the contents of an internal function. Brainstorming a bit... a few ideas:
The hard part is the extract/replace. |
|
Here's a basic script which exercises the function in Capstone: Note that not all of the range of CSR addresses are mapped to a string, obviously, and some of the CSRs are associated with pseudoinstructions, and Capstone will emit those instead, so, you'll something like: |
Fixes #1146. Capstone is using LLVM Tablegen for its RISC-V dependencies. However, some sections of the code can be automatically generated.
The script
generate_csr_switch.pygenerates the list of CSRs in the function getCSRSystemRegisterName. Status of the script:Output:
@ThinkOpenly @AFOliveira