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.
This commit is contained in:
Martin Whitaker 2008-10-06 00:44:17 +01:00 committed by Stephen Williams
parent 610dedc2b8
commit b5ad161f90
1 changed files with 14 additions and 0 deletions

View File

@ -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