Allow stream concatenation in init array patterns
AstInitArray values are assignment-pattern members, but width checking did not propagate assignment-like streaming context to those elements. Legal streaming concatenations were therefore rejected as implicit casts under IEEE 1800-2023 11.4.17. Propagate STREAM_USE_ASSIGN while visiting init-array values. Extend the existing array-pattern concatenation regression with a runtime streaming member instead of adding a duplicate test driver. The consolidated regression fails on origin/master with the 11.4.17 diagnostic and passes after this change. Adjacent stream diagnostics and array-pattern tests remain unchanged.
This commit is contained in:
parent
dde8de0a0d
commit
b1d4a53576
|
|
@ -3453,7 +3453,8 @@ class WidthVisitor final : public VNVisitor {
|
|||
}
|
||||
const AstNodeDType* const arrayp = nodep->dtypep()->skipRefp();
|
||||
if (VN_IS(arrayp, NodeArrayDType) || VN_IS(arrayp, AssocArrayDType)) {
|
||||
userIterateChildren(nodep, WidthVP{arrayp->subDTypep(), BOTH}.p());
|
||||
userIterateChildren(nodep,
|
||||
WidthVP{arrayp->subDTypep(), BOTH, STREAM_USE_ASSIGN}.p());
|
||||
} else {
|
||||
UINFO(1, "on " << nodep);
|
||||
UINFO(1, "dtype object " << arrayp);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,12 @@ endpackage
|
|||
|
||||
module t ( /*AUTOARG*/);
|
||||
|
||||
typedef logic [31:0] word_t;
|
||||
typedef word_t word_pair_t[2];
|
||||
|
||||
word_t stream_src = 32'h1234_5678;
|
||||
word_pair_t stream_words;
|
||||
|
||||
// Test: array concatenation in pattern initialization
|
||||
// An array localparam used as a value in another array's pattern
|
||||
// should have its elements "flattened" into the target array.
|
||||
|
|
@ -78,6 +84,11 @@ module t ( /*AUTOARG*/);
|
|||
localparam logic [31:0] PKG_SLICE[4] = '{arr_pkg::PKG_ADDRS[0:1], 32'hAA, 32'hBB};
|
||||
|
||||
initial begin
|
||||
// Streaming concatenation as a positional assignment-pattern member
|
||||
stream_words = '{{<<8{stream_src}}, 32'h0};
|
||||
`checkh(stream_words[0], 32'h7856_3412);
|
||||
`checkh(stream_words[1], 32'h0000_0000);
|
||||
|
||||
`checkh(ALL_ADDRS[0], 32'h80001000);
|
||||
`checkh(ALL_ADDRS[1], 32'h80002000);
|
||||
`checkh(ALL_ADDRS[2], 32'h80003000);
|
||||
|
|
|
|||
Loading…
Reference in New Issue