From 43c6a0bacd03510fc6f1e7922fc155a14cd9f1eb Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Mon, 3 Nov 2014 10:49:05 +0100 Subject: [PATCH] ivl: Casting to int. --- elab_expr.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/elab_expr.cc b/elab_expr.cc index e8507e904..84a0ab502 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -2464,7 +2464,8 @@ unsigned PECastType::test_width(Design*des, NetScope*scope, width_mode_t&wid) } else { - expr_width_ = t->packed_width(); + expr_width_ = t->packed_width(); + signed_flag_= false; } min_width_ = expr_width_; @@ -2474,12 +2475,18 @@ unsigned PECastType::test_width(Design*des, NetScope*scope, width_mode_t&wid) NetExpr* PECastType::elaborate_expr(Design*des, NetScope*scope, unsigned, unsigned) const { + NetExpr*expr = base_->elaborate_expr(des, scope, base_->expr_width(), NO_FLAGS); + if(dynamic_cast(target_)) { - NetExpr*expr = base_->elaborate_expr(des, scope, base_->expr_width(), NO_FLAGS); return cast_to_real(expr); } + if(dynamic_cast(target_)) + { + return cast_to_int2(expr, expr_width_); + } + cerr << get_fileline() << "sorry: I don't know how to cast expression." << endl; ivl_assert(*this, false);