From d0a45ffe9daa9a78bc8777a2cc7c155edb9a8660 Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 17 Sep 2009 10:47:35 -0700 Subject: [PATCH] Warn that &A<> may have problems with a signed select from thread space. Like the &PV<> code we should warn the user that a signed select from thread space may not work correctly for &A<>. This will be fixed in development. (cherry picked from commit 1851cba95523f885631057788eeeab1a96f25c14) --- tgt-vvp/draw_vpi.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tgt-vvp/draw_vpi.c b/tgt-vvp/draw_vpi.c index 2695f56db..afaddd455 100644 --- a/tgt-vvp/draw_vpi.c +++ b/tgt-vvp/draw_vpi.c @@ -155,6 +155,17 @@ static int get_vpi_taskfunc_signal_arg(struct args_info *result, /* Fallback case: evaluate expression. */ struct vector_info av; av = draw_eval_expr(word_ex, STUFF_OK_XZ); + /* We need to enhance &A<> to support a signed index. */ + if (ivl_expr_signed(word_ex) && + (ivl_expr_width(word_ex) < 8*sizeof(int))) { + fprintf(stderr, "%s:%u: tgt-vvp warning: V0.9 " + "may give incorrect results for " + "an array select with a signed " + "index less than %zu bits.\n", + ivl_expr_file(expr), + ivl_expr_lineno(expr), + 8*sizeof(int)); + } snprintf(buffer, sizeof buffer, "&A", sig, av.base, av.wid); result->vec = av;