From a74f2827b20833675a303f3aa6790376f9df243b Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Thu, 12 Jun 2008 21:56:46 -0700 Subject: [PATCH] Part select of signals is always unsigned. Part select of an entire signal returns just the NetESignal itself, but since part selects are always unsigned, even if the selected signal is signed, we need to cast the NetESignal to unsigned first. --- elab_expr.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/elab_expr.cc b/elab_expr.cc index 82399cb1c..2939b91d9 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -1567,9 +1567,11 @@ NetExpr* PEIdent::elaborate_expr_net_part_(Design*des, NetScope*scope, // If the part select covers exactly the entire // vector, then do not bother with it. Return the - // signal itself. - if (sb_lsb == 0 && wid == net->vector_width()) + // signal itself, casting to unsigned if necessary. + if (sb_lsb == 0 && wid == net->vector_width()) { + net->cast_signed(false); return net; + } // If the part select covers NONE of the vector, then return a // constant X.