Closed zhangkanqi closed 6 months ago
Hi,
scause is implemented with bits XLEN-1 and 3:0 All the other bits are hard wired to 0.
Which is a valid implementation, scause shouldn't be used to store arbitrary value.
Thanks for your reply. Did you mean that scause can be wrote by any value in M-mode(in this case, the value read from scaure is zero), but actually NaxRiscv only supports to modify scause when encounter exception in S-mode(in this case, the value read from scaure is the exception code)?
I meant that only a few bits of mcause/scause are implemented. Those bits can be read write by both the hardware and the software
Oh! I see! 🤦♀️ 0xc0010 didn't affect the last four bits of scause. So the value read from scause is zero. Thanks for your prompt response again.
Environment: commit id: 6af1a20158f6402196c1f17f47680b96e0a88b86
Description: The instructions are as follows: (from spike.log)
(1) Set
scause
to 0xc0010; (2) Then encounters an illegal_instruction exception; (3) Readscause
and get value 0xc0010;NaxRiscv does the same as Spike in step (1) and (2). However, NaxRiscv gets 0x0 in step (3) while Spike gets the expected value 0xc0010.
For debug and reproduce: input_6.zip
I have no idea why NaxRiscv gets 0x0 when reading
scause
. Could you help me solve this problem?