From f34a3020a6952f4e0066f5abf177100b5620a7eb Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Mon, 11 Apr 2011 22:20:52 +0100 Subject: [PATCH] Fix for lossless width estimation in shift operations. If the right hand operand of a shift is a signed vector value, it is coerced to an unsigned value. This needs to be allowed for when estimating the width expansion caused by a shift in a lossless expression. --- elab_expr.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elab_expr.cc b/elab_expr.cc index 7194909a6..3a5ee321a 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -625,7 +625,7 @@ unsigned PEBLeftWidth::test_width(Design*des, NetScope*scope, width_mode_t&mode) long r_val = LONG_MAX; if (r_width < sizeof(long)*8) { r_val = (1L << r_width) - 1L; - if (right_->has_sign()) + if ((op_ == 'p') && right_->has_sign()) r_val >>= 1; }