Add regression tests for accidental store/load skip

Check that for the following operations the load or store is not skipped
after a operation that sets vvp flag 4.

 * Assignment to immediate indexed real array entry
 * Assignment operator on immediate indexed vector array entry
 * Assignment operator on dynamic vector part select

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-05-16 11:00:28 +02:00
parent e263d5b268
commit c2c758369d
6 changed files with 73 additions and 0 deletions

View File

@ -0,0 +1,24 @@
// Check that a assignment operator on an integer array entry with an immediate
// index works if it happes after a comparison that sets vvp flag 4 to 0.
module test;
logic [7:0] x[10];
logic a = 1'b0;
initial begin
x[0] = 10;
if (a == 0) begin
// Make sure that this update happens, even though the compare above
// cleared set vvp flag 4
x[0] += 1;
end
if (x[0] == 11) begin
$display("PASSED");
end else begin
$display("FAILED. Expected 11, got %0d", x[0]);
end
end
endmodule

View File

@ -0,0 +1,22 @@
// Check that a assignment operator on a dynamic part select of an vector works
// if it happes after a comparison that sets vvp flag 4 to 0.
module test;
logic [7:0] a = 8'h0;
initial begin
if (a == 0) begin
// Make sure that this update happens, even though the compare above
// cleared set vvp flag 4
a[a+:1] += 1;
end
if (a == 1) begin
$display("PASSED");
end else begin
$display("FAILED. Expected 1, got %0d", a);
end
end
endmodule

View File

@ -0,0 +1,23 @@
// Check that a store to am entry of real typed array with an immediate index
// works if it happes after a comparison that sets vvp flag 4 to 0.
module test;
integer a = 0;
real r[1:0];
initial begin
if (a == 0) begin
// Make sure that this store happens, even though the compare above
// cleared set vvp flag 4
r[0] = 1.23;
end
if (r[0] == 1.23) begin
$display("PASSED");
end else begin
$display("FAILED. Expected %f, got %f", 1.23, r[0]);
end
end
endmodule

View File

@ -96,6 +96,8 @@ array_size normal,-g2005-sv ivltests # test [size] arrays
array_string normal,-g2009 ivltests
array_unpacked_sysfunct normal,-g2005-sv ivltests
array_packed normal,-g2005-sv ivltests
assign_op_after_cmp1 normal,-g2009 ivltests
assign_op_after_cmp2 normal,-g2009 ivltests
assign_op_concat normal,-g2009 ivltests
assign_op_type normal,-g2009 ivltests
bitp1 normal,-g2005-sv ivltests

View File

@ -1463,6 +1463,7 @@ real9 normal ivltests
real10 normal ivltests
real11 normal ivltests
real_array_multi_dim normal ivltests
real_array_store_after_cmp normal ivltests
real_assign_deassign normal ivltests
real_concat_invalid2 CE ivltests
real_delay normal,-gspecify ivltests gold=real_delay.gold

View File

@ -248,6 +248,7 @@ pr3592746 CE ivltests
real_array CE ivltests
real_array_nb CE,-pallowsigned=1 ivltests
real_array_multi_dim CE,-pallowsigned=1 ivltests
real_array_store_after_cmp CE ivltests
scan-invalid CE ivltests
sel_rval_bit_ob CE ivltests
sel_rval_part_ob CE ivltests