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

False pass in CHECK_XLEN #38

Open
wyvernSemi opened this issue Jun 28, 2022 · 0 comments
Open

False pass in CHECK_XLEN #38

wyvernSemi opened this issue Jun 28, 2022 · 0 comments

Comments

@wyvernSemi
Copy link

The RVTEST_CODE_BEGIN macro, defined in riscv_test.h uses macro the CHECK_XLEN macro. This macro is defined as:

#if __riscv_xlen == 64
# define CHECK_XLEN li a0, 1; slli a0, a0, 31; bgez a0, 1f; RVTEST_PASS; 1:
#else
# define CHECK_XLEN li a0, 1; slli a0, a0, 31; bltz a0, 1f; RVTEST_PASS; 1:
#endif

I believe this is checking that if 1 is shifted 31 bits then this will be a negative for 32 bit and not negative for 64 bit lengths, and will branch if correct. If this is not correct then RVTEST_PASS is executed. I would expect this to be RVTEST_FAIL. A bug in an implementation meant that the code did not branch but then set the test 'passed' criteria and did the ecall. This gave a false positive. and was picked up because a smaller number of instructions were retired than expected.

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

1 participant