3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-06-20 07:46:31 +00:00
This commit is contained in:
ALAN-Hu-1999 2026-06-19 04:05:48 +00:00 committed by GitHub
commit 94fe6c4274
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 3 deletions

View file

@ -3694,14 +3694,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