diff --git a/src/V3SplitVar.cpp b/src/V3SplitVar.cpp index 9e29743e0..38ea0da47 100644 --- a/src/V3SplitVar.cpp +++ b/src/V3SplitVar.cpp @@ -460,13 +460,17 @@ class SplitUnpackedVarVisitor : public AstNVisitor, public SplitVarImpl { if (nodep->sensesp()) { // When visiting sensitivity list, always is the context setContextAndIterate(nodep, nodep->sensesp()); } - if (AstNode* bodysp = nodep->bodysp()) iterate(bodysp); + for (AstNode* bodysp = nodep->bodysp(); bodysp; bodysp = bodysp->nextp()) { + iterate(bodysp); + } }; virtual void visit(AstAlwaysPublic* nodep) override { if (nodep->sensesp()) { // When visiting sensitivity list, always is the context setContextAndIterate(nodep, nodep->sensesp()); } - if (AstNode* bodysp = nodep->bodysp()) iterate(bodysp); + for (AstNode* bodysp = nodep->bodysp(); bodysp; bodysp = bodysp->nextp()) { + iterate(bodysp); + } } virtual void visit(AstNodeFTaskRef* nodep) override { VL_RESTORER(m_contextp); diff --git a/test_regress/t/t_split_var_0.v b/test_regress/t/t_split_var_0.v index 08295706a..c317d5f9e 100644 --- a/test_regress/t/t_split_var_0.v +++ b/test_regress/t/t_split_var_0.v @@ -166,7 +166,8 @@ module barshift_1d_unpacked_struct1 #(parameter DEPTH = 2, localparam WIDTH = 2* end endgenerate assign tmp[0+OFFSET] = {pad, in}; - assign out = tmp[DEPTH+OFFSET][WIDTH-1:0]; + logic _dummy; + always_comb {_dummy, out[WIDTH-1:1], out[0]} = tmp[DEPTH+OFFSET][WIDTH:0]; endmodule