fix handling of end labels

- disallow using end label alone on blocks
- improved parse error for mismatches
- add label checking for non-block constructs
- allow generate block to have label before begin
This commit is contained in:
Zachary Snow
2021-06-15 17:47:32 -04:00
parent a87ee7c11b
commit c0cb401abe
13 changed files with 138 additions and 21 deletions
+45
View File
@@ -0,0 +1,45 @@
class C #(
parameter X
);
localparam Y = X * 2;
endclass : C
package P;
localparam Z = 3;
endpackage : P
`define DUMP(expr) initial $display(`"expr = %0d`", expr);
interface intf;
initial $display("intf");
endinterface : intf
module top;
intf i();
function automatic integer f;
input integer inp;
return inp * 8;
endfunction : f
task t;
$display("t()");
endtask : t
localparam W = 4;
`DUMP(W)
`DUMP(C#(3)::X)
`DUMP(C#(3)::Y)
`DUMP(P::Z)
`DUMP(f(3))
initial t();
initial begin : blkA
$display("Hello!");
end : blkA
if (1) begin : blkB
initial $display("Bye!");
end : blkB
initial blkC : begin
$display("No!");
end : blkC
if (1) blkD : begin
initial $display("Way!");
end : blkD
endmodule : top
+19
View File
@@ -0,0 +1,19 @@
`define DUMP(expr, value) initial $display(`"expr = %0d`", value);
module top;
`DUMP(W, 4)
`DUMP(C#(3)::X, 3)
`DUMP(C#(3)::Y, 6)
`DUMP(P::Z, 3)
`DUMP(f(3), 24)
if (1) initial begin
$display("intf");
$display("Bye!");
$display("Way!");
end
initial begin
$display("t()");
$display("Hello!");
$display("No!");
end
endmodule