Fix multiple .v files being read in random order. [Stefan Thiede]

git-svn-id: file://localhost/svn/verilator/trunk/verilator@1026 77ca24e4-aefa-0310-84f0-b9a241c72d87
This commit is contained in:
Wilson Snyder 2008-04-09 14:17:03 +00:00
parent ecdbd72fa1
commit 95395a8b87
4 changed files with 11 additions and 7 deletions

View File

@ -7,6 +7,8 @@ indicates the contributor was also the author of the fix; Thanks!
**** Add error message when modules have duplicate names. [Stefan Thiede] **** Add error message when modules have duplicate names. [Stefan Thiede]
**** Fix multiple .v files being read in random order. [Stefan Thiede]
* Verilator 3.661 2008/04/04 * Verilator 3.661 2008/04/04
*** The --enable-defenv configure option added in 3.660 is now the default. *** The --enable-defenv configure option added in 3.660 is now the default.

View File

@ -101,9 +101,9 @@ void V3Options::addLibraryFile(const string& filename) {
} }
} }
void V3Options::addVFile(const string& filename) { void V3Options::addVFile(const string& filename) {
if (m_vFiles.find(filename) == m_vFiles.end()) { // We use a list for v files, because it's legal to have includes
m_vFiles.insert(filename); // in a specific order and multiple of them.
} m_vFiles.push_back(filename);
} }
void V3Options::addArg(const string& arg) { void V3Options::addArg(const string& arg) {
m_impp->m_allArgs.push_back(arg); m_impp->m_allArgs.push_back(arg);

View File

@ -25,6 +25,7 @@
#include "config_build.h" #include "config_build.h"
#include "verilatedos.h" #include "verilatedos.h"
#include <string> #include <string>
#include <vector>
#include <set> #include <set>
#include "V3Global.h" #include "V3Global.h"
@ -70,6 +71,7 @@ public:
class V3OptionsImp; class V3OptionsImp;
class FileLine; class FileLine;
typedef vector<string> V3StringList;
typedef set<string> V3StringSet; typedef set<string> V3StringSet;
class V3Options { class V3Options {
@ -78,7 +80,7 @@ class V3Options {
V3StringSet m_cppFiles; // argument: C++ files to link against V3StringSet m_cppFiles; // argument: C++ files to link against
V3StringSet m_libraryFiles; // argument: Verilog -v files V3StringSet m_libraryFiles; // argument: Verilog -v files
V3StringSet m_vFiles; // argument: Verilog files to read V3StringList m_vFiles; // argument: Verilog files to read
bool m_preprocOnly; // main switch: -E bool m_preprocOnly; // main switch: -E
bool m_makeDepend; // main switch: -MMD bool m_makeDepend; // main switch: -MMD
@ -217,7 +219,7 @@ class V3Options {
string xAssign() const { return m_xAssign; } string xAssign() const { return m_xAssign; }
const V3StringSet& cppFiles() const { return m_cppFiles; } const V3StringSet& cppFiles() const { return m_cppFiles; }
const V3StringSet& libraryFiles() const { return m_libraryFiles; } const V3StringSet& libraryFiles() const { return m_libraryFiles; }
const V3StringSet& vFiles() const { return m_vFiles; } const V3StringList& vFiles() const { return m_vFiles; }
const V3LangCode& language() const { return m_language; } const V3LangCode& language() const { return m_language; }
// ACCESSORS (optimization options) // ACCESSORS (optimization options)

View File

@ -91,7 +91,7 @@ V3Global v3Global;
void V3Global::readFiles() { void V3Global::readFiles() {
V3Read reader (m_rootp); V3Read reader (m_rootp);
// Read top module // Read top module
for (V3StringSet::iterator it = v3Global.opt.vFiles().begin(); for (V3StringList::const_iterator it = v3Global.opt.vFiles().begin();
it != v3Global.opt.vFiles().end(); ++it) { it != v3Global.opt.vFiles().end(); ++it) {
string filename = *it; string filename = *it;
reader.readFile(new FileLine("CommandLine",0), filename, false); reader.readFile(new FileLine("CommandLine",0), filename, false);
@ -100,7 +100,7 @@ void V3Global::readFiles() {
// Read libraries // Read libraries
// To be compatible with other simulators, // To be compatible with other simulators,
// this needs to be done after the top file is read // this needs to be done after the top file is read
for (V3StringSet::iterator it = v3Global.opt.libraryFiles().begin(); for (V3StringSet::const_iterator it = v3Global.opt.libraryFiles().begin();
it != v3Global.opt.libraryFiles().end(); ++it) { it != v3Global.opt.libraryFiles().end(); ++it) {
string filename = *it; string filename = *it;
reader.readFile(new FileLine("CommandLine",0), filename, true); reader.readFile(new FileLine("CommandLine",0), filename, true);