-
Notifications
You must be signed in to change notification settings - Fork 189
Add mtopi CSR #347
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
Add mtopi CSR #347
Conversation
rmsyn
left a comment
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.
Thanks for your contribution!
AI Assistance:
Parts of the explanation and understanding of the mtopi CSR were assisted using an AI tool to summarize its behavior in the context of the RISC-V Advanced Interrupt Architecture (AIA). All code and implementation decisions were written and verified manually. NO CODES WERE GENERATED WITH THE HELP OF AI.
Thank you for explicitly stating your use of AI tool assistance. AFAIK, we currently do not have a policy on AI contributions. IMO, we should ban AI contributions, even for "just documentation/explanation". Such contributions have deep issues with plagiarism, and we cannot possibly verify the provenance of of the training data.
"Manually" rewriting suggestions from AI is not the same as manually implementing the changes. You're already contradicting yourself by saying that AI only helped by providing explanations/documentation, and that you manually rewrote code suggested by AI.
@romancardenas what are your thoughts on adding a section on AI to our CODE_OF_CONDUCT.md, or creating a CONTRIBUTING.md? After your recent back and forth on @KushalMeghani1644's contributions, how do you feel about their usage of AI?
|
Hey @rmsyn thanks for putting time to my PR! I feel there is maybe a little misunderstanding upon the "AI DISCLOSURE" part, I have clearly stated in the PR desc that: "Parts of the explanation and understanding of the mtopi CSR were assisted using an AI tool to summarize its behavior in the context of the RISC-V Advanced Interrupt Architecture (AIA). All code and implementation decisions were written and verified manually. NO CODES WERE GENERATED WITH THE HELP OF AI." See the "parts" word! I meant that only a few little queries and all were asked from AI to understand how Mtopi actually works since I haven't studied much on this CSR, and the codes WERE NOT generated by AI, I had indeed went through the official docs of https://tools.cloudbear.ru/docs/riscv-aia-1.0-20230630.pdf to understand mtopi well. And also this line by you, ""Manually" rewriting suggestions from AI is not the same as manually implementing the changes. You're already contradicting yourself by saying that AI only helped by providing explanations/documentation, and that you manually rewrote code suggested by AI." I hadn't not manually rewritter what AI gave me, I stated in the "AI DISCLOSURE" section in capital words that, "NO CODES WERE GENERATED WITH THE HELP OF AI." Edit: Also just to be transparent, my previous PRs that were merged had 0 use of AI in the codes! Those PRs were purely made by my brain + hands :D Thank you :) |
|
Hey @rmsynI've updated the mtopi tests to use test helper macros as requested. Created a |
The official link to the AIA specification (from the RISC-V Atlassian repo) is a Google Docs link RISC-V AIA], maybe the cloudbear.ru link you posted is a mirror of that document? Regarding your previous contributions, that's fine if you indeed contributed all those changes yourself. I was asking for @romancardenas to give feedback on allowing your AI contirbutions after the experience of reviewing your previous contribution. |
Hey! sorry if I was too harsh in my previous comments. I was just trying to be as transparent as I can! cause I always find it fun to contribute to OSS projects, especially bare metal codes like RISCV. Apologize for the inconveniences caused by me here. I hope that I have cleared out that everything is fine now :) And yes the cloudbear.ru link is a mirror, I for some reason wasn't able to find the official docs from RISCV, thanks for providing the links though. |
|
Hey! @rmsyn (sorry for pinging if you were busy) I've added a new arm to the existing test_csr_field! macro instead of creating a separate one. The macro now supports read-only CSR fields with the pattern [start:literal, end:literal] and mtopi tests now use the standard macro. Thanks for the clarification! |
rmsyn
left a comment
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.
Hey! @rmsyn (sorry for pinging if you were busy) I've added a new arm to the existing test_csr_field! macro instead of creating a separate one. The macro now supports read-only CSR fields with the pattern [start:literal, end:literal] and mtopi tests now use the standard macro. Thanks for the clarification!
No worries, and thanks for making the changes. I have a couple other suggestions, otherwise LGTM outside the question of AI contributions.
|
Hi @rmsyn I have removed the helper functiosn as requested! I hope the changes are fine :) if there are more improvements remaining, I'd be happy to fix them :D |
|
Hey @rmsyn and @romancardenas sorry for disturbing but can I please get any updates on what do I have to do with this PR next? |
|
A unrelated change @romancardenas (maybe) but I have fixed the spelling in aclint.rs, I hope you are fine with that :) if you think its unrelated to this PR I can also remove the commits. |
|
I am sorry, but seems like most the things @romancardenas has asked are fixed, if there are more changes required, I would definitely make them but I'll be slow to respond just for 2 or so days. Either way I am sorry for the other hurdles that were caused... I would wait for a response :) thanks |
|
@KushalMeghani1644 please add a reference value to the test macro branch, so the macro actually checks against an expected value |
|
I am quiet unsure if the CI failing is my fault... I would like some guidance here, but it doesn't seem like my changes broke anything here... I didn't even touch the |
|
Looks like the new version of syn bumped the MSRV to 1.68... I was thinking on bumping MSRV to 1.81 with riscv-types, so it shouldn't be a big deal. Let put this PR in standby until I do all the required work. |
|
OK then, I'll wait :) |
|
Rebase from master, fix conflicts (mainly you will need to remove your typo fixes in riscv-peripheral, as they are already fixed), and CI should pass |
34efc27 to
c646018
Compare
|
I hope this was fine @romancardenas :) |
| test_csr_field!(mtopi, iid: [16, 27], 0x0); | ||
| test_csr_field!(mtopi, iprio: [0, 7], 0x0); | ||
|
|
||
| let mtopi = Mtopi::from_bits((11 << 16) | 5); |
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.
For clarity, so the numbers coincide with the next checks
| let mtopi = Mtopi::from_bits((11 << 16) | 5); | |
| let mtopi = Mtopi::from_bits((0xB << 16) | 0x5); |
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.
My bad, I added a bug to your tests! In any case, it served me to notice that tests are not currently being executed in the CI.
|
Thanks for the suggestions + commits @romancardenas is there any other changes that I should make? |
romancardenas
left a comment
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.
Please, rebase again from master. You will notice that CI does not pass. Did you try to run the tests on your machine? Because it does not even compile
| test_csr_field!(mtopi, iid: [16, 27], 0x0); | ||
| test_csr_field!(mtopi, iprio: [0, 7], 0x0); | ||
|
|
||
| let mtopi = Mtopi::from_bits((11 << 16) | 5); |
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.
My bad, I added a bug to your tests! In any case, it served me to notice that tests are not currently being executed in the CI.
b85fc8f to
6d75606
Compare
|
I have messed up something here.... letme convert this into a draft, when its ready I'll mark it ready for review |
6d75606 to
257c3d6
Compare
…nto new test_ro_csr_field! macro
|
OK finally, everything passes, besides 1 CI that doesn't seem my fault... it has troubles updating the rust toolchain. Either way, I apologize but while I was trying to force-push, rebase, and do all the git stuff, I had messed up allot leading to all my commit history lost. So I hope so you are fine with just 2 commits at the moment, the code is as-it-is besides the changes that I made to fix the CI failing... I am sorry for complicating this quiet allot. |
|
There are too many changes in your PR that are not required. As reviewing this would take too long, I will close this PR. You can create a new PR from scratch, starting from the current master branch, with a clean commit history. |
|
I'll definitely re-work on this then :) |
This PR adds support for the
mtopi(Machine Top Priority Interrupt) CSR, which is part of the RISC-V Advanced Interrupt Architecture (AIA) extension.Changes:
mtopi.rsregister implementation at address 0x7C0register.rsiid(Interrupt ID): bits 16-27iprio(Interrupt Priority ID): bits 0-7Features:
Testing:
AI Assistance:
Parts of the explanation and understanding of the mtopi CSR were assisted using an AI tool to summarize its behavior in the context of the RISC-V Advanced Interrupt Architecture (AIA). All code and implementation decisions were written and verified manually. NO CODES WERE GENERATED WITH THE HELP OF AI.