3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-06 14:13:23 +00:00

sv: fix up end label checking

- disallow [gen]blocks with an end label but not begin label
- check validity of module end label
- fix memory leak of package name and end label
- fix memory leak of module end label
This commit is contained in:
Zachary Snow 2021-06-14 15:32:01 -04:00 committed by Zachary Snow
parent 092f0cb01e
commit f2c2d73f36
7 changed files with 98 additions and 7 deletions

View file

@ -0,0 +1,9 @@
logger -expect error "Begin label missing where end label \(incorrect_name\) was given\." 1
read_verilog -sv <<EOF
module top;
initial
begin
$display("HI");
end : incorrect_name
endmodule
EOF

View file

@ -0,0 +1,9 @@
logger -expect error "Begin label \(correct_name\) and end label \(incorrect_name\) don't match\." 1
read_verilog -sv <<EOF
module top;
initial
begin : correct_name
$display("HI");
end : incorrect_name
endmodule
EOF

View file

@ -0,0 +1,9 @@
logger -expect error "Begin label missing where end label \(incorrect_name\) was given\." 1
read_verilog -sv <<EOF
module top;
if (1)
begin
initial $display("HI");
end : incorrect_name
endmodule
EOF

View file

@ -0,0 +1,9 @@
logger -expect error "Begin label \(correct_name\) and end label \(incorrect_name\) don't match\." 1
read_verilog -sv <<EOF
module top;
if (1)
begin : correct_name
initial $display("HI");
end : incorrect_name
endmodule
EOF

View file

@ -0,0 +1,15 @@
logger -expect-no-warnings
read_verilog -sv <<EOF
module correct_name;
localparam X = 1;
endmodule : correct_name
EOF
design -reset
logger -expect error "Module name \(correct_name\) and end label \(incorrect_name\) don't match\." 1
read_verilog -sv <<EOF
module correct_name;
localparam X = 1;
endmodule : incorrect_name
EOF