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

Revert "sras: size improvements"

This reverts commit cd7dabb4.
parent 562b13a7
No related branches found
No related tags found
No related merge requests found
...@@ -54,10 +54,6 @@ module sras #( ...@@ -54,10 +54,6 @@ module sras #(
logic overflow; logic overflow;
assign overflow = |ovf_counter_q[ptr_spec_q]; assign overflow = |ovf_counter_q[ptr_spec_q];
logic [SZ_OVF-1:0] ovf_plus_one, ovf_minus_one;
assign ovf_plus_one = ovf_counter_q[ptr_spec_q] + 1'b1;
assign ovf_minus_one = ovf_counter_q[ptr_spec_q] - 1'b1;
always_comb begin always_comb begin
ovf_counter_d = ovf_counter_q; ovf_counter_d = ovf_counter_q;
...@@ -66,23 +62,23 @@ module sras #( ...@@ -66,23 +62,23 @@ module sras #(
end else if (!bad_spec_i) begin end else if (!bad_spec_i) begin
if (push_i && !pop_i) begin if (push_i && !pop_i) begin
if (overflow || prev_plus_one == '0 || pp_plus_one == '0) begin if (overflow || prev_plus_one == '0 || pp_plus_one == '0) begin
ovf_counter_d[ptr_spec_d] = ovf_plus_one; ovf_counter_d[ptr_spec_d] = ovf_counter_q[ptr_spec_q] + 1'b1;
end end
if ((prev_plus_one == '0 || pp_plus_one == '0) && begin_spec_i) begin if ((prev_plus_one == '0 || pp_plus_one == '0) && begin_spec_i) begin
ovf_counter_d[ptr_spec_q] = ovf_plus_one; 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] = ovf_counter_q[ptr_spec_q]; ovf_counter_d[ptr_spec_d] = '0; // ovf_counter_d[ptr_spec_d] = ovf_counter_q[ptr_spec_q];
end else begin end else begin
ovf_counter_d[ptr_spec_d] = ovf_minus_one; 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 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_minus_one; ovf_counter_d[ptr_spec_d] = ovf_counter_q[ptr_spec_q] - 1'b1;
end end
end end
...@@ -116,8 +112,7 @@ module sras #( ...@@ -116,8 +112,7 @@ module sras #(
assign data_o = stack_q[previous_tos_addr][previous_tos]; assign data_o = stack_q[previous_tos_addr][previous_tos];
ariane_pkg::ras_t to_push; ariane_pkg::ras_t to_push;
assign to_push.ra = data_i; assign to_push.ra = (can_push) ? data_i : 0;
// assign to_push.ra = (can_push) ? data_i : 0;
assign to_push.valid = can_push; assign to_push.valid = can_push;
ariane_pkg::ras_t [DEPTH-1:0] new_stack, prev_stack; ariane_pkg::ras_t [DEPTH-1:0] new_stack, prev_stack;
...@@ -131,14 +126,19 @@ module sras #( ...@@ -131,14 +126,19 @@ module sras #(
if (can_pop) begin if (can_pop) begin
new_stack[previous_tos] = to_push; new_stack[previous_tos] = to_push;
end else if (can_push) begin end
if (can_push) begin
new_stack[prev_plus_one] = to_push; new_stack[prev_plus_one] = to_push;
end end
end end
for (genvar i = 0; i < DEPTH; i++) begin always_comb begin
assign prev_stack[i] = (i == pp_plus_one && can_push && begin_spec_i) ? to_push : prev_stack = stack_q[ptr_spec_q];
stack_q[ptr_spec_q][i];
if (can_push && begin_spec_i) begin
prev_stack[pp_plus_one] = to_push;
end
end end
for (genvar i = 0; i < SpecDepth; i++) begin for (genvar i = 0; i < SpecDepth; i++) begin
...@@ -148,16 +148,16 @@ module sras #( ...@@ -148,16 +148,16 @@ module sras #(
stack_q[i]; stack_q[i];
end end
// initial stack_q <= '0; initial stack_q = '0;
always_ff @(posedge clk_i or negedge rst_ni) begin always_ff @(posedge clk_i or negedge rst_ni) begin
stack_q <= stack_d;
if (~rst_ni) begin if (~rst_ni) begin
stack_q <= '0;
ptr_spec_q <= '0; ptr_spec_q <= '0;
ptr_backup_q <= '0; ptr_backup_q <= '0;
tos_q <= '0; tos_q <= '0;
ovf_counter_q <= '0; ovf_counter_q <= '0;
end else begin end else begin
stack_q <= stack_d;
ptr_spec_q <= ptr_spec_d; ptr_spec_q <= ptr_spec_d;
ptr_backup_q <= ptr_backup_d; ptr_backup_q <= ptr_backup_d;
tos_q <= tos_d; tos_q <= tos_d;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment