diff --git a/eval_tree.cc b/eval_tree.cc index 9e027871f..89a105d53 100644 --- a/eval_tree.cc +++ b/eval_tree.cc @@ -1661,9 +1661,25 @@ NetExpr* NetEUBits::eval_tree(int prune_to_width) return NetEUnary::eval_tree(prune_to_width); } +NetEConst* NetEUReduce::eval_tree_real_() +{ + ivl_assert(*this, op_ == '!'); + + NetECReal*val= dynamic_cast (expr_); + if (val == 0) return 0; + + verinum::V res = val->value().as_double() == 0.0 ? verinum::V1 : + verinum::V0; + + return new NetEConst(verinum(res, 1)); +} + + NetEConst* NetEUReduce::eval_tree(int prune_to_width) { eval_expr(expr_); + if (expr_type() == IVL_VT_REAL) return eval_tree_real_(); + NetEConst*rval = dynamic_cast(expr_); if (rval == 0) return 0; diff --git a/netlist.h b/netlist.h index 40019ceea..300ea885f 100644 --- a/netlist.h +++ b/netlist.h @@ -3804,6 +3804,9 @@ class NetEUReduce : public NetEUnary { virtual NetEUReduce* dup_expr() const; virtual NetEConst* eval_tree(int prune_to_width = -1); virtual ivl_variable_type_t expr_type() const; + + private: + virtual NetEConst* eval_tree_real_(); }; /*