From cf8222fcfefb810eab2907dc957966c2ccf2369b Mon Sep 17 00:00:00 2001 From: Cary R Date: Sun, 26 Jul 2020 14:01:16 -0700 Subject: [PATCH] A queue does not have dimensions so just assume the base is 0 for an L-val --- tgt-vlog95/stmt.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tgt-vlog95/stmt.c b/tgt-vlog95/stmt.c index 9bbee81d6..a4ff8d237 100644 --- a/tgt-vlog95/stmt.c +++ b/tgt-vlog95/stmt.c @@ -94,12 +94,18 @@ static void emit_stmt_lval_name(ivl_scope_t scope, ivl_lval_t lval, emit_id(ivl_signal_basename(sig)); if (array_idx) { int msb, lsb; - assert(ivl_signal_dimensions(sig)); + ivl_type_t net_type = ivl_signal_net_type(sig); fprintf(vlog_out, "["); - /* For an array the LSB/MSB order is not important. They are - * always accessed from base counting up. */ - lsb = ivl_signal_array_base(sig); - msb = lsb + ivl_signal_array_count(sig) - 1; + if (ivl_type_base(net_type) == IVL_VT_QUEUE) { + lsb = 0; + msb = 1; + } else { + assert(ivl_signal_dimensions(sig)); + /* For an array the LSB/MSB order is not important. + * They are always accessed from base counting up. */ + lsb = ivl_signal_array_base(sig); + msb = lsb + ivl_signal_array_count(sig) - 1; + } emit_scaled_expr(scope, array_idx, msb, lsb); fprintf(vlog_out, "]"); }