Elaborate r-vlaue packed struct members pads as needed.
This commit is contained in:
parent
fc42f40770
commit
f906384423
11
elab_expr.cc
11
elab_expr.cc
|
|
@ -3321,9 +3321,14 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope,
|
||||||
<< "got " << use_path.back().index.size() << "." << endl;
|
<< "got " << use_path.back().index.size() << "." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return check_for_struct_members(this, des, use_scope,
|
NetExpr*tmp = check_for_struct_members(this, des, use_scope,
|
||||||
net, use_path.back().index,
|
net, use_path.back().index,
|
||||||
member_comp);
|
member_comp);
|
||||||
|
if (!tmp) return 0;
|
||||||
|
|
||||||
|
tmp = pad_to_width(tmp, expr_wid, *this);
|
||||||
|
tmp->cast_signed(signed_flag_);
|
||||||
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (net->class_type() != 0) {
|
if (net->class_type() != 0) {
|
||||||
|
|
|
||||||
27
elaborate.cc
27
elaborate.cc
|
|
@ -129,8 +129,8 @@ void PGAssign::elaborate(Design*des, NetScope*scope) const
|
||||||
<< ", expr=" << *rval_expr << endl;
|
<< ", expr=" << *rval_expr << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(lval && rval);
|
ivl_assert(*this, lval && rval);
|
||||||
assert(rval->pin_count() == 1);
|
ivl_assert(*this, rval->pin_count() == 1);
|
||||||
|
|
||||||
// Detect the case that the rvalue-expression is a simple
|
// Detect the case that the rvalue-expression is a simple
|
||||||
// expression. In this case, we will need to create a driver
|
// expression. In this case, we will need to create a driver
|
||||||
|
|
@ -139,23 +139,14 @@ void PGAssign::elaborate(Design*des, NetScope*scope) const
|
||||||
if (dynamic_cast<NetESignal*>(rval_expr))
|
if (dynamic_cast<NetESignal*>(rval_expr))
|
||||||
need_driver_flag = true;
|
need_driver_flag = true;
|
||||||
|
|
||||||
#if 0
|
// expression elaboration should have caused the rval width to
|
||||||
// MTW, 01-Mar-2013. The expression elaboration rework should have
|
// match the l-value by now.
|
||||||
// ensured that this can no longer occur. Leaving this here for the
|
if (rval->vector_width() < lval->vector_width()) {
|
||||||
// moment, but it should be safe to remove it.
|
cerr << get_fileline() << ": internal error: "
|
||||||
|
<< "lval-rval width mismatch: "
|
||||||
/* If the r-value insists on being smaller than the l-value
|
<< "rval->vector_width()==" << rval->vector_width()
|
||||||
(perhaps it is explicitly sized) the pad it out to be the
|
<< ", lval->vector_width()==" << lval->vector_width() << endl;
|
||||||
right width so that something is connected to all the bits
|
|
||||||
of the l-value. */
|
|
||||||
if (lval->vector_width() > rval->vector_width()) {
|
|
||||||
if (rval->get_signed())
|
|
||||||
rval = pad_to_width_signed(des, rval, lval->vector_width(),
|
|
||||||
*this);
|
|
||||||
else
|
|
||||||
rval = pad_to_width(des, rval, lval->vector_width(), *this);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
ivl_assert(*this, rval->vector_width() >= lval->vector_width());
|
ivl_assert(*this, rval->vector_width() >= lval->vector_width());
|
||||||
|
|
||||||
/* If the r-value insists on being larger than the l-value,
|
/* If the r-value insists on being larger than the l-value,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue