From cccf36d76f623f14dfe8a636f2c6d247fc1d840a Mon Sep 17 00:00:00 2001 From: Cary R Date: Sat, 30 Jan 2021 00:34:10 -0800 Subject: [PATCH] Fix warning and little E full vector up/down selects (cherry picked from commit 0c12344b27a691884b32eb58494ed05b9eeb002c) --- elab_expr.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/elab_expr.cc b/elab_expr.cc index d674f490b..b9dd81817 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -5255,6 +5255,7 @@ NetExpr* PEIdent::elaborate_expr_net_idx_up_(Design*des, NetScope*scope, } long rel_base = net->sig()->sb_to_idx(prefix_indices, lsv); + rel_base += offset; // If the part select covers exactly the entire // vector, then do not bother with it. Return the @@ -5267,7 +5268,7 @@ NetExpr* PEIdent::elaborate_expr_net_idx_up_(Design*des, NetScope*scope, // Otherwise, make a part select that covers the right // range. - ex = new NetEConst(verinum(rel_base + offset)); + ex = new NetEConst(verinum(rel_base)); if (warn_ob_select) { if (rel_base < 0) { cerr << get_fileline() << ": warning: " @@ -5358,11 +5359,12 @@ NetExpr* PEIdent::elaborate_expr_net_idx_do_(Design*des, NetScope*scope, } long rel_base = net->sig()->sb_to_idx(prefix_indices, lsv); + rel_base += offset; // If the part select covers exactly the entire // vector, then do not bother with it. Return the // signal itself. - if (rel_base == (long) (wid-1) && wid == net->vector_width()) { + if (rel_base == (long)(wid-1) && wid == net->vector_width()) { delete base; net->cast_signed(false); return net; @@ -5370,7 +5372,6 @@ NetExpr* PEIdent::elaborate_expr_net_idx_do_(Design*des, NetScope*scope, // Otherwise, make a part select that covers the right // range. - rel_base += offset; ex = new NetEConst(verinum(rel_base)); if (warn_ob_select) { if (rel_base < 0) {