From b5ad161f908890357fdb7630d892eeff7130b731 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Mon, 6 Oct 2008 00:44:17 +0100 Subject: [PATCH] Fix for pr2148500. This patch fixes the expression width calculation for a multiply operation with an unsized operation. The expression width needs to be at least the minimum of the maximum multiply result width and the width of an integer. --- elab_expr.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/elab_expr.cc b/elab_expr.cc index 21518e99a..d7a8dd7e8 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -154,6 +154,20 @@ unsigned PEBinary::test_width(Design*des, NetScope*scope, min = lval; break; + case '*': + if (unsized_flag && type_is_vectorable(expr_type)) { + unsigned use_wid = wid_left + wid_right; + if (use_wid > integer_width) + use_wid = integer_width; + if (use_wid > min) + min = use_wid; + } + if (wid_left > min) + min = wid_left; + if (wid_right > min) + min = wid_right; + break; + case 'l': // << Should be handled by PEBShift case '<': // < Should be handled by PEBComp case '>': // > Should be handled by PEBComp