From d651aefd9224a3172009159468112fd032e93320 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sat, 21 May 2022 21:22:28 +0200 Subject: [PATCH] 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 --- tgt-vvp/stmt_assign.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tgt-vvp/stmt_assign.c b/tgt-vvp/stmt_assign.c index 257b53aea..123b2d405 100644 --- a/tgt-vvp/stmt_assign.c +++ b/tgt-vvp/stmt_assign.c @@ -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) {