Support split_var in vit files (#2219)

This commit is contained in:
Marco Widmer 2020-04-03 14:08:23 +02:00 committed by GitHub
parent 305b4f3c75
commit 7f9aa057bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 36 additions and 2 deletions

View File

@ -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]

View File

@ -2971,6 +2971,17 @@ behavior. See the test_regress/t/t_dpi_display.v file for an example.
Same as /*verilator sformat*/, see L</"LANGUAGE EXTENSIONS"> for more
information.
=item split_var [-module "<modulename>"] [-task "<taskname>"] -var "<varname>"
=item split_var [-module "<modulename>"] [-function "<funcname>"] -var "<varname>"
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</"LANGUAGE EXTENSIONS"> 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<split_var> in configuration files, see L</"CONFIGURATION FILES">
for more information.
=item /*verilator tag <text...>*/
Attached after a variable or structure member to indicate opaque (to

View File

@ -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; }

View File

@ -291,6 +291,7 @@ class AstSenTree;
%token<fl> yVLT_PUBLIC_MODULE "public_module"
%token<fl> yVLT_SC_BV "sc_bv"
%token<fl> yVLT_SFORMAT "sformat"
%token<fl> yVLT_SPLIT_VAR "split_var"
%token<fl> yVLT_TRACING_OFF "tracing_off"
%token<fl> yVLT_TRACING_ON "tracing_on"
@ -5824,6 +5825,7 @@ vltVarAttrFront<attrtypeen>:
| 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; }
;
//**********************************************************************

View File

@ -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(

View File

@ -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

View File

@ -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"

View File

@ -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(