Add regression tests for omitted foreach dimensions
Check that it is possible to omit one or more dimensions in a foreach loop. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
e141aef828
commit
0e86e99358
|
|
@ -0,0 +1,9 @@
|
|||
0 0
|
||||
0 1
|
||||
0 2
|
||||
0 3
|
||||
1 0
|
||||
1 1
|
||||
1 2
|
||||
1 3
|
||||
PASSED
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
// Check that foreach loops without an index list work as expected. This is not
|
||||
// particularly useful, but it is legal code.
|
||||
|
||||
module test;
|
||||
|
||||
logic a[10];
|
||||
int i = 0;
|
||||
|
||||
initial begin
|
||||
foreach(a[]) begin
|
||||
i++;
|
||||
end
|
||||
|
||||
if (i == 0) begin
|
||||
$display("PASSED");
|
||||
end else begin
|
||||
$display("FAILED");
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
// Check that foreach loops with only empty indices works as expected. This is
|
||||
// not particularly useful, but it is legal code.
|
||||
|
||||
module test;
|
||||
|
||||
logic a[2][3][4];
|
||||
int i = 0;
|
||||
|
||||
initial begin
|
||||
foreach(a[,,]) begin
|
||||
i++;
|
||||
end
|
||||
|
||||
if (i == 0) begin
|
||||
$display("PASSED");
|
||||
end else begin
|
||||
$display("FAILED");
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
// Check that it is possible to omit a dimensions in a foreach loop by not
|
||||
// specifying a loop identifiers for the dimension.
|
||||
|
||||
module test;
|
||||
|
||||
logic a[2][3][4];
|
||||
int k = 0;
|
||||
|
||||
initial begin
|
||||
foreach(a[i,,j]) begin
|
||||
$display(i, j);
|
||||
k++;
|
||||
end
|
||||
|
||||
if (k == 8) begin
|
||||
$display("PASSED");
|
||||
end else begin
|
||||
$display("FAILED");
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -600,6 +600,9 @@ sv_foreach2 normal,-g2009 ivltests
|
|||
sv_foreach3 normal,-g2009 ivltests
|
||||
sv_foreach4 normal,-g2009 ivltests
|
||||
sv_foreach5 normal,-g2009 ivltests
|
||||
sv_foreach6 normal,-g2009 ivltests
|
||||
sv_foreach7 normal,-g2009 ivltests
|
||||
sv_foreach8 normal,-g2009 ivltests gold=sv_foreach8.gold
|
||||
sv_foreach_fail1 CE,-g2009 ivltests
|
||||
sv_immediate_assert normal,-g2009 ivltests gold=sv_immediate_assert.gold
|
||||
sv_immediate_assume normal,-g2009 ivltests gold=sv_immediate_assume.gold
|
||||
|
|
|
|||
|
|
@ -954,6 +954,9 @@ struct_signed normal,-g2009,-pallowsigned=1 ivltests
|
|||
sv_for_variable normal,-g2009,-pallowsigned=1 ivltests
|
||||
sv_foreach1 normal,-g2009,-pallowsigned=1 ivltests
|
||||
sv_foreach5 normal,-g2009,-pallowsigned=1 ivltests
|
||||
sv_foreach6 normal,-g2009,-pallowsigned=1 ivltests
|
||||
sv_foreach7 normal,-g2009,-pallowsigned=1 ivltests
|
||||
sv_foreach8 normal,-g2009,-pallowsigned=1 ivltests
|
||||
sv_package normal,-g2009,-pallowsigned=1 ivltests
|
||||
sv_package2 normal,-g2009,-pallowsigned=1 ivltests
|
||||
sv_package5 normal,-g2009,-pallowsigned=1 ivltests
|
||||
|
|
|
|||
Loading…
Reference in New Issue