-
Notifications
You must be signed in to change notification settings - Fork 52
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
Fix #800 and #814 #825
Fix #800 and #814 #825
Conversation
Fixes XIF bugs. See: openhwgroup/cv32e40x#825
rtl/cv32e40x_controller_fsm.sv
Outdated
@@ -1492,7 +1494,7 @@ module cv32e40x_controller_fsm import cv32e40x_pkg::*; | |||
commit_valid_q <= 1'b0; | |||
commit_kill_q <= 1'b0; | |||
end else begin | |||
if ((ex_valid_i && wb_ready_i) || ctrl_fsm_o.kill_ex) begin | |||
if ((ex_valid_i && wb_ready_i) || ctrl_fsm_o.kill_ex || (xif_mem_if.mem_valid && xif_mem_if.mem_ready)) begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original intention of this code was to not clear the flags until the offloaded instruction (which is also tracked by the pipeline) leaves EX, or the EX stage is killed. With this change, the flag may be cleared early, even when WB is not ready to accept a new instruction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rtl/cv32e40x_id_stage.sv
Outdated
@@ -683,6 +684,10 @@ module cv32e40x_id_stage import cv32e40x_pkg::*; | |||
|
|||
end else if (ex_ready_i) begin | |||
id_ex_pipe_o.instr_valid <= 1'b0; | |||
id_ex_pipe_o.xif_en <= 1'b0; | |||
end else if (xif_mem_if.mem_valid && xif_mem_if.mem_ready) begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point in the code, id_valid==0 and ex_ready == 0. This implies that the EX stage is not yet ready to accept a new instruction (id_ex_pipe_o must be kept stable), but the added code will insert a bubble into EX. What would happen if the offloaded load/store (in EX) must stay in EX for multiple cycles while waiting for WB to become ready (load/store waiting for data_rvalid_i for instance)? Then the EX stage would be cleared by the inserted bubble, and the offloaded instruction would no longer be tracked by the pipeline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The LSU which drives the mem_ready signal is essential split between EX (address phase) and WB (response phase)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about that case in particular. However, without this the issue in #800 occurs. Maybe there is a better fix but we couldn't find it.
Please see my review comments. Also, please file one PR per issue if possible. |
Thank you @silabs-oysteink . I replied to your comments and applied some changes. I cannot seem to find a barrier between these two issues (they must be linked) and this PR fixes them both. |
@silabs-oysteink what is the status of this PR? |
@davideschiavone For the change below, I am really hesitant to merge it for the following reasons:
In issue #800 @Silabs-ArjanB mentioned that the root cause seemed to be lack of backpressure from WB to the LSU. It seems like a fix would need to handle this and probably insert some sort of skidbuffer to ensure no data is lost. If you want, we can arrange a call to discuss this PR further. |
To help with this debugging process, I set up an environment integrating FPNew and cv32e40x with the XIF using X-HEEP. I also have a test application that fails to execute properly. You can find the repo branch here: https://github.com/davidmallasen/F-HEEP/tree/bad-xif I left some instructions and what to expect from the output here: davidmallasen/F-HEEP#1 |
@davideschiavone and @Silabs-ArjanB I tried to fix #800 and #814. Here is my attempt, let me know if it also works for you guys.