diff --git a/Changes b/Changes index 0758bd808..626a9f11f 100644 --- a/Changes +++ b/Changes @@ -13,6 +13,8 @@ The contributors that suggested a given feature are shown in []. Thanks! **** Suppress REALCVT for whole real numbers. +**** Support split_var in vlt files, #2219. [Marco Widmer] + **** Fix parameter type redeclaring a type, #2195. [hdzhangdoc] **** Fix VCD open with empty filename, #2198. [Julius Baxter] diff --git a/bin/verilator b/bin/verilator index 38f3c01ce..527cba171 100755 --- a/bin/verilator +++ b/bin/verilator @@ -2971,6 +2971,17 @@ behavior. See the test_regress/t/t_dpi_display.v file for an example. Same as /*verilator sformat*/, see L for more information. +=item split_var [-module ""] [-task ""] -var "" + +=item split_var [-module ""] [-function ""] -var "" + +Break the variable into multiple pieces typically to resolve UNOPTFLAT +performance issues. Typically the variables to attach this to are +recommeded by Verilator itself, see UNOPTFLAT. + +Same as /*verilator split_var*/, see L for more +information. + =back @@ -3484,6 +3495,9 @@ requested but cannot occur a SPLITVAR warning is issued. Splitting large arrays may slow donw the Verilation speed, so use this only on variables that require it. +Same as C in configuration files, see L +for more information. + =item /*verilator tag */ Attached after a variable or structure member to indicate opaque (to diff --git a/src/verilog.l b/src/verilog.l index 8cef77774..2674ff260 100644 --- a/src/verilog.l +++ b/src/verilog.l @@ -151,6 +151,7 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5} "public_module" { FL; return yVLT_PUBLIC_MODULE; } "sc_bv" { FL; return yVLT_SC_BV; } "sformat" { FL; return yVLT_SFORMAT; } + "split_var" { FL; return yVLT_SPLIT_VAR; } "tracing_off" { FL; return yVLT_TRACING_OFF; } "tracing_on" { FL; return yVLT_TRACING_ON; } diff --git a/src/verilog.y b/src/verilog.y index 49fc199c1..75a34552b 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -291,6 +291,7 @@ class AstSenTree; %token yVLT_PUBLIC_MODULE "public_module" %token yVLT_SC_BV "sc_bv" %token yVLT_SFORMAT "sformat" +%token yVLT_SPLIT_VAR "split_var" %token yVLT_TRACING_OFF "tracing_off" %token yVLT_TRACING_ON "tracing_on" @@ -5824,6 +5825,7 @@ vltVarAttrFront: | yVLT_PUBLIC_FLAT_RW { $$ = AstAttrType::VAR_PUBLIC_FLAT_RW; v3Global.dpi(true); } | yVLT_SC_BV { $$ = AstAttrType::VAR_SC_BV; } | yVLT_SFORMAT { $$ = AstAttrType::VAR_SFORMAT; } + | yVLT_SPLIT_VAR { $$ = AstAttrType::VAR_SPLIT_VAR; } ; //********************************************************************** diff --git a/test_regress/t/t_split_var_0.pl b/test_regress/t/t_split_var_0.pl index e41d934c1..b401de638 100755 --- a/test_regress/t/t_split_var_0.pl +++ b/test_regress/t/t_split_var_0.pl @@ -14,7 +14,8 @@ scenarios(simulator => 1); # %Warning-UNOPTTHREADS: Thread scheduler is unable to provide requested parallelism; consider asking for fewer threads. # So use 6 threads here though it's not optimal in performace wise, but ok. compile( - verilator_flags2 => ['--stats' . ($Self->{vltmt} ? ' --threads 6' : '')], + verilator_flags2 => ['--stats' . ($Self->{vltmt} ? ' --threads 6' : ''), + "$Self->{t_dir}/t_split_var_0.vlt"], ); execute( diff --git a/test_regress/t/t_split_var_0.v b/test_regress/t/t_split_var_0.v index 1ef428aef..507b5469e 100644 --- a/test_regress/t/t_split_var_0.v +++ b/test_regress/t/t_split_var_0.v @@ -10,7 +10,11 @@ module barshift_1d_unpacked #(parameter DEPTH = 2, localparam WIDTH = 2**DEPTH) (input [WIDTH-1:0] in, input [DEPTH-1:0] shift, output [WIDTH-1:0] out /*verilator split_var*/); localparam OFFSET = -3; +`ifdef TEST_ATTRIBUTES logic [WIDTH-1:0] tmp[DEPTH+OFFSET:OFFSET] /*verilator split_var*/; +`else + logic [WIDTH-1:0] tmp[DEPTH+OFFSET:OFFSET]; +`endif generate for(genvar i = 0; i < DEPTH; ++i) begin always_comb diff --git a/test_regress/t/t_split_var_0.vlt b/test_regress/t/t_split_var_0.vlt new file mode 100644 index 000000000..1f346a112 --- /dev/null +++ b/test_regress/t/t_split_var_0.vlt @@ -0,0 +1,9 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed into the Public Domain, for any use, +// without warranty, 2020 by Marco Widmer. +// SPDX-License-Identifier: CC0-1.0 + +`verilator_config + +split_var -module "barshift_1d_unpacked" -var "tmp" diff --git a/test_regress/t/t_split_var_2_trace.pl b/test_regress/t/t_split_var_2_trace.pl index 821410078..0d815e82b 100755 --- a/test_regress/t/t_split_var_2_trace.pl +++ b/test_regress/t/t_split_var_2_trace.pl @@ -15,7 +15,8 @@ top_filename("t/t_split_var_0.v"); # %Warning-UNOPTTHREADS: Thread scheduler is unable to provide requested parallelism; consider asking for fewer threads. # So use 6 threads here though it's not optimal in performace wise, but ok. compile( - verilator_flags2 => ['--cc --trace --stats' . ($Self->{vltmt} ? ' --threads 6' : '')], + verilator_flags2 => ['--cc --trace --stats' . ($Self->{vltmt} ? ' --threads 6' : ''), + '+define+TEST_ATTRIBUTES'], ); execute(