Handle number literals as real-valued r-values.
This commit is contained in:
parent
82ebf6372c
commit
2464582587
2
PExpr.h
2
PExpr.h
|
|
@ -596,7 +596,7 @@ class PENumber : public PExpr {
|
||||||
virtual unsigned test_width(Design*des, NetScope*scope,
|
virtual unsigned test_width(Design*des, NetScope*scope,
|
||||||
width_mode_t&mode);
|
width_mode_t&mode);
|
||||||
|
|
||||||
virtual NetEConst*elaborate_expr(Design*des, NetScope*scope,
|
virtual NetExpr *elaborate_expr(Design*des, NetScope*scope,
|
||||||
ivl_type_t type, unsigned flags) const;
|
ivl_type_t type, unsigned flags) const;
|
||||||
virtual NetEConst*elaborate_expr(Design*des, NetScope*,
|
virtual NetEConst*elaborate_expr(Design*des, NetScope*,
|
||||||
unsigned expr_wid, unsigned) const;
|
unsigned expr_wid, unsigned) const;
|
||||||
|
|
|
||||||
11
elab_expr.cc
11
elab_expr.cc
|
|
@ -4843,7 +4843,7 @@ unsigned PENumber::test_width(Design*, NetScope*, width_mode_t&mode)
|
||||||
return expr_width_;
|
return expr_width_;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetEConst* PENumber::elaborate_expr(Design*des, NetScope*, ivl_type_t ntype, unsigned) const
|
NetExpr* PENumber::elaborate_expr(Design*des, NetScope*, ivl_type_t ntype, unsigned) const
|
||||||
{
|
{
|
||||||
const netvector_t*use_type = dynamic_cast<const netvector_t*> (ntype);
|
const netvector_t*use_type = dynamic_cast<const netvector_t*> (ntype);
|
||||||
if (use_type == 0) {
|
if (use_type == 0) {
|
||||||
|
|
@ -4854,6 +4854,15 @@ NetEConst* PENumber::elaborate_expr(Design*des, NetScope*, ivl_type_t ntype, uns
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Special case: If the context type is REAL, then cast the
|
||||||
|
// vector value to a real and rethrn a NetECReal.
|
||||||
|
if (ntype->base_type() == IVL_VT_REAL) {
|
||||||
|
verireal val (value_->as_long());
|
||||||
|
NetECReal*tmp = new NetECReal(val);
|
||||||
|
tmp->set_line(*this);
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
verinum use_val = value();
|
verinum use_val = value();
|
||||||
use_val .has_sign( use_type->get_signed() );
|
use_val .has_sign( use_type->get_signed() );
|
||||||
use_val = cast_to_width(use_val, use_type->packed_width());
|
use_val = cast_to_width(use_val, use_type->packed_width());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue