diff --git a/ivtest/ivltests/sv_array_query.v b/ivtest/ivltests/sv_array_query.v new file mode 100644 index 000000000..990ab3a82 --- /dev/null +++ b/ivtest/ivltests/sv_array_query.v @@ -0,0 +1,30 @@ +// Check that array query functions return the correct value for C style arrays + +module test; + + bit failed = 1'b0; + + `define check(expr, val) \ + if (expr !== val) begin \ + $display("FAILED: %s, expected %0d, got %0d", `"expr`", val, expr); \ + failed = 1'b1; \ + end + + bit [1:0] a[10]; + + initial begin + `check($left(a), 0) + `check($right(a), 9) + `check($low(a), 0) + `check($high(a), 9) + `check($size(a), 10) + `check($increment(a), -1) + `check($dimensions(a), 2) + `check($unpacked_dimensions(a), 1) + + if (!failed) begin + $display("PASSED"); + end + end + +endmodule diff --git a/ivtest/regress-sv.list b/ivtest/regress-sv.list index e9f4a5ad2..37e53b4e9 100644 --- a/ivtest/regress-sv.list +++ b/ivtest/regress-sv.list @@ -499,6 +499,7 @@ sv_assign_pattern_func normal,-g2005-sv ivltests sv_assign_pattern_op normal,-g2005-sv ivltests sv_assign_pattern_part normal,-g2005-sv ivltests sv_array_assign_pattern2 normal,-g2009 ivltests +sv_array_query normal,-g2005-sv ivltests sv_cast_integer normal,-g2005-sv ivltests sv_cast_integer2 normal,-g2005-sv ivltests sv_cast_packed_array normal,-g2005-sv ivltests