426 lines
6.2 KiB
Plaintext
426 lines
6.2 KiB
Plaintext
# a fenced region comes out byte-exact, weird spacing and all
|
|
module m;
|
|
// verilog_format: off
|
|
wire [3:0] a = 4'h1;
|
|
wire [31:0] bb= 32'h2;
|
|
// verilog_format: on
|
|
wire c;
|
|
endmodule
|
|
----
|
|
module m;
|
|
// verilog_format: off
|
|
wire [3:0] a = 4'h1;
|
|
wire [31:0] bb= 32'h2;
|
|
// verilog_format: on
|
|
wire c;
|
|
endmodule
|
|
====
|
|
# the lucisv alias fences the same region
|
|
module m;
|
|
// lucisv: off
|
|
wire [3:0] a;
|
|
// lucisv: on
|
|
wire b;
|
|
endmodule
|
|
----
|
|
module m;
|
|
// lucisv: off
|
|
wire [3:0] a;
|
|
// lucisv: on
|
|
wire b;
|
|
endmodule
|
|
====
|
|
# the two spellings are interchangeable across one region
|
|
module m;
|
|
// verilog_format: off
|
|
wire a;
|
|
// lucisv: on
|
|
wire b;
|
|
endmodule
|
|
----
|
|
module m;
|
|
// verilog_format: off
|
|
wire a;
|
|
// lucisv: on
|
|
wire b;
|
|
endmodule
|
|
====
|
|
# a region keeps its own indentation, first line included
|
|
module m;
|
|
// lucisv: off
|
|
wire a;
|
|
wire b;
|
|
// lucisv: on
|
|
wire c;
|
|
endmodule
|
|
----
|
|
module m;
|
|
// lucisv: off
|
|
wire a;
|
|
wire b;
|
|
// lucisv: on
|
|
wire c;
|
|
endmodule
|
|
====
|
|
# a fence at the top of the file
|
|
// lucisv: off
|
|
module m; endmodule
|
|
// lucisv: on
|
|
module n;
|
|
wire a;
|
|
endmodule
|
|
----
|
|
// lucisv: off
|
|
module m; endmodule
|
|
// lucisv: on
|
|
module n;
|
|
wire a;
|
|
endmodule
|
|
====
|
|
# an unmatched off runs to the end of the file
|
|
module m;
|
|
wire a;
|
|
endmodule
|
|
// lucisv: off
|
|
module n; wire b; endmodule
|
|
----
|
|
module m;
|
|
wire a;
|
|
endmodule
|
|
// lucisv: off
|
|
module n; wire b; endmodule
|
|
====
|
|
# an unmatched off runs to the end of the module body, not past endmodule
|
|
module m;
|
|
wire a;
|
|
// lucisv: off
|
|
wire b;
|
|
wire c;
|
|
endmodule
|
|
|
|
module n;
|
|
wire d;
|
|
endmodule
|
|
----
|
|
module m;
|
|
wire a;
|
|
// lucisv: off
|
|
wire b;
|
|
wire c;
|
|
endmodule
|
|
|
|
module n;
|
|
wire d;
|
|
endmodule
|
|
====
|
|
# an unmatched off keeps the comment trailing its last item
|
|
module m;
|
|
// lucisv: off
|
|
wire a; // note
|
|
endmodule
|
|
----
|
|
module m;
|
|
// lucisv: off
|
|
wire a; // note
|
|
endmodule
|
|
====
|
|
# an unmatched off swallows the scope's dangling comments too
|
|
module m;
|
|
// lucisv: off
|
|
wire a;
|
|
// dangling one
|
|
// dangling two
|
|
endmodule
|
|
----
|
|
module m;
|
|
// lucisv: off
|
|
wire a;
|
|
// dangling one
|
|
// dangling two
|
|
endmodule
|
|
====
|
|
# an on written after endmodule cannot close an off inside the module
|
|
module m;
|
|
// lucisv: off
|
|
wire a;
|
|
endmodule
|
|
// lucisv: on
|
|
module n;
|
|
wire b;
|
|
endmodule
|
|
----
|
|
module m;
|
|
// lucisv: off
|
|
wire a;
|
|
endmodule
|
|
// lucisv: on
|
|
module n;
|
|
wire b;
|
|
endmodule
|
|
====
|
|
# two regions in one file
|
|
module m;
|
|
// lucisv: off
|
|
wire a;
|
|
// lucisv: on
|
|
wire b;
|
|
// lucisv: off
|
|
wire c;
|
|
// lucisv: on
|
|
wire d;
|
|
endmodule
|
|
----
|
|
module m;
|
|
// lucisv: off
|
|
wire a;
|
|
// lucisv: on
|
|
wire b;
|
|
// lucisv: off
|
|
wire c;
|
|
// lucisv: on
|
|
wire d;
|
|
endmodule
|
|
====
|
|
# a fence with trailing text is not a fence
|
|
module m;
|
|
// lucisv: off (just for now)
|
|
wire a;
|
|
// lucisv: on
|
|
wire b;
|
|
endmodule
|
|
----
|
|
module m;
|
|
// lucisv: off (just for now)
|
|
wire a;
|
|
// lucisv: on
|
|
wire b;
|
|
endmodule
|
|
====
|
|
# a block comment is not a fence
|
|
module m;
|
|
/* lucisv: off */
|
|
wire a;
|
|
/* lucisv: on */
|
|
wire b;
|
|
endmodule
|
|
----
|
|
module m;
|
|
/* lucisv: off */
|
|
wire a;
|
|
/* lucisv: on */
|
|
wire b;
|
|
endmodule
|
|
====
|
|
# a fence written after code on the same line is not a fence
|
|
module m;
|
|
wire z; // lucisv: off
|
|
wire a;
|
|
endmodule
|
|
----
|
|
module m;
|
|
wire z; // lucisv: off
|
|
wire a;
|
|
endmodule
|
|
====
|
|
# an on with no open off is an ordinary comment
|
|
module m;
|
|
// lucisv: on
|
|
wire a;
|
|
endmodule
|
|
----
|
|
module m;
|
|
// lucisv: on
|
|
wire a;
|
|
endmodule
|
|
====
|
|
# a second off inside an open region is just text, the first on closes
|
|
module m;
|
|
// lucisv: off
|
|
wire a;
|
|
// lucisv: off
|
|
wire b;
|
|
// lucisv: on
|
|
wire c;
|
|
// lucisv: on
|
|
wire d;
|
|
endmodule
|
|
----
|
|
module m;
|
|
// lucisv: off
|
|
wire a;
|
|
// lucisv: off
|
|
wire b;
|
|
// lucisv: on
|
|
wire c;
|
|
// lucisv: on
|
|
wire d;
|
|
endmodule
|
|
====
|
|
# a region of nothing but comments
|
|
module m;
|
|
// lucisv: off
|
|
// +-------+
|
|
// | ascii |
|
|
// +-------+
|
|
// lucisv: on
|
|
wire a;
|
|
endmodule
|
|
----
|
|
module m;
|
|
// lucisv: off
|
|
// +-------+
|
|
// | ascii |
|
|
// +-------+
|
|
// lucisv: on
|
|
wire a;
|
|
endmodule
|
|
====
|
|
# comments before the off fence are still formatted, and never dropped
|
|
module m;
|
|
wire z;
|
|
|
|
// doc for the table
|
|
// lucisv: off
|
|
wire a;
|
|
// lucisv: on
|
|
wire b;
|
|
endmodule
|
|
----
|
|
module m;
|
|
wire z;
|
|
|
|
// doc for the table
|
|
// lucisv: off
|
|
wire a;
|
|
// lucisv: on
|
|
wire b;
|
|
endmodule
|
|
====
|
|
# valid-but-ugly code inside a region is left exactly as written
|
|
module m;
|
|
// lucisv: off
|
|
always@(posedge clk)if(en)q<=d;else q <= 1'b0;
|
|
assign y = {a,b , c} ;
|
|
// lucisv: on
|
|
assign z = a + b;
|
|
endmodule
|
|
----
|
|
module m;
|
|
// lucisv: off
|
|
always@(posedge clk)if(en)q<=d;else q <= 1'b0;
|
|
assign y = {a,b , c} ;
|
|
// lucisv: on
|
|
assign z = a + b;
|
|
endmodule
|
|
====
|
|
# attributes and directives inside a region are source bytes like anything else
|
|
module m;
|
|
// lucisv: off
|
|
(* keep *) wire a;
|
|
`ifdef FOO
|
|
wire b;
|
|
`endif
|
|
// lucisv: on
|
|
wire c;
|
|
endmodule
|
|
----
|
|
module m;
|
|
// lucisv: off
|
|
(* keep *) wire a;
|
|
`ifdef FOO
|
|
wire b;
|
|
`endif
|
|
// lucisv: on
|
|
wire c;
|
|
endmodule
|
|
====
|
|
# fences work in a package body
|
|
package p;
|
|
// lucisv: off
|
|
localparam int A =1;
|
|
// lucisv: on
|
|
localparam int B =2;
|
|
endpackage
|
|
----
|
|
package p;
|
|
// lucisv: off
|
|
localparam int A =1;
|
|
// lucisv: on
|
|
localparam int B = 2;
|
|
endpackage
|
|
====
|
|
# fences work inside a generate begin..end block
|
|
module m;
|
|
generate
|
|
if (X) begin : g
|
|
// lucisv: off
|
|
wire a;
|
|
// lucisv: on
|
|
wire b;
|
|
end
|
|
endgenerate
|
|
endmodule
|
|
----
|
|
module m;
|
|
generate
|
|
if (X) begin : g
|
|
// lucisv: off
|
|
wire a;
|
|
// lucisv: on
|
|
wire b;
|
|
end
|
|
endgenerate
|
|
endmodule
|
|
====
|
|
# a statement-level fence has no effect this round
|
|
module m;
|
|
always @(*) begin
|
|
// lucisv: off
|
|
x = 1;
|
|
// lucisv: on
|
|
y = 2;
|
|
end
|
|
endmodule
|
|
----
|
|
module m;
|
|
always @(*) begin
|
|
// lucisv: off
|
|
x = 1;
|
|
// lucisv: on
|
|
y = 2;
|
|
end
|
|
endmodule
|
|
====
|
|
# a blank line before the off fence survives, collapsed to one
|
|
module m;
|
|
wire z;
|
|
|
|
|
|
|
|
// lucisv: off
|
|
wire a;
|
|
// lucisv: on
|
|
endmodule
|
|
----
|
|
module m;
|
|
wire z;
|
|
|
|
// lucisv: off
|
|
wire a;
|
|
// lucisv: on
|
|
endmodule
|
|
====
|
|
# a region ending the file keeps exactly one final newline
|
|
module m;
|
|
wire a;
|
|
endmodule
|
|
// lucisv: off
|
|
`define WIDTH 8
|
|
----
|
|
module m;
|
|
wire a;
|
|
endmodule
|
|
// lucisv: off
|
|
`define WIDTH 8
|
|
====
|