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

sras: better condition handling (?)


Signed-off-by: default avatarAlban Gruin <alban.gruin@irit.fr>
parent 32942461
Branches
No related merge requests found
Pipeline #10309 failed
...@@ -53,21 +53,29 @@ module sras #( ...@@ -53,21 +53,29 @@ module sras #(
if (flush_i) begin if (flush_i) begin
tos_d = '0; tos_d = '0;
end else if (push_i && !pop_i) begin end else if (!bad_spec_i) begin
tos_d[ptr_spec_d] = prev_plus_one; if (push_i && !pop_i) begin
tos_d[ptr_spec_q] = pp_plus_one; tos_d[ptr_spec_d] = prev_plus_one;
end else if (!push_i && pop_i) begin if (begin_spec_i) begin
tos_d[ptr_spec_d] = prev_minus_one; tos_d[ptr_spec_q] = pp_plus_one;
end else if (!bad_spec_i && begin_spec_i) begin end
tos_d[ptr_spec_d] = tos_q[ptr_spec_q]; end else if (!push_i && pop_i) begin
tos_d[ptr_spec_d] = prev_minus_one;
end else if (begin_spec_i) begin
tos_d[ptr_spec_d] = tos_q[ptr_spec_q];
end
end end
end end
logic can_pop, can_push;
assign can_pop = pop_i && !bad_spec_i;
assign can_push = push_i && !bad_spec_i;
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 = (push_i) ? data_i : 0; assign to_push.ra = (push_i) ? data_i : 0;
assign to_push.valid = push_i; 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;
...@@ -78,11 +86,9 @@ module sras #( ...@@ -78,11 +86,9 @@ module sras #(
new_stack = stack_q[ptr_spec_q]; new_stack = stack_q[ptr_spec_q];
end end
if (pop_i) begin if (can_pop) begin
new_stack[previous_tos] = to_push; new_stack[previous_tos] = to_push;
end end else if (can_push) begin
if (push_i) begin
new_stack[prev_plus_one] = to_push; new_stack[prev_plus_one] = to_push;
end end
end end
...@@ -90,7 +96,7 @@ module sras #( ...@@ -90,7 +96,7 @@ module sras #(
always_comb begin always_comb begin
prev_stack = stack_q[ptr_spec_q]; prev_stack = stack_q[ptr_spec_q];
if (push_i) begin if (can_push && begin_spec_i) begin
prev_stack[pp_plus_one] = to_push; prev_stack[pp_plus_one] = to_push;
end end
end end
...@@ -124,9 +130,9 @@ module sras #( ...@@ -124,9 +130,9 @@ module sras #(
assert (2 ** $clog2(DEPTH) == DEPTH) else $fatal(1,"[sras] DEPTH is not a power of 2"); assert (2 ** $clog2(DEPTH) == DEPTH) else $fatal(1,"[sras] DEPTH is not a power of 2");
end end
assert property ( // assert property (
@(posedge clk_i) disable iff (!rst_ni) push_i |-> begin_spec_i) // @(posedge clk_i) disable iff (!rst_ni) push_i |-> begin_spec_i)
else $warning (1,"[sras] push_i & ~begin_spec_i"); // else $warning (1,"[sras] push_i & ~begin_spec_i");
assert property ( assert property (
@(posedge clk_i) disable iff (!rst_ni) (begin_spec_i & !(bad_spec_i)) |-> (ptr_spec_d != ptr_backup_d)) @(posedge clk_i) disable iff (!rst_ni) (begin_spec_i & !(bad_spec_i)) |-> (ptr_spec_d != ptr_backup_d))
...@@ -135,6 +141,10 @@ module sras #( ...@@ -135,6 +141,10 @@ module sras #(
assert property ( assert property (
@(posedge clk_i) disable iff (!rst_ni) valid_spec_i |-> ((ptr_backup_q == ptr_spec_q) |-> (ptr_backup_d == ptr_spec_d))) @(posedge clk_i) disable iff (!rst_ni) valid_spec_i |-> ((ptr_backup_q == ptr_spec_q) |-> (ptr_backup_d == ptr_spec_d)))
else $fatal (1,"[sras] backup overtake"); else $fatal (1,"[sras] backup overtake");
assert property (
@(posedge clk_i) disable iff (!rst_ni) can_push |-> ~can_pop && can_pop |-> ~can_push)
else $fatal (1,"[sras] push & pop at the same time");
`endif `endif
// pragma translate_on // pragma translate_on
endmodule endmodule
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment