Every fix makes the AST carry a fact the formatter used to invent or discard: SensSep preserves each event-list separator as written (, stays , / or stays or, mixed lists round-trip); module-header imports keep one statement per import; Instantiation::params and Module::param_ports become Option<Vec> so empty #() survives; and seven distinct comment-motion shapes (closing paren, empty connection, declarator-to-;, after binary operator, case labels, ternary, assign-to-value) keep comments where the source put them, with Fmt::inline_comments as the single comment-run printer. verify.rs is byte-identical: the net was right on all 46 refusing files. Seven new rejection tests pin that judgment (sabotage-checked by QA). Also removes a latent split_off underflow panic (Parser::take_around) that QA reproduced on the pre-fix binary, and fixes the ternary comment refusal from the earlier bug round. Corpus after: 468/820 parse, 0 verification errors, 0 crashes — corpus_check.sh exits 0 for the first time. Exactly 46 files moved verification-error -> would-reformat by path diff; nothing else changed. 111 workspace tests (was 98), case table 237 entries, clippy silent. Dev: Opus agent; QA: Sonnet agent (all claims independently reproduced); review in docs/features/corpus-bugs/README.md. Co-Authored-By: Claude Fable 5 <[email protected]>
197 lines
4.1 KiB
Plaintext
197 lines
4.1 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
|
|
====
|
|
# two header imports stay two statements (never merged into one)
|
|
module prim_alert_rxtx_tb
|
|
import prim_alert_pkg::*;
|
|
import prim_mubi_pkg::mubi4_t;
|
|
(
|
|
input clk_i,
|
|
output logic done_o
|
|
);
|
|
endmodule
|
|
----
|
|
module prim_alert_rxtx_tb
|
|
import prim_alert_pkg::*;
|
|
import prim_mubi_pkg::mubi4_t;
|
|
(input clk_i, output logic done_o);
|
|
endmodule
|
|
====
|
|
# a single header import with several paths keeps its one statement
|
|
module m
|
|
import a::*, b::t;
|
|
(
|
|
input clk_i
|
|
);
|
|
endmodule
|
|
----
|
|
module m
|
|
import a::*, b::t;
|
|
(input clk_i);
|
|
endmodule
|
|
====
|
|
# three header imports before a parameter list
|
|
module m
|
|
import a::*;
|
|
import b::t;
|
|
import c::u;
|
|
#(
|
|
parameter int W = 8
|
|
) (
|
|
input clk_i
|
|
);
|
|
endmodule
|
|
----
|
|
module m
|
|
import a::*;
|
|
import b::t;
|
|
import c::u;
|
|
#(parameter int W = 8) (input clk_i);
|
|
endmodule
|