Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an option for ignoring errors about missing modules #151

Merged
merged 1 commit into from
Mar 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ extern bool debug_emit;
extern bool debug_synth2;
extern bool debug_optimizer;

/* Ignore errors about missing modules */
extern bool ignore_missing_modules;

/* Control evaluation of functions at compile time:
* 0 = only for functions in constant expressions
* 1 = only for automatic functions
Expand Down
12 changes: 10 additions & 2 deletions driver/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const char NOTICE[] =
;

const char HELP[] =
"Usage: iverilog [-ESvV] [-B base] [-c cmdfile|-f cmdfile]\n"
"Usage: iverilog [-EiSvV] [-B base] [-c cmdfile|-f cmdfile]\n"
" [-g1995|-g2001|-g2005|-g2005-sv|-g2009|-g2012] [-g<feature>]\n"
" [-D macro[=defn]] [-I includedir]\n"
" [-M [mode=]depfile] [-m module]\n"
Expand Down Expand Up @@ -140,6 +140,9 @@ int gen_relative_include = 0;

char warning_flags[16] = "n";

/* Boolean: true means ignore errors about missing modules */
int ignore_missing_modules = 0;

unsigned integer_width = 32;

unsigned width_cap = 65536;
Expand Down Expand Up @@ -987,7 +990,7 @@ int main(int argc, char **argv)
}
}

while ((opt = getopt(argc, argv, "B:c:D:d:Ef:g:hl:I:M:m:N:o:P:p:Ss:T:t:vVW:y:Y:")) != EOF) {
while ((opt = getopt(argc, argv, "B:c:D:d:Ef:g:hl:I:iM:m:N:o:P:p:Ss:T:t:vVW:y:Y:")) != EOF) {

switch (opt) {
case 'B':
Expand Down Expand Up @@ -1042,6 +1045,10 @@ int main(int argc, char **argv)
process_include_dir(optarg);
break;

case 'i':
ignore_missing_modules = 1;
break;

case 'l':
process_file_name(optarg, 1);
break;
Expand Down Expand Up @@ -1184,6 +1191,7 @@ int main(int argc, char **argv)
fprintf(iconfig_file, "generation:%s\n", gen_verilog_ams);
fprintf(iconfig_file, "generation:%s\n", gen_icarus);
fprintf(iconfig_file, "warnings:%s\n", warning_flags);
fprintf(iconfig_file, "ignore_missing_modules:%s\n", ignore_missing_modules ? "true" : "false");
fprintf(iconfig_file, "out:%s\n", opath);
if (depfile) {
fprintf(iconfig_file, "depfile:%s\n", depfile);
Expand Down
14 changes: 9 additions & 5 deletions elaborate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2204,8 +2204,10 @@ void PGModule::elaborate(Design*des, NetScope*scope) const
return;
}

cerr << get_fileline() << ": internal error: Unknown module type: " <<
type_ << endl;
if (!ignore_missing_modules) {
cerr << get_fileline() << ": internal error: Unknown module type: " <<
type_ << endl;
}
}

void PGModule::elaborate_scope(Design*des, NetScope*sc) const
Expand Down Expand Up @@ -2249,9 +2251,11 @@ void PGModule::elaborate_scope(Design*des, NetScope*sc) const

// Not a module or primitive that I know about or can find by
// any means, so give up.
cerr << get_fileline() << ": error: Unknown module type: " << type_ << endl;
missing_modules[type_] += 1;
des->errors += 1;
if (!ignore_missing_modules) {
cerr << get_fileline() << ": error: Unknown module type: " << type_ << endl;
missing_modules[type_] += 1;
des->errors += 1;
}
}


Expand Down
12 changes: 12 additions & 0 deletions main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ bool warn_sens_entire_arr = false;
bool warn_anachronisms = false;
bool warn_floating_nets = false;

/*
* Ignore errors about missing modules
*/
bool ignore_missing_modules = false;

/*
* Debug message class flags.
*/
Expand Down Expand Up @@ -570,6 +575,9 @@ static bool set_default_timescale(const char*ts_string)
*
* warnings:<string>
* Warning flag letters.
*
* ignore_missing_modules:<bool>
* true to ignore errors about missing modules
*/
bool had_timescale = false;
static void read_iconfig_file(const char*ipath)
Expand Down Expand Up @@ -720,6 +728,10 @@ static void read_iconfig_file(const char*ipath)
break;
}

} else if (strcmp(buf, "ignore_missing_modules") == 0) {
if (strcmp(cp, "true") == 0)
ignore_missing_modules = true;

} else if (strcmp(buf, "-y") == 0) {
build_library_index(cp, CASE_SENSITIVE);

Expand Down