This commit is contained in:
ALAN-Hu-1999 2026-06-09 18:19:34 +02:00 committed by GitHub
commit f4f2031bcb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 3 deletions

View File

@ -3687,14 +3687,22 @@ skip_dynamic_range_lvalue_expansion:;
}
if (assign_data)
newNode->children.push_back(std::move(assign_data));
std::unique_ptr<AstNode> meminit_en = nullptr;
if (current_always->type == AST_INITIAL && assign_en && assign_en->children[1]->isConst())
meminit_en = assign_en->children[1]->clone();
if (assign_en)
newNode->children.push_back(std::move(assign_en));
std::unique_ptr<AstNode> wrnode;
if (current_always->type == AST_INITIAL)
wrnode = std::make_unique<AstNode>(location, AST_MEMINIT, std::move(node_addr), std::move(node_data), std::move(node_en), mkconst_int(location, 1, false));
else
if (current_always->type == AST_INITIAL) {
if (!meminit_en)
meminit_en = std::move(node_en);
wrnode = std::make_unique<AstNode>(location, AST_MEMINIT, std::move(node_addr), std::move(node_data), std::move(meminit_en), mkconst_int(location, 1, false));
} else {
wrnode = std::make_unique<AstNode>(location, AST_MEMWR, std::move(node_addr), std::move(node_data), std::move(node_en));
}
wrnode->str = children[0]->str;
wrnode->id2ast = children[0]->id2ast;
wrnode->location = location;

View File

@ -0,0 +1,16 @@
read_verilog <<EOT
module top(output [31:0] y);
reg [31:0] mem [0:3];
initial begin
mem[0] = 32'h00000000;
mem[1] = 32'h11111111;
mem[2] = 32'h22222222;
mem[3] = 32'h33333333;
end
assign y = mem[0];
endmodule
EOT
write_verilog