Make sure divide expressions are evaluated using the expression width.
The operands of divide need to be at least the width of the expression when calculating a constant divide. The only matters for the special case where the result is x, because the verinum implementation of divide will get the result width from the left expression width.
This commit is contained in:
parent
27410f5d88
commit
94e7d71b97
|
|
@ -858,8 +858,10 @@ NetExpr* NetEBDiv::eval_tree(int prune_to_width)
|
|||
NetEConst*rc = dynamic_cast<NetEConst*>(right_);
|
||||
if (rc == 0) return 0;
|
||||
|
||||
verinum lval = lc->value();
|
||||
verinum rval = rc->value();
|
||||
// Make sure the expression is evaluated at the
|
||||
// expression width.
|
||||
verinum lval = pad_to_width(lc->value(), expr_width());
|
||||
verinum rval = pad_to_width(rc->value(), expr_width());
|
||||
|
||||
NetExpr*tmp = 0;
|
||||
switch (op_) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue