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

Differences in performance of the lhu command on Rocket and spike #3698

Open
90ICEDA opened this issue Nov 13, 2024 · 1 comment
Open

Differences in performance of the lhu command on Rocket and spike #3698

90ICEDA opened this issue Nov 13, 2024 · 1 comment

Comments

@90ICEDA
Copy link

90ICEDA commented Nov 13, 2024

Type of issue: bug report
Impact: unknown
Development Phase: proposal
Other information:

Hi, I noticed a difference between Rocket and spike implementations, when executing the lhu x8,-7(x21) instruction, spike will execute normally while Rocket will report an error about not being aligned, is this a stricter measure taken by Rocket in handling alignment errors?
I hope to get your reply, please correct me if my thinking is wrong, thanks!

@caizixian
Copy link

Per the spec

Regardless of EEI, loads and stores whose effective addresses are naturally aligned shall not raise an
address-misaligned exception. Loads and stores whose effective address is not naturally aligned to the
referenced datatype (i.e., the effective address is not divisible by the size of the access in bytes) have
behavior dependent on the EEI.

So unaligned access can fault, and it does in Rocket Chip. See

val misaligned = (io.req.bits.vaddr & (UIntToOH(io.req.bits.size) - 1.U)).orR

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

No branches or pull requests

2 participants