tgt-vvp: Allow out-of-bounds assignment operator on arrays wider than 32 bits

For an out-of-bounds assignment operator on an array element an assert is
hit if the element width is great than 32.

Remove the assert and make sure that this case is handled correctly by
using the `%pad/s` instruction to extended the X value to the correct
width.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-05-21 21:22:28 +02:00
parent d746c592b2
commit d651aefd92
1 changed files with 6 additions and 2 deletions

View File

@ -167,8 +167,12 @@ static void get_vec_from_lval_slice(ivl_lval_t lval, struct vec_slice_info*slice
fprintf(vvp_out, " %%flag_set/imm 4, 0;\n");
fprintf(vvp_out, " %%load/vec4a v%p, 3;\n", sig);
} else {
assert(wid <= 32);
fprintf(vvp_out, " %%pushi/vec4 4294967295, 4294967295, %u;\n", wid);
if (wid <= 32) {
fprintf(vvp_out, " %%pushi/vec4 4294967295, 4294967295, %u;\n", wid);
} else {
fprintf(vvp_out, " %%pushi/vec4 4294967295, 4294967295, 32;\n");
fprintf(vvp_out, " %%pad/s %u;\n", wid);
}
}
} else if (ivl_signal_dimensions(sig) > 0 && word_ix != 0) {