All five briefed bugs fixed, plus a sixth found during the work: 1. Block-comment continuation drift: token::Comment gained line/col; continuation lines are dedented by the comment's original column before re-indenting, making reformatting a true fixed point while preserving the author's relative indentation inside the comment. 2. Comments inside expression groups (concat, parens, call args, assignment patterns, binary operands) now force the group to break instead of being lifted out. 3. Closing block labels preserved for end/join*/endfunction/endtask/ endpackage, matching endmodule. 4. Multi-instance declarations fit on one line when they fit and indent their continuations when they break. 5. @( /* c */ * ) keeps its comments (SensList::Star before/after). 6. Multi-line `define/attribute bodies no longer drift (RawText.col). verify.rs comparison logic untouched (diagnostic positions only) — QA audited the diff to confirm the safety net was not weakened. All four #SKIP cases un-skipped verbatim as spec; 17 cases added (183 -> 200, 0 skipped). QA triple-formatted 204 inputs with zero regressions. Clippy is now fully silent workspace-wide. Remaining comment-placement refusals (4) and a pre-existing @(* ) lexer limitation are documented as open items, not hacked around. Dev: Opus agent; QA: Sonnet agent; review in docs/features/formatter-bug-fixes/README.md. Co-Authored-By: Claude Fable 5 <[email protected]>
149 lines
3.3 KiB
Plaintext
149 lines
3.3 KiB
Plaintext
# empty module, no port list
|
|
module m;endmodule
|
|
----
|
|
module m;
|
|
endmodule
|
|
====
|
|
# empty parenthesized port list
|
|
module m ( ) ;
|
|
endmodule
|
|
----
|
|
module m ();
|
|
endmodule
|
|
====
|
|
# ANSI ports fit on one line
|
|
module m(input a,output b);endmodule
|
|
----
|
|
module m (input a, output b);
|
|
endmodule
|
|
====
|
|
# ANSI ports with directions and types
|
|
module m(input wire clk,input wire rst_n,output logic [7:0] q);endmodule
|
|
----
|
|
module m (input wire clk, input wire rst_n, output logic [7:0] q);
|
|
endmodule
|
|
====
|
|
# non-ANSI header: names in the port list, declarations in the body
|
|
module m(a,b,c);
|
|
input a;
|
|
input [3:0] b;
|
|
output reg c;
|
|
endmodule
|
|
----
|
|
module m (a, b, c);
|
|
input a;
|
|
input [3:0] b;
|
|
output reg c;
|
|
endmodule
|
|
====
|
|
# port list too wide for 100 columns breaks one per line
|
|
module wide_module_name(input wire clock_signal_in,input wire reset_signal_in,input wire [31:0] data_word_in,output wire [31:0] data_word_out);endmodule
|
|
----
|
|
module wide_module_name (
|
|
input wire clock_signal_in,
|
|
input wire reset_signal_in,
|
|
input wire [31:0] data_word_in,
|
|
output wire [31:0] data_word_out
|
|
);
|
|
endmodule
|
|
====
|
|
# parameter port list, single parameter
|
|
module m#(parameter WIDTH=8)(input [WIDTH-1:0] d);endmodule
|
|
----
|
|
module m #(parameter WIDTH = 8) (input [WIDTH-1:0] d);
|
|
endmodule
|
|
====
|
|
# parameter port list with types
|
|
module m #(parameter int WIDTH = 8, parameter type T = logic) (input T d);endmodule
|
|
----
|
|
module m #(parameter int WIDTH = 8, parameter type T = logic) (input T d);
|
|
endmodule
|
|
====
|
|
# parameter port list too wide breaks
|
|
module m #(parameter int DATA_WIDTH_IN_BITS = 32, parameter int ADDRESS_WIDTH_IN_BITS = 24, parameter int NUMBER_OF_BANKS = 4) ();endmodule
|
|
----
|
|
module m #(
|
|
parameter int DATA_WIDTH_IN_BITS = 32,
|
|
parameter int ADDRESS_WIDTH_IN_BITS = 24,
|
|
parameter int NUMBER_OF_BANKS = 4
|
|
) ();
|
|
endmodule
|
|
====
|
|
# localparam-style parameter without the keyword repeated
|
|
module m #(WIDTH = 8, DEPTH = 16) ();endmodule
|
|
----
|
|
module m #(WIDTH = 8, DEPTH = 16) ();
|
|
endmodule
|
|
====
|
|
# inout and multi-name ports
|
|
module m(input a,b,inout wire io,output c);endmodule
|
|
----
|
|
module m (input a, b, inout wire io, output c);
|
|
endmodule
|
|
====
|
|
# unpacked and packed dimensions on ports
|
|
module m(input logic [7:0] mem [0:3], output logic [3:0][7:0] q);endmodule
|
|
----
|
|
module m (input logic [7:0] mem [0:3], output logic [3:0][7:0] q);
|
|
endmodule
|
|
====
|
|
# module with default port values in the parameter list
|
|
module m #(parameter WIDTH = 8) (input [WIDTH-1:0] a, output [WIDTH-1:0] y);
|
|
assign y=a;
|
|
endmodule
|
|
----
|
|
module m #(parameter WIDTH = 8) (input [WIDTH-1:0] a, output [WIDTH-1:0] y);
|
|
assign y = a;
|
|
endmodule
|
|
====
|
|
# two modules separated by blank lines, collapsed to one
|
|
module a;endmodule
|
|
|
|
|
|
|
|
module b;endmodule
|
|
----
|
|
module a;
|
|
endmodule
|
|
|
|
module b;
|
|
endmodule
|
|
====
|
|
# package with a parameter and a typedef
|
|
package pkg;
|
|
parameter int N=4;
|
|
typedef logic [7:0] byte_t;
|
|
endpackage
|
|
----
|
|
package pkg;
|
|
parameter int N = 4;
|
|
typedef logic [7:0] byte_t;
|
|
endpackage
|
|
====
|
|
# import and timeunit inside a module
|
|
module m;
|
|
import pkg::*;
|
|
timeunit 1ns/1ps;
|
|
endmodule
|
|
----
|
|
module m;
|
|
import pkg::*;
|
|
timeunit 1ns / 1ps;
|
|
endmodule
|
|
====
|
|
# module with a lifetime-free body and trailing endmodule label
|
|
module m;
|
|
endmodule : m
|
|
----
|
|
module m;
|
|
endmodule : m
|
|
====
|
|
# closing label on endpackage
|
|
package p;
|
|
localparam int W = 8;
|
|
endpackage : p
|
|
----
|
|
package p;
|
|
localparam int W = 8;
|
|
endpackage : p
|