diff --git a/PExpr.h b/PExpr.h index 08dccdd29..eef09b5f1 100644 --- a/PExpr.h +++ b/PExpr.h @@ -492,6 +492,10 @@ class PEUnary : public PExpr { virtual void dump(ostream&out) const; + virtual unsigned test_width(Design*des, NetScope*scope, + unsigned min, unsigned lval, + bool&unsized_flag) const; + virtual bool elaborate_sig(Design*des, NetScope*scope) const; virtual NetNet* elaborate_net(Design*des, NetScope*scope, diff --git a/elab_expr.cc b/elab_expr.cc index 8d7392d39..2af5b86f8 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -1954,6 +1954,25 @@ NetETernary*PETernary::elaborate_expr(Design*des, NetScope*scope, return res; } +unsigned PEUnary::test_width(Design*des, NetScope*scope, + unsigned min, unsigned lval, + bool&unsized_flag) const +{ + switch (op_) { + case '!': + case '&': + case '|': // Reduction OR + case '^': // Reduction XOR + case 'A': // Reduction NAND (~&) + case 'N': // Reduction NOR (~|) + case 'X': // Reduction NXOR (~^) + return 1; + default: + return expr_->test_width(des, scope, min, lval, unsized_flag); + } +} + + NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope, int expr_wid, bool) const { diff --git a/netlist.cc b/netlist.cc index 462947d52..273b6af28 100644 --- a/netlist.cc +++ b/netlist.cc @@ -604,7 +604,10 @@ void NetNet::data_type(ivl_variable_type_t t) bool NetNet::get_signed() const { - return signed_; + if (data_type_ == IVL_VT_REAL) + return true; + else + return signed_; } void NetNet::set_signed(bool flag)