From 6b908aeec30c0a8fe06c85c0b5068a41e43bd515 Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Wed, 14 May 2008 11:51:53 -0700 Subject: [PATCH] Arithmetic operands can do unsigned work and have signed result. It is a quirk of the $signed() system function that the argument is converted to signed, but the operation that is performed is not changed. So arithmetic operators on unsigned arguments inside a $signed() expression still perform unsigned arithmetic. --- tgt-vvp/eval_expr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tgt-vvp/eval_expr.c b/tgt-vvp/eval_expr.c index bca49cc0a..f7c5ed27d 100644 --- a/tgt-vvp/eval_expr.c +++ b/tgt-vvp/eval_expr.c @@ -1246,7 +1246,7 @@ static struct vector_info draw_binary_expr_arith(ivl_expr_t exp, unsigned wid) struct vector_info lv; struct vector_info rv; - const char*sign_string = ivl_expr_signed(exp)? "/s" : ""; + const char*sign_string = ivl_expr_signed(le) && ivl_expr_signed(re)? "/s" : ""; if ((ivl_expr_opcode(exp) == '+') && (ivl_expr_type(le) == IVL_EX_SIGNAL)