Real valued nets are signed, and pform unary expression have width.
Real valued nets should ne treated as signed no matter what. Also, PEUnary nary expressions need a useful test_width method.
This commit is contained in:
parent
1ae2c0c9e0
commit
30e6cfce41
4
PExpr.h
4
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,
|
||||
|
|
|
|||
19
elab_expr.cc
19
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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue