Fix overflow calculating packed offset in certain cases.
This commit is contained in:
parent
0accab6ec4
commit
e2bad56a5c
|
|
@ -559,8 +559,9 @@ NetNet* PEIdent::elaborate_lnet_common_(Design*des, NetScope*scope,
|
||||||
packed_base = collapse_array_indices(des, scope, sig, tmp_index);
|
packed_base = collapse_array_indices(des, scope, sig, tmp_index);
|
||||||
|
|
||||||
if (debug_elaborate) {
|
if (debug_elaborate) {
|
||||||
cerr << get_fileline() << ": debug: "
|
cerr << get_fileline() << ": PEIdent::elaborate_lnet_common_: "
|
||||||
<< "packed_base expression = " << *packed_base << endl;
|
<< "packed_base=" << *packed_base
|
||||||
|
<< ", member_off=" << member_off << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -309,7 +309,7 @@ NetExpr *normalize_variable_base(NetExpr *base, long msb, long lsb,
|
||||||
if (min_wid < base->expr_width()) min_wid = base->expr_width();
|
if (min_wid < base->expr_width()) min_wid = base->expr_width();
|
||||||
/* Now that we have the minimum needed width increase it by
|
/* Now that we have the minimum needed width increase it by
|
||||||
* one to make room for the normalization calculation. */
|
* one to make room for the normalization calculation. */
|
||||||
min_wid += 1;
|
min_wid += 2;
|
||||||
/* Pad the base expression to the correct width. */
|
/* Pad the base expression to the correct width. */
|
||||||
base = pad_to_width(base, min_wid, *base);
|
base = pad_to_width(base, min_wid, *base);
|
||||||
/* If the base expression is unsigned and either the lsb
|
/* If the base expression is unsigned and either the lsb
|
||||||
|
|
@ -344,7 +344,7 @@ NetExpr *normalize_variable_base(NetExpr *base, long msb, long lsb,
|
||||||
if (min_wid < base->expr_width()) min_wid = base->expr_width();
|
if (min_wid < base->expr_width()) min_wid = base->expr_width();
|
||||||
/* Now that we have the minimum needed width increase it by
|
/* Now that we have the minimum needed width increase it by
|
||||||
* one to make room for the normalization calculation. */
|
* one to make room for the normalization calculation. */
|
||||||
min_wid += 1;
|
min_wid += 2;
|
||||||
/* Pad the base expression to the correct width. */
|
/* Pad the base expression to the correct width. */
|
||||||
base = pad_to_width(base, min_wid, *base);
|
base = pad_to_width(base, min_wid, *base);
|
||||||
/* If the offset is greater than zero then we need to do
|
/* If the offset is greater than zero then we need to do
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue