diff --git a/compiler.h b/compiler.h index b847b6f05..eae1ec460 100644 --- a/compiler.h +++ b/compiler.h @@ -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 diff --git a/driver/main.c b/driver/main.c index a15235a98..0fe8130d1 100644 --- a/driver/main.c +++ b/driver/main.c @@ -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]\n" " [-D macro[=defn]] [-I includedir]\n" " [-M [mode=]depfile] [-m module]\n" @@ -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; @@ -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': @@ -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; @@ -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); diff --git a/elaborate.cc b/elaborate.cc index a4245e67b..82b90fc7d 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -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 @@ -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; + } } diff --git a/main.cc b/main.cc index 366ca150b..e814b7466 100644 --- a/main.cc +++ b/main.cc @@ -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. */ @@ -570,6 +575,9 @@ static bool set_default_timescale(const char*ts_string) * * warnings: * Warning flag letters. + * + * ignore_missing_modules: + * true to ignore errors about missing modules */ bool had_timescale = false; static void read_iconfig_file(const char*ipath) @@ -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);