diff --git a/test_regress/t/t_split_var_0.v b/test_regress/t/t_split_var_0.v index 070ee7569..724a89215 100644 --- a/test_regress/t/t_split_var_0.v +++ b/test_regress/t/t_split_var_0.v @@ -42,6 +42,31 @@ module barshift_1d_unpacked_struct0 #(parameter depth = 2, localparam width = 2* endmodule +module barshift_2d_unpacked #(parameter depth = 2, localparam width = 2**depth) ( + input [width-1:0] in, input [depth-1:0] shift, output [width-1:0]out); + + localparam offset = 1; + localparam n = 3; + reg [width-1:0]tmp[depth+offset:offset][offset:offset+n-1]; /*verilator split_var*/ + generate + for(genvar i = 0; i < depth; ++i) begin + for(genvar j = offset; j < n + offset; ++j) begin + always_comb + if (shift[i]) begin + tmp[i+1+offset][j] = {tmp[i+offset][j][(1 << i)-1:0], tmp[i+offset][j][width-1:(2**i)]}; + end else begin + tmp[i+1+offset][j] = tmp[i+offset][j]; + end + end + end + for(genvar j = offset; j < n + offset; ++j) begin + assign tmp[0 + offset][j] = in; + end + endgenerate + assign out = tmp[depth+offset][offset]; +endmodule + + module barshift_1d_unpacked_struct1 #(parameter depth = 2, localparam width = 2**depth) ( input [width-1:0] in, input [depth-1:0] shift, output [width-1:0]out); @@ -161,7 +186,7 @@ module t(/*AUTOARG*/ clk); input clk; localparam depth = 3; localparam width = 2**depth; - localparam numsub = 7; + localparam numsub = 8; logic [width-1:0] in; logic [width-1:0] out[0:numsub-1]; logic [depth-1:0] shift = 0; @@ -169,11 +194,12 @@ module t(/*AUTOARG*/ clk); // barrel shifter barshift_1d_unpacked #(.depth(depth)) shifter0(.in(in), .out(out[0]), .shift(shift)); barshift_1d_unpacked_struct0 #(.depth(depth)) shifter1(.in(in), .out(out[1]), .shift(shift)); - barshift_1d_unpacked_struct1 #(.depth(depth)) shifter2(.in(in), .out(out[2]), .shift(shift)); - barshift_2d_packed_array #(.depth(depth)) shifter3(.in(in), .out(out[3]), .shift(shift)); - barshift_2d_packed_array_le #(.depth(depth)) shifter4(.in(in), .out(out[4]), .shift(shift)); - barshift_1d_packed_struct shifter5(.in(in), .out(out[5]), .shift(shift)); - barshift_bitslice #(.depth(depth)) shifter6(.in(in), .out(out[6]), .shift(shift)); + barshift_2d_unpacked #(.depth(depth)) shifter2(.in(in), .out(out[2]), .shift(shift)); + barshift_1d_unpacked_struct1 #(.depth(depth)) shifter3(.in(in), .out(out[3]), .shift(shift)); + barshift_2d_packed_array #(.depth(depth)) shifter4(.in(in), .out(out[4]), .shift(shift)); + barshift_2d_packed_array_le #(.depth(depth)) shifter5(.in(in), .out(out[5]), .shift(shift)); + barshift_1d_packed_struct shifter6(.in(in), .out(out[6]), .shift(shift)); + barshift_bitslice #(.depth(depth)) shifter7(.in(in), .out(out[7]), .shift(shift)); assign in = 8'b10001110; /*verilator lint_off LITENDIAN*/ diff --git a/test_regress/t/t_split_var_1_bad.out b/test_regress/t/t_split_var_1_bad.out index d1cc8d070..7d38b33f5 100644 --- a/test_regress/t/t_split_var_1_bad.out +++ b/test_regress/t/t_split_var_1_bad.out @@ -3,31 +3,39 @@ /*verilator split_var*/ ^~~~~~~~~~~~~~~~~~~~~~~ ... Use "/* verilator lint_off SPLITVAR */" and lint_on around source to disable this message. -%Warning-SPLITVAR: t/t_split_var_1_bad.v:30: Variable 'cannot_split' will not be split because index cannot be determined statically. +%Warning-SPLITVAR: t/t_split_var_1_bad.v:31: Variable 'cannot_split' will not be split because index cannot be determined statically. : ... In instance t.i_sub0 rd_data = cannot_split[addr]; ^~~~ -%Warning-SPLITVAR: t/t_split_var_1_bad.v:39: Variable 'cannot_split0' will not be split because the entire unpacked array is referred. Such access is not supported yet. +%Warning-SPLITVAR: t/t_split_var_1_bad.v:41: Variable 'cannot_split0' will not be split because the entire unpacked array is referred. Such access is not supported yet. : ... In instance t.i_sub1 cannot_split1 = cannot_split0; ^~~~~~~~~~~~~ -%Warning-SPLITVAR: t/t_split_var_1_bad.v:39: Variable 'cannot_split1' will not be split because the entire unpacked array is referred. Such access is not supported yet. +%Warning-SPLITVAR: t/t_split_var_1_bad.v:41: Variable 'cannot_split1' will not be split because the entire unpacked array is referred. Such access is not supported yet. : ... In instance t.i_sub1 cannot_split1 = cannot_split0; ^~~~~~~~~~~~~ -%Warning-SPLITVAR: t/t_split_var_1_bad.v:5: Pragma split_var is specified on a variable whose type is not supported. Unpacked dimension must be 1D or none and packed portion must be an aggregate type of bit or logic. +%Warning-SPLITVAR: t/t_split_var_1_bad.v:63: Variable 'cannot_split1' will not be split because slicing an unpacked array is not supported yet. + : ... In instance t.i_sub3 + cannot_split1[0:1] = cannot_split1[2:3]; + ^ +%Warning-SPLITVAR: t/t_split_var_1_bad.v:64: Variable 'cannot_split0' will not be split because the entire unpacked array is referred. Such access is not supported yet. + : ... In instance t.i_sub3 + cannot_split1 = cannot_split0; + ^~~~~~~~~~~~~ +%Warning-SPLITVAR: t/t_split_var_1_bad.v:5: Pragma split_var is specified on a variable whose type is not supported. Packed portion must be an aggregate type of bit or logic. : ... In instance t real should_show_warning0; /*verilator split_var*/ ^~~~~~~~~~~~~~~~~~~~~~~ -%Warning-SPLITVAR: t/t_split_var_1_bad.v:6: Pragma split_var is specified on a variable whose type is not supported. Unpacked dimension must be 1D or none and packed portion must be an aggregate type of bit or logic. +%Warning-SPLITVAR: t/t_split_var_1_bad.v:6: Pragma split_var is specified on a variable whose type is not supported. Packed portion must be an aggregate type of bit or logic. : ... In instance t string should_show_warning1[0:2]; /*verilator split_var*/ ^~~~~~~~~~~~~~~~~~~~ -%Warning-SPLITVAR: t/t_split_var_1_bad.v:7: Pragma split_var is specified on a variable whose type is not supported. Unpacked dimension must be 1D or none and packed portion must be an aggregate type of bit or logic. +%Warning-SPLITVAR: t/t_split_var_1_bad.v:7: Pragma split_var is specified on a variable whose type is not supported. Packed portion must be an aggregate type of bit or logic. : ... In instance t - wire [7:0]should_show_warning2[0:1][0:3]; /*verilator split_var*/ + wire should_show_warning2; /*verilator split_var*/ ^~~~~~~~~~~~~~~~~~~~~~~ -%Warning-SPLITVAR: t/t_split_var_1_bad.v:50: Variable 'cannot_split' will not be split because bit range cannot be determined statically. +%Warning-SPLITVAR: t/t_split_var_1_bad.v:52: Variable 'cannot_split' will not be split because bit range cannot be determined statically. : ... In instance t.i_sub2 rd_data = cannot_split[addr]; ^ diff --git a/test_regress/t/t_split_var_1_bad.v b/test_regress/t/t_split_var_1_bad.v index 4ae4fdef0..9bb4b5d1f 100644 --- a/test_regress/t/t_split_var_1_bad.v +++ b/test_regress/t/t_split_var_1_bad.v @@ -4,7 +4,7 @@ module t(); // The following variables can not be splitted. will see warnings. real should_show_warning0; /*verilator split_var*/ string should_show_warning1[0:2]; /*verilator split_var*/ - wire [7:0]should_show_warning2[0:1][0:3]; /*verilator split_var*/ + wire should_show_warning2; /*verilator split_var*/ logic [3:0] addr; logic [7:0] rd_data0, rd_data1, rd_data2; @@ -12,6 +12,7 @@ module t(); sub0 i_sub0(.addr(addr), .rd_data(rd_data0)); sub1 i_sub1( .rd_data(rd_data1)); sub2 i_sub2(.addr(addr), .rd_data(rd_data2)); + sub3 i_sub3(); initial begin @@ -31,6 +32,7 @@ module sub0(input [3:0]addr, output logic [7:0] rd_data); endmodule + module sub1(output logic [7:0] rd_data); logic [7:0] cannot_split0[0:15]; /*verilator split_var*/ @@ -50,3 +52,17 @@ module sub2(input [3:0]addr, output logic [7:0] rd_data); rd_data = cannot_split[addr]; endmodule + + +module sub3(); + + logic cannot_split0 [15:0] [7:0] ; /*verilator split_var*/ + logic cannot_split1 [0:15] [7:0] ; /*verilator split_var*/ + /* verilator lint_off ALWCOMBORDER */ + always_comb begin + cannot_split1[0:1] = cannot_split1[2:3]; + cannot_split1 = cannot_split0; + end + /* verilator lint_on ALWCOMBORDER */ + +endmodule