From ab688613ccfd792e824bff22af287cdf0c023f5b Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Thu, 21 May 2015 23:57:45 +0100 Subject: [PATCH] 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. --- elab_expr.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elab_expr.cc b/elab_expr.cc index e309f6162..8c53b6066 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -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(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;