Add --language option for supporting older code. [Stefan Thiede]

git-svn-id: file://localhost/svn/verilator/trunk/verilator@1015 77ca24e4-aefa-0310-84f0-b9a241c72d87
This commit is contained in:
Wilson Snyder
2008-03-28 20:41:21 +00:00
parent ebe5711b40
commit 280eb48ba4
7 changed files with 120 additions and 10 deletions
+34 -9
View File
@@ -118,6 +118,20 @@ string V3Options::allArgsString() {
return out;
}
//######################################################################
// Language class
V3LangCode::V3LangCode (const char* textp) {
// Return code for given string, or ERROR, which is a bad code
for (int codei=V3LangCode::ERROR; codei<V3LangCode::MAX; codei++) {
V3LangCode code = (V3LangCode)codei;
if (0==strcasecmp(textp,code.ascii())) {
m_e = code; return;
}
}
m_e = V3LangCode::ERROR;
}
//######################################################################
// File searching
@@ -498,15 +512,6 @@ void V3Options::parseOptsList(FileLine* fl, int argc, char** argv) {
shift;
setDebugMode(atoi(argv[i]));
}
else if ( !strcmp (sw, "-v") ) {
shift;
V3Options::addLibraryFile(argv[i]);
}
else if ( !strcmp (sw, "-version") ) {
cout <<version();
cout <<endl;
exit(0);
}
else if ( !strcmp (sw, "-error-limit") ) {
shift;
m_inlineMult = atoi(argv[i]);
@@ -515,6 +520,15 @@ void V3Options::parseOptsList(FileLine* fl, int argc, char** argv) {
shift;
m_inlineMult = atoi(argv[i]);
}
else if ( !strcmp (sw, "-language") ) {
shift;
V3LangCode optval = V3LangCode(argv[i]);
if (optval.legal()) {
m_language = optval;
} else {
fl->v3fatal("Unknown language specified: "<<argv[i]);
}
}
else if ( !strcmp (sw, "-output-split") ) {
shift;
m_outputSplit = atoi(argv[i]);
@@ -535,6 +549,15 @@ void V3Options::parseOptsList(FileLine* fl, int argc, char** argv) {
shift;
m_unrollStmts = atoi(argv[i]);
}
else if ( !strcmp (sw, "-v") ) {
shift;
V3Options::addLibraryFile(argv[i]);
}
else if ( !strcmp (sw, "-version") ) {
cout <<version();
cout <<endl;
exit(0);
}
// Single switches
else if ( !strcmp (sw, "-E") ) { m_preprocOnly = true; }
else if ( onoff (sw, "-MMD", flag/*ref*/) ) { m_makeDepend = flag; }
@@ -794,6 +817,8 @@ V3Options::V3Options() {
m_flags = "";
m_xAssign = "unique";
m_language = V3LangCode::mostRecent();
optimize(true);
// Default +libext+
addLibExt(""); // So include "filename.v" will find the same file