Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

BNE doing absolute jumps instead of relative #3

Open
jona250210 opened this issue Dec 19, 2023 · 0 comments
Open

BNE doing absolute jumps instead of relative #3

jona250210 opened this issue Dec 19, 2023 · 0 comments

Comments

@jona250210
Copy link

I've been playing around with the compiler and I am not sure, if I understand the specification of RISC-V wrong, but from my understanding the jumps should be relative to the current PC. When testing this program

addi x4, x3, -5
add x5, x4, x0
test:
	sll x5, x5, x5
	bne x5, x4, test

this compiler outputs 00000000010000101001010001100011 for the BNE line, GNU as gives me 11111110010000101001111011100011. The imm part translates to 8 and -4 respectively. Am I correct that jumps are done absolutely? And if yes, can this be changed easily?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant