Add regression test for array query functions on C style array
Check that array query functions return the correct value for C style arrays. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
3c4d1bbe4e
commit
a8dbb38af2
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue