-
Notifications
You must be signed in to change notification settings - Fork 8
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
Illegal instruction exception on vector instructions in Linux user-mode programs #60
Comments
Thanks for reporting this. I wasn't able to reproduce this, oddly, but I suspect your analysis might be on to something. What is odd is that status.VS should already be enabled (not 0) prior to the Can you clarify what versions of Shuttle and Saturn you are using? |
I'm currently using chipyard 1.13.0 with bundled Saturn (4ed795b) + Shuttle (b431fecd). In my setup I added some modifications for running on FPGA (add MMIO and slave port, unified clock frequency, etc.), I also used a custom verilog top module to connect to the SoC, but I don't think they are relevant to this issue. Attached is some waveform I captured on FPGA, it seems |
Thanks for your test, I added It looks like Waveforms: vaadd_vv_waveforms.zip, you can have a look at them, thanks! |
Interesting, it looks like mstatus.VS is set to Off in this code. So the real bug is that the first vset should have trapped, while the implementation did not trap. The fix for shuttle and rocket are here: chipsalliance/rocket-chip#3692 ucb-bar/shuttle#7 |
Thanks for the fix! I also updated kernel to 6.11.4 with |
I'm running Saturn+Shuttle on a custom FPGA platform, and successfully boot mainline Linux 6.1.114. Programs without vector instructions are working fine.
However, many vector programs raise illegal exception on the first vector instruction executed after
vset{i}vl{i}
. The programs are all tested on Spike and runs normally. The failing asm sequence is below. (this program is the start ofvaadd_vv-0
testcase from riscv-vector-tests, compiled withMODE=user
, if relevant)Linux kernel dmesg on this exception:
Upon further inspection, I found if I insert 5 or more 16-bit NOP instruction between
vsetvli
on0x8000000c
andvmv.v.i
on0x80000010
, the program can run normally without exception. Also, further vector instructions in the same program won't raise exception, only the first vector instruction fetched raise this exception. The modified asm looks like:I tested the same on both
GENV256D128ShuttleConfig
andREFV512D512ShuttleConfig
, the results seem the same. I'm guessing this is caused by dependencies ofstatus.VS
to other vector instructions not correctly handled by Shuttle core. Since the added NOPs could have break this dependency. Additionally, Saturn+Rocket (REFV256D128RocketConfig
) works normally without this issue.However, since I'm running on a FPGA platform, getting detailed waveform can be a little tricky. So I'm filing this issue to ask for any help or ideas, thanks a lot for this awesome project!
The text was updated successfully, but these errors were encountered: