Fix width calculation for bit/part selects of multi-dimensioned packed arrays.
If we have a bit/part select that is selecting one or more sub-arrays, e.g. wire [3:0][3:0] foo; assign foo[1] = 4'd1; we need to take into account the bit width of the sub-array when calculating the bit width of the select.
This commit is contained in:
parent
3167b2ed24
commit
7c024d6cab
|
|
@ -4071,6 +4071,15 @@ unsigned PEIdent::test_width(Design*des, NetScope*scope, width_mode_t&mode)
|
|||
}
|
||||
|
||||
if (use_width != UINT_MAX) {
|
||||
// We have a bit/part select. Account for any remaining dimensions
|
||||
// beyond the indexed dimension.
|
||||
size_t use_depth = name_tail.index.size();
|
||||
if (net) {
|
||||
if (use_depth >= net->unpacked_dimensions())
|
||||
use_depth -= net->unpacked_dimensions();
|
||||
use_width *= net->slice_width(use_depth);
|
||||
}
|
||||
|
||||
expr_type_ = IVL_VT_LOGIC; // Assume bit/parts selects are logic
|
||||
expr_width_ = use_width;
|
||||
min_width_ = use_width;
|
||||
|
|
|
|||
Loading…
Reference in New Issue