Skip to content
Snippets Groups Projects
Commit e17128ee authored by Alban Gruin's avatar Alban Gruin
Browse files

sras: handle unhandled cases wrt. the overflow


Signed-off-by: default avatarAlban Gruin <alban.gruin@irit.fr>
parent 594e3bd6
No related tags found
No related merge requests found
...@@ -380,14 +380,15 @@ module frontend import ariane_pkg::*; #( ...@@ -380,14 +380,15 @@ module frontend import ariane_pkg::*; #(
) i_ras ( ) i_ras (
.clk_i, .clk_i,
.rst_ni, .rst_ni,
.flush_i ( flush_bp_i ), .flush_i ( flush_bp_i ),
.push_i ( ras_push ), .push_i ( ras_push ),
.pop_i ( ras_pop ), .pop_i ( ras_pop ),
.data_i ( ras_update ), .data_i ( ras_update ),
.begin_spec_i ( begin_spec_o ), .begin_spec_i ( begin_spec_o ),
.valid_spec_i ( is_correct_predict ), .valid_spec_i ( is_correct_predict ),
.bad_spec_i ( is_mispredict ), .bad_spec_i ( is_mispredict ),
.data_o ( ras_predict ) .resolved_type_i ( resolved_branch_i.cf_type ),
.data_o ( ras_predict )
); );
btb #( btb #(
......
...@@ -28,6 +28,7 @@ module sras #( ...@@ -28,6 +28,7 @@ module sras #(
input logic begin_spec_i, input logic begin_spec_i,
input logic valid_spec_i, input logic valid_spec_i,
input logic bad_spec_i, input logic bad_spec_i,
input ariane_pkg::cf_t resolved_type_i,
output ariane_pkg::ras_t data_o output ariane_pkg::ras_t data_o
); );
...@@ -68,12 +69,16 @@ module sras #( ...@@ -68,12 +69,16 @@ module sras #(
ovf_counter_d[ptr_spec_q] = ovf_counter_q[ptr_spec_q] + 1'b1; ovf_counter_d[ptr_spec_q] = ovf_counter_q[ptr_spec_q] + 1'b1;
end end
end else if (!push_i && pop_i) begin end else if (!push_i && pop_i) begin
if (ovf_counter_q[ptr_spec_q] != '0) begin if (ovf_counter_q[ptr_spec_q] == '0) begin
ovf_counter_d[ptr_spec_d] = '0; // ovf_counter_d[ptr_spec_d] = ovf_counter_q[ptr_spec_q];
end else begin
ovf_counter_d[ptr_spec_d] = ovf_counter_q[ptr_spec_q] - 1'b1; ovf_counter_d[ptr_spec_d] = ovf_counter_q[ptr_spec_q] - 1'b1;
end end
end else if (begin_spec_i) begin end else if (begin_spec_i) begin
ovf_counter_d[ptr_spec_d] = ovf_counter_q[ptr_spec_q]; ovf_counter_d[ptr_spec_d] = ovf_counter_q[ptr_spec_q];
end end
end else if (bad_spec_i && resolved_type_i == ariane_pkg::Return && ovf_counter_q[ptr_spec_q] != '0) begin
ovf_counter_d[ptr_spec_d] = ovf_counter_q[ptr_spec_q] - 1'b1;
end end
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment