Fix for br978 - assertion involving addition of $ivlh_to_unsigned() result.

$ivlh_to_unsigned, unlike $signed and $signed, can cause a reduction
in width. The shared PECallFunction::cast_to_width_ method did not
support this.
This commit is contained in:
Martin Whitaker 2015-05-21 23:57:45 +01:00
parent ced9759c65
commit ab688613cc
1 changed files with 1 additions and 1 deletions

View File

@ -1418,7 +1418,7 @@ NetExpr*PECallFunction::cast_to_width_(NetExpr*expr, unsigned wid) const
const. This is a more efficient result. */
if (NetEConst*tmp = dynamic_cast<NetEConst*>(expr)) {
tmp->cast_signed(signed_flag_);
if (wid > tmp->expr_width()) {
if (wid != tmp->expr_width()) {
tmp = new NetEConst(verinum(tmp->value(), wid));
tmp->set_line(*this);
delete expr;