Merge pull request #817 from larsclausen/fix-left-right-c-array
Fix $left/$right for C-style unpacked arrays
This commit is contained in:
commit
70e2ff0bd5
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1099,8 +1099,8 @@ bool evaluate_range(Design*des, NetScope*scope, const LineInfo*li,
|
|||
if (!dimension_ok) {
|
||||
// bail out
|
||||
} else if (index_l > 0) {
|
||||
index_l = index_l - 1;
|
||||
index_r = 0;
|
||||
index_r = index_l - 1;
|
||||
index_l = 0;
|
||||
} else {
|
||||
cerr << range.first->get_fileline() << ": error: "
|
||||
"Dimension size must be greater than zero." << endl;
|
||||
|
|
|
|||
Loading…
Reference in New Issue