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

Fixed todo's related to mul_en/div_en i EX stage #902

Merged

Conversation

silabs-oysteink
Copy link
Contributor

Factored halt_ex/kill_ex out of mul_en and div_en - multiplier and divider now handles them theirselves.
In the divider, div_en_i and valid_i was then duplicates, changed to using only valid_i.

SEC clean (with multiplier operation converted to add to enable converging SEC)

… EX stage.

Routing halt_ex and kill_ex into the multiplier and divider, making sure no state updates occur while halted and that the modules properly drive valid/ready according to halt/kill.

SEC clean (multiplier operation was converted to addition to be able to complete SEC run)

Signed-off-by: Oystein Knauserud <Oystein.Knauserud@silabs.com>
@silabs-oysteink silabs-oysteink added the Component:RTL For issues in the RTL (e.g. for files in the rtl directory) label Aug 8, 2023
@@ -115,7 +118,7 @@ module cv32e40x_mult import cv32e40x_pkg::*;
mulh_acc_next = mulh_acc;

// Case statement assumes valid_i = 1; the valid_i = 0 scenario
// is handled after the case statement.
// is handled after the case statement.
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove comment (no longer accurate)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

Comment seems still there


if (ready_i) begin
ready_o = 1'b1;
ready_o = !halt_i || kill_i;
Copy link
Contributor

Choose a reason for hiding this comment

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

Normally we would set ready_o = 1 upon kill even if ready_i=0. Would that be SEC clean as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will check :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated, SEC clean.

mulh_a = mulh_ah;
mulh_b = mulh_bh;

if (ready_i) begin
ready_o = 1'b1;
ready_o = !halt_i || kill_i;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same remark here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated code, SEC clean.

mulh_state_next = MUL_ALBL;
mulh_acc_next = '0;
end
end
default: ;
endcase

// Allow kill at any time
if (!valid_i) begin
// Allow kill at any time unless EX stage is halted
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand the changed comment here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Me neither, I will revert it (likely remnants of another approach at using halt/kill in the multiplier)

@@ -177,8 +180,10 @@ module cv32e40x_mult import cv32e40x_pkg::*;
mulh_acc <= '0;
mulh_state <= MUL_ALBL;
end else begin
mulh_acc <= mulh_acc_next;
mulh_state <= mulh_state_next;
if ((valid_i && !halt_i) || kill_i) begin
Copy link
Contributor

Choose a reason for hiding this comment

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

Above mulh_state_next is changed also for !valid, but here that scenario is not handled

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, SEC clean.

if (ready_i) begin
ready_o = 1'b1;
ready_o = !halt_i || kill_i;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same remark as for multiplier

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, SEC clean.

@@ -304,6 +305,8 @@ module cv32e40x_div import cv32e40x_pkg::*;
comp_inv_q <= 1'b0;
res_inv_q <= 1'b0;
end else begin
// If stage is halted, the divider should have no state updates
if ((valid_i && !halt_i) || kill_i) begin
Copy link
Contributor

Choose a reason for hiding this comment

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

Same remark as for multiplier

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, SEC clean.

SEC clean.

Signed-off-by: Oystein Knauserud <Oystein.Knauserud@silabs.com>
silabs-oysteink and others added 2 commits August 14, 2023 15:14
Signed-off-by: Oystein Knauserud <Oystein.Knauserud@silabs.com>
@@ -258,9 +259,9 @@ module cv32e40x_div import cv32e40x_pkg::*;
end

DIV_FINISH: begin
valid_o = 1'b1;
valid_o = valid_i && !(halt_i || kill_i); // No valid outputs while halted or killed
ready_o = (ready_i && !halt_i) || kill_i;
Copy link
Contributor

Choose a reason for hiding this comment

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

Now halt impacts ready_o but not next_state. I see that next-state is not used later on in that case, but it is just difficult to understand like this.

Maybe keep case statement as in original design and assume valid_i=1, halt_i=0, kill_i=0 within the case and deal with exceptions to that assumption after the case statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted to original case statement.

@@ -115,7 +118,7 @@ module cv32e40x_mult import cv32e40x_pkg::*;
mulh_acc_next = mulh_acc;

// Case statement assumes valid_i = 1; the valid_i = 0 scenario
// is handled after the case statement.
// is handled after the case statement.
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment seems still there

…fter/in parallell with the case. Clock gating flipflops when halted or when there are no valid inputs.

SEC clean (with multiplier operation modified to addition)

Signed-off-by: Oystein Knauserud <Oystein.Knauserud@silabs.com>
…eink/cv32e40x into silabs-oysteink-div-mul-todo
mulh_b = mulh_bl;
end else begin
if (halt_i) begin
valid_o = 1'b0;
Copy link
Contributor

Choose a reason for hiding this comment

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

mulh_state_next assignment missing

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

Signed-off-by: Oystein Knauserud <Oystein.Knauserud@silabs.com>
@Silabs-ArjanB Silabs-ArjanB merged commit d17c4e7 into openhwgroup:master Aug 25, 2023
1 check passed
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.

None yet

2 participants