diff --git a/tgt-vvp/eval_vec4.c b/tgt-vvp/eval_vec4.c index fa1bc3783..8572686cc 100644 --- a/tgt-vvp/eval_vec4.c +++ b/tgt-vvp/eval_vec4.c @@ -579,7 +579,7 @@ static void draw_string_vec4(ivl_expr_t expr, int stuff_ok_flag) fprintf(vvp_out, " %%pushi/vec4 %lu, 0, 32;\n", tmp); tmp = 0; tmp_wid = 0; - if (push_flag != 0) + if (push_flag == 0) push_flag += 1; else fprintf(vvp_out, " %%concat/vec4;\n"); @@ -589,7 +589,7 @@ static void draw_string_vec4(ivl_expr_t expr, int stuff_ok_flag) if (tmp_wid > 0) { fprintf(vvp_out, " %%pushi/vec4 %lu, 0, %u;\n", tmp, tmp_wid); if (push_flag != 0) - fprintf(vvp_out, " %%oncat/vec4;\n"); + fprintf(vvp_out, " %%concat/vec4;\n"); } free(fp); diff --git a/tgt-vvp/stmt_assign.c b/tgt-vvp/stmt_assign.c index 8c55119fd..897177b0f 100644 --- a/tgt-vvp/stmt_assign.c +++ b/tgt-vvp/stmt_assign.c @@ -640,7 +640,15 @@ static int show_stmt_assign_vector(ivl_statement_t net) fprintf(vvp_out, " %%cvt/vr %u;\n", wid); } else { + unsigned wid = ivl_stmt_lwidth(net); draw_eval_vec4(rval, 0); + if (ivl_expr_width(rval)==wid) { + ; /* Normally, the rval expression size is correct. */ + } else if (ivl_expr_signed(rval)) { + fprintf(vvp_out, " %%pad/s %u;\n", wid); + } else { + fprintf(vvp_out, " %%pad/u %u;\n", wid); + } //res.base = 0; // XXXX This is just to suppress the clr_vector below. //res.wid = 0; }