Skip to content

Commit

Permalink
vlog95: A parameter in 1364-1995 is always zero based.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
caryr authored and steveicarus committed Mar 1, 2011
1 parent fc3118b commit 2df6850
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tgt-vlog95/expr.c
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 2df6850

Please sign in to comment.