/usr/bin/vppreproc is in libverilog-perl 3.418-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | #!/usr/bin/perl -w
# See copyright, etc in below POD section.
######################################################################
use FindBin qw($RealBin);
use lib "$RealBin/blib/arch";
use lib "$RealBin/blib/lib";
use lib "$RealBin";
use Getopt::Long;
use IO::File;
use Pod::Usage;
use Verilog::Preproc;
use Verilog::Getopt;
use strict;
use vars qw ($Debug $VERSION);
$VERSION = '3.418';
######################################################################
# main
$Debug = 0;
my $opt_output_filename = undef;
my $opt_blank=1;
my $opt_dump_defines;
my @opt_files;
my @opt_pp_flags;
autoflush STDOUT 1;
autoflush STDERR 1;
# Option parsing
Getopt::Long::config ("no_auto_abbrev","pass_through");
GetOptions ("debug" => \&debug); # Snarf --debug ASAP, before parse -f files
my $Opt = new Verilog::Getopt(filename_expansion=>1);
@ARGV = $Opt->parameter(@ARGV);
Getopt::Long::config ("no_auto_abbrev","no_pass_through");
if (! GetOptions (
"help" => \&usage,
"debug" => \&debug,
"o=s" => \$opt_output_filename,
"blank!" => \$opt_blank,
"comment!" => sub { push @opt_pp_flags, (keep_comments=>$_[1]); },
"dump-defines!" => \$opt_dump_defines,
"line!" => sub { push @opt_pp_flags, (line_directives=>$_[1]); },
"P!" => sub { $opt_blank=0; push @opt_pp_flags, (line_directives=>$_[1]); },
"pedantic!" => sub { push @opt_pp_flags, (pedantic=>$_[1]); },
"simple!" => sub { if ($_[1]) {
push @opt_pp_flags, (keep_comments=>0,
line_directives=>0,
);
$opt_blank=0;
} },
"synthesis!" => sub { push @opt_pp_flags, (synthesis=>$_[1]); },
"version" => sub { print "Version $VERSION\n"; exit(0); },
"<>" => \¶meter,
)) {
die "%Error: Bad usage, try 'vppreproc --help'\n";
}
if (!@opt_files) {
die "%Error: vppreproc: No input filenames specified.\n";
}
my $fh = IO::File->new;
if ($opt_output_filename) {
$fh->open(">$opt_output_filename") or die "%Error: $! $opt_output_filename\n";
} else {
$fh->open(">-") or die;
}
my $vp = Verilog::Preproc->new(@opt_pp_flags,
options=>$Opt,);
$vp->debug($Debug) if $Debug;
foreach my $file (@opt_files) {
$vp->open($file);
# Alternatively, use $vp->getall for better performance
while (defined (my $line = $vp->getline())) {
next if !$opt_blank && $line =~ /^\s*[\n]?$/;
print $fh $line unless $opt_dump_defines;
}
}
if ($opt_dump_defines) {
foreach my $name ($Opt->define_names_sorted) {
my $par = $Opt->defparams($name); $par="" if !$par;
my $value = $Opt->defvalue($name);
printf "`define %s%s %s\n", $name,$par,$value;
}
}
exit (0);
######################################################################
sub usage {
print "Version $VERSION\n";
pod2usage(-verbose=>2, -exitval=>2, -output=>\*STDOUT, -noperldoc=>1);
exit (1);
}
sub debug {
$Debug = 1;
#$Verilog::Getopt::Debug = 1;
}
sub parameter {
my $param = shift;
if ($param =~ /^--?/) {
die "%Error: vppreproc: Unknown parameter: $param\n";
} else {
push @opt_files, "$param"; # Must quote to convert Getopt to string, bug298
}
}
######################################################################
######################################################################
######################################################################
__END__
=pod
=head1 NAME
vppreproc - Preprocess Verilog code using verilog-perl
=head1 SYNOPSIS
vppreproc --help
vppreproc [verilog_options] [-o filename] [verilog_files.v...]
=head1 DESCRIPTION
Vppreproc reads the Verilog files passed on the command line and outputs
preprocessed output to standard out or the filename passed with B<-o>.
Note vppreproc was named vppp until release 3.100, so if you're looking for
vppp, this is the right replacement. The vppp name conflicted with another
non-Verilog related tool.
=head1 VERILOG ARGUMENTS
The following arguments are compatible with GCC, VCS and most Verilog
programs.
=over 4
=item +define+I<var>+I<value>
=item -DI<var>=I<value>
Defines the given preprocessor symbol.
=item -f I<file>
Read the specified file, and act as if all text inside it was
specified as command line parameters.
=item -f I<file>
Read the specified file, and act as if all text inside it was specified as
command line parameters. Any relative paths are relative to the current
directory.
=item +incdir+I<dir>
=item -II<dir>
Add the directory to the list of directories that should be searched
for include directories or libraries.
=item +libext+I<ext>+I<ext>...
Specify the extensions that should be used for finding modules. If for
example module I<x> is referenced, look in I<x>.I<ext>.
=item -y I<dir>
Add the directory to the list of directories that should be searched
for include directories or libraries.
=back
=head1 VPPREPROC ARGUMENTS
=over 4
=item --help
Displays this message and program version and exits.
=item --o I<file>
Use the given filename for output instead of stdout.
=item --dump-defines
Suppress normal output, and instead print a list of all defines existing at
the end of processing the input file.
=item --noblank
Removes empty lines from the output. Should be used with --noline, as if
correct line numbers are needed, blank lines must be preserved for proper
accounting by the program reading the output of vppreproc.
=item --nocomment
Remove comments.
=item --noline
Remove `line directives.
=item -P
Same as --noline --noblank, similar to "GCC -P" behavior.
=item --pedantic
Rigorously obey the Verilog spec. This disables the `error feature, and
may disable other features that are not specified in the approved language
reference manual. Defaults false.
=item --simple
Requests simple output, an alias for --noline, --nocomment and --noblank.
=item --sythesis
Define SYNTHESIS, and ignore text bewteen "ambit", "pragma", "synopsys" or
"synthesis" translate_off and translate_on meta comments. Note using
metacomments is discouraged as they have led to silicon bugs (versus ifdef
SYNTHESIS); see
L<http://www.veripool.org/papers/TenIPEdits_SNUGBos07_paper.pdf>.
=item --version
Displays program version and exits.
=back
=head1 LANGUAGE EXTENSIONS
Vppreproc supports the preprocessing constructs defined in the Verilog 2001
and SystemVerilog 2005 standards.
The following additional constructs may be added to your Verilog code.
=over 4
=item `__FILE__
The __FILE__ define expands to the current filename as a string, like C++'s
__FILE__. This was incorporated into to the 1800-2009 standard (but
supported by Verilog-Perl since 2004!)
=item `__LINE__
The __LINE__ define expands to the current filename as a string, like C++'s
__LINE__. This was incorporated into to the 1800-2009 standard (but
supported by Verilog-Perl since 2004!)
=item `error I<string>
This will report an error when encountered, like C++'s #error.
=back
=head1 DISTRIBUTION
Verilog-Perl is part of the L<http://www.veripool.org/> free Verilog EDA
software tool suite. The latest version is available from CPAN and from
L<http://www.veripool.org/verilog-perl>.
Copyright 2000-2016 by Wilson Snyder. This package 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.
=head1 AUTHORS
Wilson Snyder <wsnyder@wsnyder.org>
=head1 SEE ALSO
L<Verilog-Perl>,
L<Verilog::Getopt>,
L<Verilog::Preproc>
=cut
######################################################################
|