Skip to content
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

JAL - target address is always computed with byte aligned offset value #9

Open
shivanishah269 opened this issue May 13, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@shivanishah269
Copy link
Collaborator

The RISC-V ISA mandates that if the target address is not 4-byte aligned then the exception must be raised. The check on byte-alignment is on the target address not the target offset. The RTL is doing this on the target offset. Hence, JAL target address check fails.

For reference the spec we have used is the 2019 version of the base ISA. The exact specification lines are recorded here for easy reference.
"The JAL and JALR instructions will generate an instruction-address-misaligned exception if the target address is not aligned to
a four-byte boundary."

There appears to be a fundamental issue with the processor design in that all references to PC for additions to immediate values happen to be on 30 bit values of PC rather than 32 bits (ISA requirement). This results in address computations for JAL, and other B-type instructions to yield incorrect address values.

JAL_target_fail.vcd.gz

@shivanishah269 shivanishah269 added the bug Something isn't working label May 13, 2021
@shivanishah269 shivanishah269 self-assigned this May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant