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

Does NaxRiscv update mtval after trap illegal_inst? #107

Open
zhangkanqi opened this issue May 31, 2024 · 2 comments
Open

Does NaxRiscv update mtval after trap illegal_inst? #107

zhangkanqi opened this issue May 31, 2024 · 2 comments

Comments

@zhangkanqi
Copy link

Hi,
It seems NaxRiscv wants to update tval when trapping exception in the source codes.

But I found that when encounters illegal_inst exception under U-mode(the exception is trapped into M-mode), NaxRiscv doesn't update mtval correctly, the value of mtval is still 0x0.

@Dolu1990
Copy link
Member

Hi,

I tried to reproduce, but on my side it is fine :

#include "../../driver/privileged.h"
  trap_setup
  machine_to_user
  .word 0xffffffff
  trap_handle
  csrr x1, mtval // => 0xffffffff
  j pass

I would need your exact setup to reproduce.
When using fuzing, i noticed that very often the symptoms detected by the testbench are kinda far apparts from the reason why things are going wrong :)

@zhangkanqi
Copy link
Author

zhangkanqi commented May 31, 2024

Sorry, I will provide all files used for debugging in later issues. I'm a little bit lazy this time hh.
For debug:
update_mtval_incorrect.zip

For reproduce:
NaxRiscv: f335738

cd $NAXRISCV
vim NaxRiscv/src/main/scala/naxriscv/Gen.scala # enable Rvc&float&double in Gen64
sbt "runMain naxriscv.Gen64"
cd $NAXRISCV/src/test/cpp/naxriscv
./obj_dir/VNaxRiscv --load-elf=./input_nax_53.elf --start-symbol=_start --pass-symbol=write_tohost --timeout=100000 --name=input_nax_0 --trace --trace-ref --spike-debug

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

2 participants