Properly evaluate a unary ! with logic argument and real result.
This commit is contained in:
parent
0153a25061
commit
b9d6c816f1
|
|
@ -178,6 +178,11 @@ void show_unary_expression(ivl_expr_t net, unsigned ind)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ivl_expr_opcode(net) == '!' && ivl_expr_type(net)==IVL_VT_REAL) {
|
||||||
|
fprintf(out, "%*sERROR: Real argument to unary ! !?\n", ind,"");
|
||||||
|
stub_errors += 1;
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(out, "%*s<unary \"%s\" width=%u, %s, type=%s>\n", ind, "",
|
fprintf(out, "%*s<unary \"%s\" width=%u, %s, type=%s>\n", ind, "",
|
||||||
name, width, sign, vt);
|
name, width, sign, vt);
|
||||||
show_expression(ivl_expr_oper1(net), ind+4);
|
show_expression(ivl_expr_oper1(net), ind+4);
|
||||||
|
|
|
||||||
|
|
@ -441,7 +441,22 @@ static int draw_unary_real(ivl_expr_t exp)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ivl_expr_opcode(exp) == '!') {
|
||||||
|
struct vector_info vi;
|
||||||
|
vi = draw_eval_expr(exp, STUFF_OK_XZ);
|
||||||
|
int res = allocate_word();
|
||||||
|
const char*sign_flag = ivl_expr_signed(exp)? "/s" : "";
|
||||||
|
fprintf(vvp_out, " %%ix/get%s %d, %u, %u;\n",
|
||||||
|
sign_flag, res, vi.base, vi.wid);
|
||||||
|
|
||||||
|
fprintf(vvp_out, " %%cvt/ri %d, %d;\n", res, res);
|
||||||
|
|
||||||
|
clr_vector(vi);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
ivl_expr_t sube = ivl_expr_oper1(exp);
|
ivl_expr_t sube = ivl_expr_oper1(exp);
|
||||||
|
|
||||||
int sub = draw_eval_real(sube);
|
int sub = draw_eval_real(sube);
|
||||||
|
|
||||||
if (ivl_expr_opcode(exp) == '+')
|
if (ivl_expr_opcode(exp) == '+')
|
||||||
|
|
@ -461,8 +476,8 @@ static int draw_unary_real(ivl_expr_t exp)
|
||||||
return sub;
|
return sub;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(vvp_out, "; XXXX unary (%c)\n", ivl_expr_opcode(exp));
|
fprintf(vvp_out, "; XXXX unary (%c) on sube in %d\n", ivl_expr_opcode(exp), sub);
|
||||||
fprintf(stderr, "XXXX evaluate unary (%c)\n", ivl_expr_opcode(exp));
|
fprintf(stderr, "XXXX evaluate unary (%c) on sube in %d\n", ivl_expr_opcode(exp), sub);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue