Fix some cppcheck warnings in tgt-vvp

This commit is contained in:
Cary R 2020-12-31 23:18:48 -08:00
parent 82a6e93c56
commit 053777f16d
4 changed files with 13 additions and 13 deletions

View File

@ -428,7 +428,7 @@ static void draw_vpi_taskfunc_args(const char*call_string,
buffer[0] = 0;
break;
default:
fprintf(stderr, "%s:%d: Sorry, cannot generate code for argument %d.\n",
fprintf(stderr, "%s:%u: Sorry, cannot generate code for argument %u.\n",
ivl_expr_file(expr), ivl_expr_lineno(expr), idx+1);
fprintf(vvp_out, "\nXXXX Unexpected argument: call_string=<%s>, arg=%u, type=%d\n",
call_string, idx, ivl_expr_value(expr));

View File

@ -1130,8 +1130,8 @@ static int show_stmt_assign_queue_pattern(ivl_signal_t var, ivl_expr_t rval,
int del_idx = allocate_word();
assert(del_idx >= 0);
/* Save the first queue element to delete. */
fprintf(vvp_out, " %%ix/load %u, %u, 0;\n", del_idx, max_elems);
fprintf(vvp_out, " %%delete/tail v%p_0, %u;\n", var, del_idx);
fprintf(vvp_out, " %%ix/load %d, %u, 0;\n", del_idx, max_elems);
fprintf(vvp_out, " %%delete/tail v%p_0, %d;\n", var, del_idx);
clr_word(del_idx);
}
@ -1159,7 +1159,7 @@ static int show_stmt_assign_sig_queue(ivl_statement_t net)
int idx = allocate_word();
assert(idx >= 0);
/* Save the queue maximum index value to an integer register. */
fprintf(vvp_out, " %%ix/load %u, %u, 0;\n", idx, ivl_signal_array_count(var));
fprintf(vvp_out, " %%ix/load %d, %u, 0;\n", idx, ivl_signal_array_count(var));
if (ivl_expr_type(rval) == IVL_EX_NULL) {
errors += draw_eval_object(rval);

View File

@ -102,7 +102,7 @@ int allocate_flag(void)
int idx;
for (idx = 0 ; idx < FLAGS_COUNT ; idx += 1) {
int word = idx / 32;
uint32_t mask = 1 << (idx%32);
uint32_t mask = 1U << (idx%32);
if (allocate_flag_mask[word] & mask)
continue;

View File

@ -1784,7 +1784,7 @@ static int show_insert_method(ivl_statement_t net)
int idx = allocate_word();
assert(idx >= 0);
/* Save the queue maximum index value to an integer register. */
fprintf(vvp_out, " %%ix/load %u, %u, 0;\n", idx, ivl_signal_array_count(var));
fprintf(vvp_out, " %%ix/load %d, %u, 0;\n", idx, ivl_signal_array_count(var));
ivl_type_t element_type = ivl_type_element(var_type);
@ -1795,17 +1795,17 @@ static int show_insert_method(ivl_statement_t net)
switch (ivl_type_base(element_type)) {
case IVL_VT_REAL:
draw_eval_real(parm2);
fprintf(vvp_out, " %%qinsert/real v%p_0, %u;\n",
fprintf(vvp_out, " %%qinsert/real v%p_0, %d;\n",
var, idx);
break;
case IVL_VT_STRING:
draw_eval_string(parm2);
fprintf(vvp_out, " %%qinsert/str v%p_0, %u;\n",
fprintf(vvp_out, " %%qinsert/str v%p_0, %d;\n",
var, idx);
break;
default:
draw_eval_vec4(parm2);
fprintf(vvp_out, " %%qinsert/v v%p_0, %u, %u;\n",
fprintf(vvp_out, " %%qinsert/v v%p_0, %d, %u;\n",
var, idx,
width_of_packed_type(element_type));
break;
@ -1837,7 +1837,7 @@ static int show_push_frontback_method(ivl_statement_t net, bool is_front)
int idx = allocate_word();
assert(idx >= 0);
/* Save the queue maximum index value to an integer register. */
fprintf(vvp_out, " %%ix/load %u, %u, 0;\n", idx, ivl_signal_array_count(var));
fprintf(vvp_out, " %%ix/load %d, %u, 0;\n", idx, ivl_signal_array_count(var));
ivl_type_t element_type = ivl_type_element(var_type);
@ -1845,17 +1845,17 @@ static int show_push_frontback_method(ivl_statement_t net, bool is_front)
switch (ivl_type_base(element_type)) {
case IVL_VT_REAL:
draw_eval_real(parm1);
fprintf(vvp_out, " %%store/%s/r v%p_0, %u;\n",
fprintf(vvp_out, " %%store/%s/r v%p_0, %d;\n",
type_code, var, idx);
break;
case IVL_VT_STRING:
draw_eval_string(parm1);
fprintf(vvp_out, " %%store/%s/str v%p_0, %u;\n",
fprintf(vvp_out, " %%store/%s/str v%p_0, %d;\n",
type_code, var, idx);
break;
default:
draw_eval_vec4(parm1);
fprintf(vvp_out, " %%store/%s/v v%p_0, %u, %u;\n",
fprintf(vvp_out, " %%store/%s/v v%p_0, %d, %u;\n",
type_code, var, idx,
width_of_packed_type(element_type));
break;