From 2df68508243099b8e0ed7306efbc9593e7b1ee53 Mon Sep 17 00:00:00 2001 From: Cary R Date: Fri, 25 Feb 2011 18:18:16 -0800 Subject: [PATCH] vlog95: A parameter in 1364-1995 is always zero based. The 1364-1995 version of Verilog does not support non zero based parameters. This patch removes the comment requesting the parameter MSB/LSB information to denormalize the expression and replaces it with one stating that we need to keep the compiler normalization. --- tgt-vlog95/expr.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tgt-vlog95/expr.c b/tgt-vlog95/expr.c index 79aad04b1..e5bad93e1 100644 --- a/tgt-vlog95/expr.c +++ b/tgt-vlog95/expr.c @@ -280,6 +280,7 @@ static void emit_select_name(ivl_scope_t scope, ivl_expr_t expr, unsigned wid) fprintf(stderr, "%s:%u: vlog95 error: Unable to find parameter " "for select expression \n", ivl_expr_file(expr), ivl_expr_lineno(expr)); + vlog_errors += 1; } else { emit_expr(scope, expr, wid); } @@ -373,16 +374,16 @@ static void emit_expr_select(ivl_scope_t scope, ivl_expr_t expr, unsigned wid) emit_scaled_expr(scope, sel_expr, 1, 0); fprintf(vlog_out, ")" ); } else { - int msb; - int lsb; + /* A constant/parameter must be zero based in 1364-1995 + * so keep the compiler generated normalization. This + * does not always work for selects before the parameter + * since 1364-1995 does not support signed math. */ + int msb = 1; + int lsb = 0; if (type == IVL_EX_SIGNAL) { ivl_signal_t sig = ivl_expr_signal(sig_expr); msb = ivl_signal_msb(sig); lsb = ivl_signal_lsb(sig); - } else { -// HERE: Need to get the parameter and then the MSB/LSB information. - msb = 1; - lsb = 0; } /* A bit select. */ if (width == 1) {