A power needs to use the signed (real pow) if either argument is signed.
The power operator is different in that it uses the signed version if either of it's arguments are signed. This patch fixes the code generator to do this correctly.
This commit is contained in:
parent
6b76f76a3a
commit
2ce9841354
|
|
@ -1469,8 +1469,13 @@ static struct vector_info draw_binary_expr_arith(ivl_expr_t exp, unsigned wid)
|
|||
break;
|
||||
|
||||
case 'p':
|
||||
fprintf(vvp_out, " %%pow%s %u, %u, %u;\n", sign_string,
|
||||
lv.base, rv.base, wid);
|
||||
if (ivl_expr_signed(le) || ivl_expr_signed(re)) {
|
||||
fprintf(vvp_out, " %%pow/s %u, %u, %u;\n",
|
||||
lv.base, rv.base, wid);
|
||||
} else {
|
||||
fprintf(vvp_out, " %%pow %u, %u, %u;\n",
|
||||
lv.base, rv.base, wid);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
Loading…
Reference in New Issue