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

[Bug] jalr to link register #96

Open
JaewonHur opened this issue Dec 2, 2019 · 3 comments · May be fixed by #105
Open

[Bug] jalr to link register #96

JaewonHur opened this issue Dec 2, 2019 · 3 comments · May be fixed by #105

Comments

@JaewonHur
Copy link
Contributor

JaewonHur commented Dec 2, 2019

When mor1kx receives 'jalr to link register (r9)'
illegal instruction exception should be asserted as in or1ksim, but it doesn't

You can reproduce by inserting 'insn: 0x48004800'

in mor1kx_decode.v, changing as below should fix this.

always @*
 case (opc_insn)
  `OR1K_OPCODE_JALR:
   if (decode_insn_i[`OR1K_RB_SELECT] == 9)
    decode_except_illegal_o = 1'b1;
@stffrdhrn
Copy link
Member

This makes sense. But it doesn't seem to be in the spec to assert the exception in this case. The spec says:

It is not allowed to specify link register r9 (see Register Usage on page 335) as rB.
This is because an exception in the delay slot (including external interrupts) may cause
l.jalr to be reexecuted.

It's not clear that the exception assertion is correct. Do you have any thoughts?

@JaewonHur
Copy link
Contributor Author

According to the spec, prohibited instruction may leave the cpu state in undefined state.

In this case, I think whether asserting exception or not depends on the designer.

@stffrdhrn
Copy link
Member

Yes. In that case we can add this.

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

Successfully merging a pull request may close this issue.

2 participants