mirror of https://github.com/YosysHQ/yosys.git
Add check of begin/end labels for genblock
Signed-off-by: Kamil Rakoczy <krakoczy@antmicro.com>
This commit is contained in:
parent
baf1875307
commit
98c4feb72f
|
@ -2794,6 +2794,8 @@ gen_block:
|
||||||
ast_stack.push_back(node);
|
ast_stack.push_back(node);
|
||||||
} module_gen_body TOK_END opt_label {
|
} module_gen_body TOK_END opt_label {
|
||||||
exitTypeScope();
|
exitTypeScope();
|
||||||
|
if ($3 != NULL && $7 != NULL && *$3 != *$7)
|
||||||
|
frontend_verilog_yyerror("Begin label (%s) and end label (%s) don't match.", $3->c_str()+1, $7->c_str()+1);
|
||||||
delete $3;
|
delete $3;
|
||||||
delete $7;
|
delete $7;
|
||||||
SET_AST_NODE_LOC(ast_stack.back(), @1, @7);
|
SET_AST_NODE_LOC(ast_stack.back(), @1, @7);
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
read_verilog <<EOT
|
||||||
|
module foo;
|
||||||
|
|
||||||
|
genvar a = 0;
|
||||||
|
for (a = 0; a < 10; a++) begin : a
|
||||||
|
end : a
|
||||||
|
endmodule
|
||||||
|
EOT
|
||||||
|
read_verilog <<EOT
|
||||||
|
module foo2;
|
||||||
|
|
||||||
|
genvar a = 0;
|
||||||
|
for (a = 0; a < 10; a++) begin : a
|
||||||
|
end
|
||||||
|
endmodule
|
||||||
|
EOT
|
||||||
|
|
||||||
|
logger -expect error "Begin label \(a\) and end label \(b\) don't match\." 1
|
||||||
|
read_verilog <<EOT
|
||||||
|
module foo3;
|
||||||
|
|
||||||
|
genvar a = 0;
|
||||||
|
for (a = 0; a < 10; a++) begin : a
|
||||||
|
end : b
|
||||||
|
endmodule
|
||||||
|
EOT
|
Loading…
Reference in New Issue