-
Notifications
You must be signed in to change notification settings - Fork 40
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
WFI instruction #112
Comments
Ahhh likely this is because of the mstatus.TW field. On NaxRiscv it is implemented as "doing nothing" I will take a look how hard it would be to implement it as the spec says |
implemented it as spike does, should be good now. WFI will always trap in user mode, and trap in supervisor mode if mstatus tw is 1 |
In the last update, why did you remove |
WFI && !(priv.isMachine() || !priv.logic.machine.mstatus.tw && (Bool(!priv.p.withSupervisor) || priv.isSupervisor())) => Dont trap if :
which mean that when in user mode, it will trap when :
right ? |
Thanks :) |
In any case, with both modifications I still have the same execution error. I will give you everything you need to be able to reproduce the execution of the two codes that fail basic_test_1_wfi_missedTrap.zip In these files you will have: Here is wfi.h code from riscv_isa_sim |
There is something weird in the basic_test_2 fst file. When i generate the hardware myself, i get other signals as "EU0_ExecutionUnitBase_pipeline_execute_0_EnvCallPlugin_WFI" Are you sure you got all the upstream changes (main branch) ? |
I am up to date with the main branch and have added your latest modification to WFI && !(priv.isMachine() || !priv.logic.machine.mstatus.tw && (Bool(!priv.p.withSupervisor) || priv.isSupervisor())) I might have shared an old Does the execution of the basic_test_1 and basic_test_2 programs work correctly for you? |
I didn't tried, as i don't know exactly what configuration you use. Also i try to avoid trying to reproduce the problem localy if it is possible for me to get the wave. Reasons is things can easily get out of sync and be hard to reproduce. For some reasons, Can you send me your verilog ? |
Hi, Sorry, there was an error in the update on my part. I forgot to include this piece of code: if (priv.p.withUser) when(WFI) {
trap := True
} Now the codes (basic test 1 & basic test_2) work correctly on my side with SocSim Thanks :D |
Cool ^^ |
Hi,
The execution of the WFI instruction causes a "trap_illegal_instruction" on the spike, but not on the DUT ?
Here is the execution result
Dump
Spike log
Tracer log
The text was updated successfully, but these errors were encountered: