-
Notifications
You must be signed in to change notification settings - Fork 231
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
Error with the first bit of the immediate value in some instructions #5
Comments
This is really an issue with user interface rather than the assembler. There are two possible ways to interpret And It would be possible to try the sign extended version if there was a error later down the line, but that is non-trivial to implement. I don't know an easy way to improve RARS to handle this more graciously (including even giving a more detailed error message), but I do recognize that it is a problem. TLDR: |
Whats the reason of the following warning when loading Also, for I'm willing to try and fix both of these issues, any tips or things I should keep in mind while doing so would be appreciated. |
It would probably be good to widen the bounds for .byte and .half to allow for the maximum unsigned value the can store because there is no sign extension issue. Do note though that it is just a warning. The code works as intended with
If I had a good idea on how to provide a better error message, I would leave it open. However, as stated above, I don't know how to improve this and ultimately its a UI problem rather than a correctness one.
RARS is the closest you will get to a real RISC-V architecture among educational simulators. Specifically for the issue at hand (an assembling rather than simulating issue), gcc agrees with RARS that
For the issue with For the error around If you want to help out with an error message overhaul, I would suggest opening up an issue showcasing existing error messages that are unclear. This would potentially help people that might google their error and it would help me figure out the best way to change the error system. I wouldn't spend the effort for just |
I was surprised that gcc also throws an error for that, as immediate are 12-bits and
Which is not intuitive to use a negative hex ( |
So if 0x800 was a valid immediate, what would you expect t0 to after executing this
If you are expecting And I would say that expecting
I don't believe RARS supports negatives in front of hexadecimals, but using |
I would expect
I have tried it with couple of examples and it does works as the gcc assembler does. |
Apparently, the Also, the error is duplicated for some reason
|
Unterminated strings were mentioned in #29, I decided to make them an error because it was slightly technically easier. Also I don't know of any riscv assembler which allows unterminated strings. The range warnings for .byte and .half were improved to not warn on values the fit in an unsigned byte/half and to say exactly how the value is truncated. Now it matches how gcc handles it. This was mentioned in #5
testing with andi instruction
testing with ori instruction
the same happens with lui instruction, rars is not able to assemble these instructions whenever the first bit of the immediate number is equal to 1.
The text was updated successfully, but these errors were encountered: