rocket-chip icon indicating copy to clipboard operation
rocket-chip copied to clipboard

Exception cause differs between Rocket and Spike

Open scanakci opened this issue 3 years ago • 0 comments

Type of issue: bug report

Impact: unknown

Development Phase: proposal

Other information During the execution of the attached program, Rocket raises store page fault exception while Boom, Spike, and Dromajo raise store address misaligned exception. Given that the priority of store address misaligned exception is higher than store page fault exception, we think Boom, Spike, and Dromajo behave correctly.

More details (also a table provided below): The commit trace of Rocket simulation differs from BOOM simulation, Spike and Dromajo. Test elf is provided; the mismatch is at PC=8000_02e8. Our analysis is as follows:

  1. sret is executed (in privilege level 3) (PC: 8000_02e4)
  2. next expected PC is 8000_0ba8, but there's an instruction page fault exception (and so, the next PC=stvec=8000_02e8). Note that medeleg is nonzero (0xb100) so there is an exception delegation to supervisor and the address is printed as 0xffff_ffff_ffe0_02e8
  3. the instruction at 0xffff_ffff_ffe0_02e8 executes without issue;
  4. next PC = 0xffff_ffff_ffe0_02ec; there's a store address misaligned exception; (and so, the next expected PC mtvec=8000_018c ). At this point, Rocket catches a store address page fault exception, not a store address misaligned exception. Commit traces differ starting from this point. Rocket jumps to stvec address again because of delegation of the store address page fault exception and loops forever. However; Boom, Spike, Dromajo jumps to mtvec since store address misaligned is not delegated to supervisor. Overall, the mismatch is related to the type of exception raised by Rocket vs Others at

If the current behavior is a bug, please provide the steps to reproduce the problem: In rocket-chip repo after compiling emulator, cd emulator ./emulator-freechips.rocketchip.system-freechips.rocketchip.system.DefaultConfig +verbose test_536.elf |& tee run.536.log

What is the current behavior? Rocket raises store address page fault exception.

What is the expected behavior? Rocket (should) raise store address misaligned exception.

Please tell us about your environment: commit: 400f99530790a0e149f4d9b52b7ddbcafd41c653 Linux 3.10.0-1160.36.2.el7.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux

Screenshot 2021-11-28 at 00-28-31 fail_536

exception_mismatch.zip

scanakci avatar Nov 28 '21 07:11 scanakci