mirror of
https://github.com/YosysHQ/yosys
synced 2025-08-18 01:02:19 +00:00
Merge pull request #5283 from YosysHQ/emil/fix-simplify-initstate
simplify: fix initstate crash
This commit is contained in:
commit
9d047f9a30
2 changed files with 18 additions and 2 deletions
|
@ -3369,13 +3369,14 @@ skip_dynamic_range_lvalue_expansion:;
|
|||
wire->str = stringf("$initstate$%d_wire", myidx);
|
||||
while (wire->simplify(true, 1, -1, false)) { }
|
||||
|
||||
auto cell = std::make_unique<AstNode>(location, AST_CELL, std::make_unique<AstNode>(location, AST_CELLTYPE), std::make_unique<AstNode>(location, AST_ARGUMENT, std::make_unique<AstNode>(location, AST_IDENTIFIER)));
|
||||
auto cell_owned = std::make_unique<AstNode>(location, AST_CELL, std::make_unique<AstNode>(location, AST_CELLTYPE), std::make_unique<AstNode>(location, AST_ARGUMENT, std::make_unique<AstNode>(location, AST_IDENTIFIER)));
|
||||
auto* cell = cell_owned.get();
|
||||
cell->str = stringf("$initstate$%d", myidx);
|
||||
cell->children[0]->str = "$initstate";
|
||||
cell->children[1]->str = "\\Y";
|
||||
cell->children[1]->children[0]->str = wire->str;
|
||||
cell->children[1]->children[0]->id2ast = wire;
|
||||
current_ast_mod->children.push_back(std::move(cell));
|
||||
current_ast_mod->children.push_back(std::move(cell_owned));
|
||||
while (cell->simplify(true, 1, -1, false)) { }
|
||||
|
||||
newNode = std::make_unique<AstNode>(location, AST_IDENTIFIER);
|
||||
|
|
15
tests/verilog/fcall_smoke.ys
Normal file
15
tests/verilog/fcall_smoke.ys
Normal file
|
@ -0,0 +1,15 @@
|
|||
read_verilog -sv <<EOT
|
||||
module smoke_initstate (
|
||||
input resetn,
|
||||
input clk,
|
||||
input a
|
||||
);
|
||||
always @(posedge clk) begin
|
||||
assert property ($stable(a));
|
||||
assert property ($changed(a));
|
||||
assert property ($rose(a));
|
||||
assert property ($fell(a));
|
||||
assume(resetn == !$initstate);
|
||||
end
|
||||
endmodule
|
||||
EOT
|
Loading…
Add table
Add a link
Reference in a new issue