From e5597d5f44b9a2f85d70e50649f2a4523f9072f0 Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Thu, 21 Oct 2010 17:04:56 -0700 Subject: [PATCH] Handle signed IVL_VT_BOOL load into integer. The %ix/get should be %is/get/s if the source expression is signed. This gets proper sign extension. --- tgt-vvp/eval_bool.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tgt-vvp/eval_bool.c b/tgt-vvp/eval_bool.c index c7cfee6bb..5a8c1ce6f 100644 --- a/tgt-vvp/eval_bool.c +++ b/tgt-vvp/eval_bool.c @@ -47,10 +47,14 @@ static int eval_bool64_logic(ivl_expr_t expr) { int res; struct vector_info tmp; + const char*s_flag = ""; tmp = draw_eval_expr(expr, STUFF_OK_XZ); res = allocate_word(); - fprintf(vvp_out, " %%ix/get %d, %u, %u;\n", res, tmp.base, tmp.wid); + if (ivl_expr_signed(expr)) + s_flag = "/s"; + + fprintf(vvp_out, " %%ix/get%s %d, %u, %u;\n", s_flag, res, tmp.base, tmp.wid); clr_vector(tmp); return res;