-
Notifications
You must be signed in to change notification settings - Fork 234
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
how does %hi
work for RISC-V 64?
#63
Comments
BTW, if I want to test something, which tools can help me please? Which tools can run the ASM code? |
%hi is always bits 31:12. However it is a little more complicated than that, since we always use lui with an add, so if the low 12 bits are equal to or greater than 0x800 then we need to round the %hi value up by one, and then use a negative value for the %lo. If you assemble and link asm code, then it can be run in any smiulator. We have spike (riscv-isa-sim) which is best for hardware folk, qemu which is best for software folk, and a gdb sim which is useful if you are familiar with it. |
Thanks for your valuable reply! I will close this issue soon. |
I build a test toolchain on my machine, and run:
That looks like the |
Because the immediate operand in the |
Thanks for your kindly help! |
I know that %hi(symbol) will get the high 20 bits of the symbols' address and then be as a immediate number in RISC-V 32. In short, take the
[31:12]
bits in RISC-V 32.But in RISC-V 64, will it get the
[31:12]
bits, or just get the[63:44]
bits?Thanks for your help.
The text was updated successfully, but these errors were encountered: