Elaborate divide expressions to the proper width.

If the operands of a divide expression are fixed width, pad them out
to the width of the expression so that the calculations come out right.
This commit is contained in:
Stephen Williams 2008-10-30 21:19:56 -07:00
parent 1922a0df9e
commit 1ec09327e9
1 changed files with 10 additions and 0 deletions

View File

@ -404,6 +404,16 @@ NetExpr* PEBinary::elaborate_expr_base_div_(Design*des,
}
}
/* The original elaboration of the left and right expressions
already tried to elaborate to the expr_wid. If the
expressions are not that width by now, then they need to be
padded. The divide expression operands must be the width
of the output. */
if (expr_wid > 0) {
lp = pad_to_width(lp, expr_wid);
rp = pad_to_width(rp, expr_wid);
}
NetEBDiv*tmp = new NetEBDiv(op_, lp, rp);
tmp->set_line(*this);