mirror of
https://github.com/verilator/verilator.git
synced 2024-12-29 10:47:34 +00:00
Commentary; Tests: Check summary options match guide options
This commit is contained in:
parent
771cb5f60b
commit
c8a40e0b52
@ -307,7 +307,6 @@ detailed descriptions of these arguments.
|
||||
--build-dep-bin <filename> Override build dependency Verilator binary
|
||||
--build-jobs <jobs> Parallelism for --build
|
||||
--cc Create C++ output
|
||||
--cdc Clock domain crossing analysis
|
||||
-CFLAGS <flags> C++ compiler arguments for makefile
|
||||
--clk <signal-name> Mark specified signal as clock
|
||||
--no-clk <signal-name> Prevent marking specified signal as clock
|
||||
@ -334,6 +333,7 @@ detailed descriptions of these arguments.
|
||||
--dump-graph Enable dumping V3Graphs to .dot files
|
||||
--dump-tree Enable dumping Ast .tree files
|
||||
--dump-tree-addrids Use short identifiers instead of addresses
|
||||
--dump-tree-dot Enable dumping Ast .tree.dot debug files
|
||||
--dump-<srcfile> Enable dumping everything in source file
|
||||
--dumpi-dfg <level> Enable dumping DfgGraphs to .dot files at level
|
||||
--dumpi-graph <level> Enable dumping V3Graphs to .dot files at level
|
||||
@ -347,6 +347,8 @@ detailed descriptions of these arguments.
|
||||
-f <file> Parse arguments from a file
|
||||
-FI <file> Force include of a file
|
||||
--flatten Force inlining of all modules, tasks and functions
|
||||
--future0 <option> Ignore an option for compatibility
|
||||
--future1 <option> Ignore an option with argument for compatibility
|
||||
-fno-<optimization> Disable internal optimization stage
|
||||
-G<name>=<value> Overwrite top-level parameter
|
||||
--gate-stmts <value> Tune gate optimizer depth
|
||||
@ -383,7 +385,6 @@ detailed descriptions of these arguments.
|
||||
-O3 High-performance optimizations
|
||||
-O<optimization-letter> Selectable optimizations
|
||||
-o <executable> Name of final executable
|
||||
--no-order-clock-delay Disable ordering clock enable assignments
|
||||
--output-split <statements> Split .cpp files into pieces
|
||||
--output-split-cfuncs <statements> Split model functions
|
||||
--output-split-ctrace <statements> Split tracing functions
|
||||
@ -404,7 +405,8 @@ detailed descriptions of these arguments.
|
||||
--protect-ids Hash identifier names for obscurity
|
||||
--protect-key <key> Key for symbol protection
|
||||
--protect-lib <name> Create a DPI protected library
|
||||
--public Debugging; see docs
|
||||
--public Mark signals as public; see docs
|
||||
--public-depth <level> Mark public to specified module depth
|
||||
--public-params Mark all parameters as public_flat
|
||||
--public-flat-rw Mark all variables, etc as public_flat_rw
|
||||
-pvalue+<name>=<value> Overwrite toplevel parameter
|
||||
@ -484,6 +486,7 @@ description of these arguments.
|
||||
|
||||
+verilator+debug Enable debugging
|
||||
+verilator+debugi+<value> Enable debugging at a level
|
||||
+verilator+coverage+file+<filename> Set coverage output filename
|
||||
+verilator+error+limit+<value> Set error limit
|
||||
+verilator+help Display help
|
||||
+verilator+noassert Disable assert checking
|
||||
|
@ -177,12 +177,12 @@ L<https://verilator.org/guide/latest/exe_verilator_coverage.html>.
|
||||
--write <filename> Write aggregate coverage results.
|
||||
--write-info <filename.info> Write lcov .info.
|
||||
|
||||
+libext+I<ext>+I<ext>... Extensions for Verilog files.
|
||||
+define+I<var>+I<value> Defines the given variable.
|
||||
-DI<var>=I<value> Defines the given variable.
|
||||
+incdir+I<dir> Add directory for finding include files.
|
||||
-II<dir> Add directory for finding include files.
|
||||
-y I<dir> Specifies module search directory.
|
||||
+libext+<ext>+<ext>... Extensions for Verilog files.
|
||||
+define+<var>+<value> Defines the given variable.
|
||||
-D<var>=<value> Defines the given variable.
|
||||
+incdir+<dir> Add directory for finding include files.
|
||||
-I<dir> Add directory for finding include files.
|
||||
-y <dir> Specifies module search directory.
|
||||
|
||||
=head1 DISTRIBUTION
|
||||
|
||||
|
119
test_regress/t/t_dist_docs_summary.pl
Executable file
119
test_regress/t/t_dist_docs_summary.pl
Executable file
@ -0,0 +1,119 @@
|
||||
#!/usr/bin/env perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Primitive C++ style checker
|
||||
#
|
||||
# Copyright 2022 by Wilson Snyder. This program is free software; you
|
||||
# can redistribute it and/or modify it under the terms of either the GNU
|
||||
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||
# Version 2.0.
|
||||
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
||||
|
||||
scenarios(dist => 1);
|
||||
|
||||
my $root = "..";
|
||||
|
||||
my @Waivers =
|
||||
(
|
||||
'+verilator+prof+threads+file+', # Deprecated
|
||||
'+verilator+prof+threads+start+', # Deprecated
|
||||
'+verilator+prof+threads+window+', # Deprecated
|
||||
'-fno-', # Documented differently
|
||||
'-no-lineno', # Deprecated
|
||||
'-no-order-clock-delay', # Deprecated
|
||||
'-prof-threads', # Deprecated
|
||||
);
|
||||
|
||||
my %sums = %{get_summary_opts($root)};
|
||||
my %docs = %{get_docs_opts($root)};
|
||||
|
||||
my %both = (%sums, %docs);
|
||||
my %waiver = map { $_ => 1; } @Waivers;
|
||||
foreach my $opt (sort keys %both) {
|
||||
next if $waiver{$opt};
|
||||
my $sum_ok = 0;
|
||||
my $docs_ok = 0;
|
||||
for my $alt (alt_names($opt)) {
|
||||
$sum_ok = 1 if $sums{$alt};
|
||||
print "$sum_ok SAC '$opt' -> '$alt'\n" if $Self->{verbose};
|
||||
}
|
||||
$sum_ok = 1 if $opt =~ /-fno-/; # Minimal-documented optimization option
|
||||
for my $alt (alt_names($opt)) {
|
||||
$docs_ok = 1 if $docs{$alt};
|
||||
print "$sum_ok DAC '$opt' -> '$alt'\n" if $Self->{verbose};
|
||||
}
|
||||
if (!$sum_ok) {
|
||||
error($docs{$opt}.": Option documented in docs/guide '$opt'"
|
||||
." not found in bin/* ARGUMENT SUMMARY documentation");
|
||||
} elsif (!$docs_ok) {
|
||||
error($sums{$opt}.": Option documented in bin/ ARGUMENT SUMMARY '$opt'"
|
||||
." not found in docs/guide documentation");
|
||||
} else {
|
||||
print($docs{$opt}.": ok '$opt'\n") if $Self->{verbose};
|
||||
}
|
||||
}
|
||||
|
||||
ok(1);
|
||||
1;
|
||||
|
||||
sub get_summary_opts {
|
||||
my $root = shift;
|
||||
my %args = ();
|
||||
foreach my $file (glob "$root/bin/*") {
|
||||
my $fc = file_contents($file);
|
||||
my $on = 0;
|
||||
my $lineno = 0;
|
||||
foreach my $line (split(/\n/, $fc)) {
|
||||
++$lineno;
|
||||
if ($line =~ /ARGUMENT SUMMARY/) {
|
||||
$on = 1;
|
||||
} elsif ($line =~ /=head1/) {
|
||||
$on = 0;
|
||||
} elsif ($on && $line =~ /^\s+([---+]+[^ ]+)/) {
|
||||
my $opt = opt_clean($1);
|
||||
print "S '$opt' $line\n" if $Self->{verbose};
|
||||
$args{$opt} = "$file:$lineno";
|
||||
} elsif ($line =~ /parser.add_argument\('([---+][^']+)'/) {
|
||||
my $opt = opt_clean($1);
|
||||
print "S '$opt' $line\n" if $Self->{verbose};
|
||||
$args{$opt} = "$file:$lineno";
|
||||
}
|
||||
}
|
||||
}
|
||||
return \%args;
|
||||
}
|
||||
|
||||
sub get_docs_opts {
|
||||
my $root = shift;
|
||||
my %args = ();
|
||||
foreach my $file (glob "$root/docs/guide/*.rst") {
|
||||
my $fc = file_contents($file);
|
||||
my $lineno = 0;
|
||||
foreach my $line (split(/\n/, $fc)) {
|
||||
++$lineno;
|
||||
if ($line =~ /option:: ([---+]+[^ `]+)/
|
||||
|| $line =~ /:vlopt:`[^`]+ <([^>]+)>/
|
||||
|| $line =~ /:vlopt:`([---+]+[^ `]+)/) {
|
||||
my $opt = opt_clean($1);
|
||||
print "D '$opt' $line\n" if $Self->{verbose};
|
||||
$args{$opt} = "$file:$lineno";
|
||||
}
|
||||
}
|
||||
}
|
||||
return \%args;
|
||||
}
|
||||
|
||||
sub opt_clean {
|
||||
my $opt = shift;
|
||||
$opt =~ s/--/-/;
|
||||
$opt =~ s/<.*//;
|
||||
$opt =~ s/\\//;
|
||||
return $opt;
|
||||
}
|
||||
|
||||
sub alt_names {
|
||||
my $opt = shift;
|
||||
my @opts = ($opt);
|
||||
push @opts, "-no".$opt if $opt =~ /^-/;
|
||||
push @opts, $1 if $opt =~ /^-no(-.*)/;
|
||||
return @opts;
|
||||
}
|
Loading…
Reference in New Issue
Block a user