Merge pull request #708 from larsclausen/real-array-multi-dim

tgt-vvp: Allow multi-dimensional real arrays
This commit is contained in:
Stephen Williams 2022-05-12 14:48:15 -07:00 committed by GitHub
commit e076400449
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 3 deletions

View File

@ -0,0 +1,35 @@
// Check that multi-dimensional real arrays are supported
module test;
reg failed = 1'b0;
`define check(expr, val) \
if (expr != val) begin \
$display("FAILED: `%s`, expected %f, got %f", `"expr`", val, expr); \
failed = 1'b1; \
end
real r[3:0][1:0];
integer i;
initial begin
for (i = 0; i < 8; i = i + 1) begin
r[i/2][i%2] = i / 8.0 - 0.5;
end
`check(r[0][0], -0.5);
`check(r[0][1], -0.375);
`check(r[1][0], -0.25);
`check(r[1][1], -0.125);
`check(r[2][0], 0.0);
`check(r[2][1], 0.125);
`check(r[3][0], 0.25);
`check(r[3][1], 0.375);
if (!failed) begin
$display("PASSED");
end
end
endmodule

View File

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

View File

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

View File

@ -756,9 +756,6 @@ static void store_real_to_lval(ivl_lval_t lval)
return;
}
// For now, only support 1-dimensional arrays.
assert(ivl_signal_dimensions(var) == 1);
ivl_expr_t word_ex = ivl_lval_idx(lval);
int word_ix = allocate_word();