diff --git a/Changes b/Changes index 4e970017b..164c29498 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,10 @@ Revision history for Verilator The contributors that suggested a given feature are shown in []. [by ...] indicates the contributor was also the author of the fix; Thanks! +* Verilator 3.80*** + +*** Add -F option to read relative option files, bug297. [Neil Hamilton] + * Verilator 3.805 2010/11/02 **** Add warning when directory contains spaces, msg378. [Salman Sheikh] diff --git a/bin/verilator b/bin/verilator index cdecb91b5..96e78107b 100755 --- a/bin/verilator +++ b/bin/verilator @@ -227,6 +227,7 @@ descriptions in the next sections for more information. -E Preprocess, but do not compile --error-limit Abort after this number of errors --exe Link to create executable + -F Parse options from a file, relatively -f Parse options from a file --help Display this help. -I Directory to search for includes @@ -502,10 +503,18 @@ After this number of errors or warnings are encountered, exit. Defaults to Generate a executable. You will also need to pass additional .cpp files on the command line that implement the main loop for your simulation. +=item -F I + +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 directory +containing the specified file. Note -F is fairly standard across Verilog +tools. + =item -f I Read the specified file, and act as if all text inside it was specified as -command line parameters. Note -f is fairly standard across Verilog tools. +command line parameters. Any relative paths are relative to the current +directory. Note -f is fairly standard across Verilog tools. =item --help diff --git a/src/V3Options.cpp b/src/V3Options.cpp index 64f2a3b49..d8f188aa1 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -213,6 +213,10 @@ string V3Options::filenameSubstitute (const string& filename) { return out; } +bool V3Options::filenameIsRel(const string& filename) { + return (filename.length()>0 && filename[0] != '/'); +} + bool V3Options::fileStatDir(const string& filename) { struct stat m_stat; // Stat information int err = stat(filename.c_str(), &m_stat); @@ -520,7 +524,7 @@ string V3Options::argString (int argc, char** argv) { void V3Options::parseOpts (FileLine* fl, int argc, char** argv) { // Parse all options // Inital entry point from Verilator.cpp - parseOptsList (fl, argc, argv); + parseOptsList (fl, ".", argc, argv); // Default certain options and error check // Detailed error, since this is what we often get when run with minimal arguments @@ -556,7 +560,7 @@ bool V3Options::suffixed(const char* sw, const char* arg) { return (0==strcmp(sw+strlen(sw)-strlen(arg), arg)); } -void V3Options::parseOptsList(FileLine* fl, int argc, char** argv) { +void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char** argv) { // Parse parameters // Note argc and argv DO NOT INCLUDE the filename in [0]!!! // May be called recursively when there are -f files. @@ -572,7 +576,7 @@ void V3Options::parseOptsList(FileLine* fl, int argc, char** argv) { addDefine (string (sw+strlen("+define+"))); } else if ( !strncmp (sw, "+incdir+", 8)) { - addIncDir (filenameSubstitute(string (sw+strlen("+incdir+")))); + addIncDir (parseFileArg(optdir, string (sw+strlen("+incdir+")))); } else if ( !strncmp (sw, "+libext+", 8)) { string exts = string(sw+strlen("+libext+")); @@ -694,7 +698,7 @@ void V3Options::parseOptsList(FileLine* fl, int argc, char** argv) { m_errorLimit = atoi(argv[i]); } else if ( !strncmp (sw, "-I", 2)) { - addIncDir (string (sw+strlen("-I"))); + addIncDir (parseFileArg(optdir, string (sw+strlen("-I")))); } else if ( !strcmp (sw, "-inline-mult") && (i+1)v3fatal("Unknown setting for --compiler: "<v3fatal ("Invalid Option: "<