-
Notifications
You must be signed in to change notification settings - Fork 44
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
MEPC goes to zero when waking from clock gating on FPGA #1220
Comments
@kgugala would you be able to help debug this isse we're seeing with on VeeR (on FPGA) when existing sleep states? |
Changing the FPGA back to TEC_RV_ICG massively increases the FPGA utilization to the point where it has no chance of fitting on the ZCU104. |
By changing flush_lower_ff to use free_l2_clk instead of the gated clock the scenario from Arthur passes.
There are a number of other rvdff's instantiated in el2_dec_tlu_ctl that also use free_l2clk instead of clk. |
Similar behavior noted in a VEER issue: chipsalliance/Cores-VeeR-EL2#88 |
Once we address this, should we enable clock gating in the CI FPGA bitstreams to make sure all the tests run against this fix? |
It appears that the VeeR issue with verilator is related to how the TEC_RV_ICG file attempts to convert the clock gate latch to a negedge flip flop for verilator runs. This causes the delayed sampling. Are you running on FPGA without RV_FPGA_OPTIMIZE? What's the reasoning for turning this off? If so, I suspect that your issue is similar. Probably something to do with the clock gate latch not playing nicely on FPGA? |
@jhand2 I haven't wanted to enable it by default, but we could enable it in an additional FPGA run. I'll talk to Kor about it, I worry about adding too many FPGA builds in CI. |
With the firmware changes WFI in #1193 after the CPU wakes back up MEPC is zero instead of the interrupted instruction.
interrupt_valid causes mepc to sample npc_r.
The most relevant seeming driver for npc_r is tlu_flush_path_r_d1 (delayed one clock from the version captured above) when tlu_flush_lower_r_d1 is high.
At this point tlu_flush_path_r_d1 has zero, which was loaded from the interrupt_valid_r assertion at clock 513. This wipes out the value of 0x20003161, which had previously captured the PC value.
The text was updated successfully, but these errors were encountered: