.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Getopt 3pm" .TH Getopt 3pm 2024-03-07 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Verilog::Getopt \- Get Verilog command line options .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Verilog::Getopt; \& \& my $opt = new Verilog::Getopt; \& $opt\->parameter (qw( +incdir+standard_include_directory )); \& \& @ARGV = $opt\->parameter(@ARGV); \& ... \& print "Path to foo.v is ", $opt\->file_path(\*(Aqfoo.v\*(Aq); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Verilog::Getopt provides standardized handling of options similar to Verilog/VCS and cc/GCC. .SH OPTIONS .IX Header "OPTIONS" The \fBnew()\fR constructor accepts the following options: .IP filename_expansion=>1 4 .IX Item "filename_expansion=>1" Enable converting filenames to relative filenames when possible. This option is needed when the \-F option will be used. If flags are passed through Getopt which should otherwise not be expanded (e.g. "\-\-out myfile.v") having this option set may undesirably expand myfile.v to an absolute filename. .IP gcc_style=>0 4 .IX Item "gcc_style=>0" Disable parsing of GCC-like parameters. .IP vcs_style=>0 4 .IX Item "vcs_style=>0" Disable parsing of VCS-like parameters. .SH METHODS .IX Header "METHODS" .ie n .IP "$opt = Verilog::Getopt\->new ( \fIopts\fR )" 4 .el .IP "\f(CW$opt\fR = Verilog::Getopt\->new ( \fIopts\fR )" 4 .IX Item "$opt = Verilog::Getopt->new ( opts )" Create a new Getopt. See OPTIONS above. .ie n .IP "$self\->file_path(\fIfilename\fR, [\fIlookup_type\fR])" 4 .el .IP "\f(CW$self\fR\->file_path(\fIfilename\fR, [\fIlookup_type\fR])" 4 .IX Item "$self->file_path(filename, [lookup_type])" Returns a new path to the filename, using the library directories and search paths to resolve the file. Optional lookup_type is 'module', \&'include', or 'all', to use only module_dirs, incdirs, or both for the lookup. .ie n .IP $self\->\fBget_parameters()\fR 4 .el .IP \f(CW$self\fR\->\fBget_parameters()\fR 4 .IX Item "$self->get_parameters()" Returns a list of parameters that when passed through \f(CW$self\fR\->\fBparameter()\fR should result in the same state. Often this is used to form command lines for downstream programs that also use Verilog::Getopt. .ie n .IP $self\->parameter(\e@params) 4 .el .IP \f(CW$self\fR\->parameter(\e@params) 4 .IX Item "$self->parameter(@params)" Parses any recognized parameters in the referenced array, removing the standard parameters from any previous \fBparameters()\fR call, and returning a array with all unparsed parameters. .Sp The below list shows the VCS-like parameters that are supported, and the functions that are called: .Sp .Vb 10 \& +libext+I+I... libext (I) \& +incdir+I incdir (I) \& +define+I=I define (I,I) \& +define+I define (I,undef) \& +librescan Ignored \& \-F I Parse parameters in file relatively \& \-f I Parse parameters in file \& \-v I library (I) \& \-y I module_dir (I) \& all others Put in returned list .Ve .Sp The below list shows the GCC-like parameters that are supported, and the functions that are called: .Sp .Vb 7 \& \-DI=I define (I,I) \& \-DI define (I,undef) \& \-UI undefine (I) \& \-II incdir (I) \& \-F I Parse parameters in file relatively \& \-f I Parse parameters in file \& all others Put in returned list .Ve .ie n .IP $self\->write_parameters_file(\fIfilename\fR) 4 .el .IP \f(CW$self\fR\->write_parameters_file(\fIfilename\fR) 4 .IX Item "$self->write_parameters_file(filename)" Write the output from get_parameters to the specified file. .SH ACCESSORS .IX Header "ACCESSORS" .ie n .IP "$self\->define($token, $value)" 4 .el .IP "\f(CW$self\fR\->define($token, \f(CW$value\fR)" 4 .IX Item "$self->define($token, $value)" This method is called when a define is recognized. The default behavior loads a hash that is used to fulfill define references. This function may also be called outside parsing to predefine values. .Sp An optional third argument specifies parameters to the define, and a fourth argument if true indicates the define was set on the command line and should not be removed by `undefineall. .ie n .IP $self\->define_names_sorted 4 .el .IP \f(CW$self\fR\->define_names_sorted 4 .IX Item "$self->define_names_sorted" Return sorted list of all define names that currently exist. .ie n .IP $self\->defparams($token) 4 .el .IP \f(CW$self\fR\->defparams($token) 4 .IX Item "$self->defparams($token)" This method returns the parameter list of the define. This will be defined, but false, if the define does not have arguments. .ie n .IP $self\->defvalue($token) 4 .el .IP \f(CW$self\fR\->defvalue($token) 4 .IX Item "$self->defvalue($token)" This method returns the value of a given define, or prints a warning. .ie n .IP $self\->defvalue_nowarn($token) 4 .el .IP \f(CW$self\fR\->defvalue_nowarn($token) 4 .IX Item "$self->defvalue_nowarn($token)" This method returns the value of a given define, or undef. .ie n .IP $self\->\fBdepend_files()\fR 4 .el .IP \f(CW$self\fR\->\fBdepend_files()\fR 4 .IX Item "$self->depend_files()" Returns reference to list of filenames referenced with file_path, useful for creating dependency lists. With argument, adds that file. With list reference argument, sets the list to the argument. .ie n .IP $self\->file_abs($filename) 4 .el .IP \f(CW$self\fR\->file_abs($filename) 4 .IX Item "$self->file_abs($filename)" Using the incdir and libext lists, convert the specified module or filename ("foo") to a absolute filename ("include/dir/foo.v"). .ie n .IP $self\->file_skip_special($filename) 4 .el .IP \f(CW$self\fR\->file_skip_special($filename) 4 .IX Item "$self->file_skip_special($filename)" Return true if the filename is one that generally should be ignored when recursing directories, such as for example, ".", "CVS", and ".svn". .ie n .IP $self\->file_substitute($filename) 4 .el .IP \f(CW$self\fR\->file_substitute($filename) 4 .IX Item "$self->file_substitute($filename)" Removes existing environment variables from the provided filename. Any undefined variables are not substituted nor cause errors. .ie n .IP $self\->incdir 4 .el .IP \f(CW$self\fR\->incdir 4 .IX Item "$self->incdir" Returns reference to list of include directories. With argument, adds that directory. .ie n .IP $self\->includes 4 .el .IP \f(CW$self\fR\->includes 4 .IX Item "$self->includes" Returns reference to hash of files that included some file, and for each hash value a list of files included. Only relevant after Verilog::Netlist processing. With two arguments, adds an include for the given referencing filename to the given include filename. .ie n .IP $self\->libext 4 .el .IP \f(CW$self\fR\->libext 4 .IX Item "$self->libext" Returns reference to list of library extensions. With argument, adds that extension. .ie n .IP $self\->libext_matches(\fIfilename\fR) 4 .el .IP \f(CW$self\fR\->libext_matches(\fIfilename\fR) 4 .IX Item "$self->libext_matches(filename)" Returns true if the passed filename matches the libext. .ie n .IP $self\->library 4 .el .IP \f(CW$self\fR\->library 4 .IX Item "$self->library" Returns reference to list of libraries. With argument, adds that library. .ie n .IP $self\->module_dir 4 .el .IP \f(CW$self\fR\->module_dir 4 .IX Item "$self->module_dir" Returns reference to list of module directories. With argument, adds that directory. .ie n .IP $self\->remove_defines($token) 4 .el .IP \f(CW$self\fR\->remove_defines($token) 4 .IX Item "$self->remove_defines($token)" Return string with any definitions in the token removed. .ie n .IP $self\->undef($token) 4 .el .IP \f(CW$self\fR\->undef($token) 4 .IX Item "$self->undef($token)" Deletes a hash element that is used to fulfill define references. This function may also be called outside parsing to erase a predefined value. .ie n .IP $self\->undefineall 4 .el .IP \f(CW$self\fR\->undefineall 4 .IX Item "$self->undefineall" Deletes all non-command line definitions, for implementing `undefineall. .SH DISTRIBUTION .IX Header "DISTRIBUTION" Verilog-Perl is part of the free Verilog EDA software tool suite. The latest version is available from CPAN and from . .PP Copyright 2000\-2024 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. .SH AUTHORS .IX Header "AUTHORS" Wilson Snyder .SH "SEE ALSO" .IX Header "SEE ALSO" Verilog-Perl, Verilog::Language