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

Need coverage for multiple of 2 integer jumps/branches in compressed test plan #258

Open
davidharrishmc opened this issue Oct 26, 2024 · 5 comments

Comments

@davidharrishmc
Copy link
Collaborator

Jumps and branches allow the target address to be a multiple of 2 rather than 4 because compressed instructions can be two bytes. However, in RV{32/64}I, there are no compressed instructions and no way to hit addresses that are not multiples of 4.

I think the best solution is to add uncompressed jal and jalr rows to the Zca tests. These should have two coverpoints consisting of rd[1] = 1 and imm[1] = 1. jalr also needs to be able to test a case where rs1+imm is odd; the bit [0] should be ignored. We need to test both rs1[0] = 1, imm[0] = 1, and rs1[0] + imm[0] = 1. See the unprivileged spec about jalr. That way these features can be tested when compressed instructions are supported, and everything else is tested in the usual I tests.

Same thing applies to branches

@Zain2050
Copy link
Contributor

If we add uncompressed jal and jalr to the Zca testplan, some portion of uncompressed jal test would then be in I Extension and some would be in Zca. It will scatter the test for uncompressed jal/jalr.
What if we allow jal and jalr to get compressed by making changes in the Makefile. This way we could add c.nop instructions in the test which will eventually result in address multiples of 2. However, some jal/jalr instructions with rs1 as x1 would also get converted to compressed form as well. Those instructions would still hit uncompressed jal/jalr bins. If that's okay, then perhaps we can use that approach. Just a suggestion!

@davidharrishmc
Copy link
Collaborator Author

davidharrishmc commented Oct 28, 2024 via email

@Zain2050
Copy link
Contributor

Guess I didn't think about running the tests on a pure RV32I machine. This clears up everything.
I'd be happy to work on this issue, but probably from the next week as I'm a bit occupied due to my midterm exams. If that's okay, you could assign this issue to me.

@UmerShahidengr
Copy link

Good thought @Zain2050. In my opinion, this issue should be assigned to the person who has implemented jal/jalr tests for RV32/64I.
For such cases, non-multiple of 4 addresses, won't it create misaligned access fault when we jump to that address? Probably we need to enable misaligned access in order to check such cases.

@jordancarlin
Copy link
Member

I don't think it is a misaligned access if compressed instructions are supported (which I believe is the scenario being discussed here). When compressed instructions are supported the alignment constraint is relaxed to increments of 2 instead of 4. For RV32I (without Zca) then it would be a misaligned access, but that shouldn't ever happen if the Zca tests are being run.

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

4 participants