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

Reverted WPT/MPU backpressure and applied sticky LSU bits in WB instead #771

Conversation

silabs-oysteink
Copy link
Contributor

No description provided.

…he LSU."

This reverts commit f64e4b7.

Signed-off-by: Oystein Knauserud <[email protected]>
…sserted.

This can currently only happen for watchpoint triggers, in which the wb_valid would have been missed without these sticky bits.

Signed-off-by: Oystein Knauserud <[email protected]>
@silabs-oysteink silabs-oysteink added the Component:RTL For issues in the RTL (e.g. for files in the rtl directory) label Jan 27, 2023
@@ -895,13 +901,13 @@ module cv32e40x_core import cv32e40x_pkg::*;
.first_op_id_i ( first_op_id ),

// LSU
.lsu_mpu_status_wb_i ( lsu_mpu_status_wb ),
.lsu_mpu_status_wb_i ( mpu_status_wb ),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.lsu_mpu_status_wb_i -> .mpu_status_wb_i (and move to WB section)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

.data_stall_wb_i ( data_stall_wb ),
.lsu_err_wb_i ( lsu_err_wb ),
.lsu_busy_i ( lsu_busy ),
.lsu_interruptible_i ( lsu_interruptible ),
.lsu_valid_wb_i ( lsu_valid_wb ),
.lsu_wpt_match_wb_i ( lsu_wpt_match_wb ),
.lsu_wpt_match_wb_i ( wpt_match_wb ),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.lsu_wpt_match_wb_i -> .wpt_match_wb_i (and move to WB section)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

output data_resp_t core_resp_o,

// Indication from the core that there will be one pending transaction in the next cycle
input logic core_one_txn_pend_n,
input logic core_one_txn_pend_n,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use indentation as in original file (same for all I/O signals)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

end

assign lsu_valid = lsu_valid_i || lsu_valid_q;
assign lsu_wpt_match = lsu_wpt_match_i || lsu_wpt_match_q;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wpt and mpu status assignments should use the same RTL style

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

lsu_wpt_match_q <= 1'b0;
lsu_mpu_status_q <= MPU_OK;
end else begin
lsu_valid_q <= lsu_valid;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the code would be clearer if you would have something like:
if (lsu_valid) begin
lsu_valid_q <= 1'b1;
lsu_wpt_match_q <= lsu_wpt_match;
lsu_mpu_status_q <= lsu_mpu_status;
end

(as that shows the intention more clearly that we try to capture the state during a 1-cycle rvalid pulse)

assign lsu_valid = lsu_valid_q ? lsu_valid_q : lsu_valid_i;
assign lsu_wpt_match = lsu_valid_q ? lsu_wpt_match_q : lsu_wpt_match_i;
assign lsu_mpu_status = lsu_valid_q ? lsu_mpu_status_q : lsu_mpu_status_i;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

end

assign lsu_valid = lsu_valid_i || lsu_valid_q;
assign lsu_wpt_match = lsu_wpt_match_i || lsu_wpt_match_q;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 126 should use the sticky version as well (i.e. lsu_mpu_status_i, lsu_wpt_match_i, lsu_valid_i are only allowed to be used in circuit that makes these signals sticky).

lsu_rdata_i usage needs comment why it is save to be used like that (without making it sticky); add assertion proving your assumption.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update line 126 and added comments + assertion for lsu_rdata_i.

.data_stall_wb_i ( data_stall_wb ),
.lsu_err_wb_i ( lsu_err_wb ),
.lsu_busy_i ( lsu_busy ),
.lsu_interruptible_i ( lsu_interruptible ),
.lsu_valid_wb_i ( lsu_valid_wb ),
.lsu_wpt_match_wb_i ( lsu_wpt_match_wb ),
.lsu_wpt_match_wb_i ( wpt_match_wb ),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lsu_err_wb signal needs comment why it is treated differently

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments

// The WB stage will make the mpu_status sticky if wb_walid is not asserted the first cycle in WB.
// In practice this should never happen as the controller will not allow any halt or kill on a LSU in WB.
// The only exception to this is the watchpoints which are asserted separately.
a_no_sticky_mpu_error:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to have this assertion. Are you only asserting it because this should not happen or is anything relying on this not happening (explain in the comment whether this is just how the design is expected to work or whether other parts of the design depend on this property).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is added to check the assumption it should never happen. I do think the existing comments cover that assumption?

Signed-off-by: Oystein Knauserud <[email protected]>
@Silabs-ArjanB Silabs-ArjanB merged commit 1519b9b into openhwgroup:master Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component:RTL For issues in the RTL (e.g. for files in the rtl directory)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants