mirror of
https://github.com/zachjs/sv2v.git
synced 2026-09-07 19:56:44 +02:00
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:
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user