diff --git a/Module.cc b/Module.cc index ef0d383580..a5bd756d01 100644 --- a/Module.cc +++ b/Module.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: Module.cc,v 1.25 2004/10/04 01:10:51 steve Exp $" +#ident "$Id: Module.cc,v 1.26 2007/04/19 02:52:53 steve Exp $" #endif # include "config.h" @@ -31,6 +31,7 @@ Module::Module(perm_string n) : name_(n) { + library_flag = false; default_nettype = NetNet::NONE; } @@ -150,6 +151,9 @@ const list& Module::get_behaviors() const /* * $Log: Module.cc,v $ + * Revision 1.26 2007/04/19 02:52:53 steve + * Add support for -v flag in command file. + * * Revision 1.25 2004/10/04 01:10:51 steve * Clean up spurious trailing white space. * diff --git a/Module.h b/Module.h index 4a80775235..5aa125bfbd 100644 --- a/Module.h +++ b/Module.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: Module.h,v 1.41 2006/09/23 04:57:19 steve Exp $" +#ident "$Id: Module.h,v 1.42 2007/04/19 02:52:53 steve Exp $" #endif # include @@ -68,6 +68,12 @@ class Module : public LineInfo { explicit Module(perm_string name); ~Module(); + /* Initially false. This is set to true if the module has been + declared as a library module. This makes the module + ineligible for being chosen as an implicit root. It has no + other effect. */ + bool library_flag; + NetNet::Type default_nettype; /* The module has parameters that are evaluated when the @@ -176,6 +182,9 @@ class Module : public LineInfo { /* * $Log: Module.h,v $ + * Revision 1.42 2007/04/19 02:52:53 steve + * Add support for -v flag in command file. + * * Revision 1.41 2006/09/23 04:57:19 steve * Basic support for specify timing. * diff --git a/compiler.h b/compiler.h index f39b8836ba..6a1cb9f021 100644 --- a/compiler.h +++ b/compiler.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: compiler.h,v 1.32 2007/03/07 04:24:59 steve Exp $" +#ident "$Id: compiler.h,v 1.33 2007/04/19 02:52:53 steve Exp $" #endif # include @@ -117,13 +117,20 @@ extern char*ivlpp_string; extern map missing_modules; + /* Files that are library files are in this map. The lexor compares + file names as it processes `line directives, and if the file name + matches an entry in this table, it will turn on the + library_active_flag so that modules know that they are in a + library. */ +extern map library_file_map; + /* * the lex_strings are perm_strings made up of tokens from the source * file. Identifiers are so likely to be used many times that it makes * much sense to use a StringHeapLex to hold them. */ extern StringHeapLex lex_strings; - +extern StringHeap misc_strings; /* * system task/function listings. @@ -145,6 +152,9 @@ extern int load_sys_func_table(const char*path); /* * $Log: compiler.h,v $ + * Revision 1.33 2007/04/19 02:52:53 steve + * Add support for -v flag in command file. + * * Revision 1.32 2007/03/07 04:24:59 steve * Make integer width controllable. * diff --git a/driver/cfparse.y b/driver/cfparse.y index 69773c7419..f957e319a8 100644 --- a/driver/cfparse.y +++ b/driver/cfparse.y @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: cfparse.y,v 1.11 2007/03/07 04:24:59 steve Exp $" +#ident "$Id: cfparse.y,v 1.12 2007/04/19 02:52:53 steve Exp $" #endif @@ -84,7 +84,7 @@ item : TOK_STRING { char*tmp = substitutions($1); translate_file_name(tmp); - process_file_name(tmp); + process_file_name(tmp, 0); free($1); free(tmp); } @@ -99,9 +99,7 @@ item | TOK_Dv TOK_STRING { char*tmp = substitutions($2); translate_file_name(tmp); - process_file_name(tmp); - fprintf(stderr, "%s:%u: Ignoring -v in front of %s\n", - @1.text, @1.first_line, $2); + process_file_name(tmp, 1); free($2); free(tmp); } diff --git a/driver/globals.h b/driver/globals.h index e210643ab8..1f7343193b 100644 --- a/driver/globals.h +++ b/driver/globals.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: globals.h,v 1.20 2007/03/07 04:24:59 steve Exp $" +#ident "$Id: globals.h,v 1.21 2007/04/19 02:52:53 steve Exp $" #endif # include @@ -56,7 +56,7 @@ extern unsigned integer_width; extern char* substitutions(const char*str); /* Add the name to the list of source files. */ -extern void process_file_name(const char*name); +extern void process_file_name(const char*name, int lib_flag); /* Add the name to the list of library directories. */ extern void process_library_switch(const char*name); @@ -80,6 +80,9 @@ extern char* library_flags2; /* * $Log: globals.h,v $ + * Revision 1.21 2007/04/19 02:52:53 steve + * Add support for -v flag in command file. + * * Revision 1.20 2007/03/07 04:24:59 steve * Make integer width controllable. * diff --git a/driver/main.c b/driver/main.c index ec1a9eaf66..a15d3487b6 100644 --- a/driver/main.c +++ b/driver/main.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: main.c,v 1.74 2007/04/18 03:23:38 steve Exp $" +#ident "$Id: main.c,v 1.75 2007/04/19 02:52:53 steve Exp $" #endif # include "config.h" @@ -403,7 +403,7 @@ void process_define(const char*name) * .sft suffix, and if so pass that as a sys_func file. Otherwise, it * is a Verilog source file to be written into the file list. */ -void process_file_name(const char*name) +void process_file_name(const char*name, int lib_flag) { if (strlen(name) > 4 && strcasecmp(".sft", name+strlen(name)-4) == 0) { fprintf(iconfig_file,"sys_func:%s\n", name); @@ -411,6 +411,8 @@ void process_file_name(const char*name) } else { fprintf(source_file, "%s\n", name); source_count += 1; + if (lib_flag) + fprintf(iconfig_file,"library_file:%s\n", name); } } @@ -707,7 +709,7 @@ int main(int argc, char **argv) /* Finally, process all the remaining words on the command line as file names. */ for (idx = optind ; idx < argc ; idx += 1) - process_file_name(argv[idx]); + process_file_name(argv[idx], 0); fclose(source_file); @@ -785,6 +787,9 @@ int main(int argc, char **argv) /* * $Log: main.c,v $ + * Revision 1.75 2007/04/19 02:52:53 steve + * Add support for -v flag in command file. + * * Revision 1.74 2007/04/18 03:23:38 steve * Add support for multiple command files. (Cary R.) * diff --git a/lexor.lex b/lexor.lex index 45a854f04c..aaca91c427 100644 --- a/lexor.lex +++ b/lexor.lex @@ -21,7 +21,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: lexor.lex,v 1.94 2007/02/09 05:19:04 steve Exp $" +#ident "$Id: lexor.lex,v 1.95 2007/04/19 02:52:53 steve Exp $" #endif # include "config.h" @@ -53,6 +53,7 @@ extern YYLTYPE yylloc; struct file_name_cell { const char*text; struct file_name_cell*next; + bool library_flag; }; static struct file_name_cell*file_names = 0; @@ -72,6 +73,13 @@ static const char* set_file_name(char*text) cur = new struct file_name_cell; cur->text = text; cur->next = file_names; + + /* Check this file name with the list of library file + names. If there is a match, then turn on the + pform_library_flag. This is how the parser knows that + modules declared in this file are library modules. */ + cur->library_flag = library_file_map[cur->text]; + pform_library_flag = cur->library_flag; return text; } diff --git a/main.cc b/main.cc index c15829d730..0b72cd3c26 100644 --- a/main.cc +++ b/main.cc @@ -19,7 +19,7 @@ const char COPYRIGHT[] = * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: main.cc,v 1.94 2007/03/07 04:24:59 steve Exp $" +#ident "$Id: main.cc,v 1.95 2007/04/19 02:52:53 steve Exp $" #endif # include "config.h" @@ -94,6 +94,7 @@ map flags; char*vpi_module_list = 0; map missing_modules; +map library_file_map; list library_suff; @@ -283,6 +284,11 @@ static void parm_to_flagmap(const string&flag) * This specifies the width of integer variables. (that is, * variables declared using the "integer" keyword.) * + * library_file: + * This marks that a source file with the given path is a + * library. Any modules in that file are marked as library + * modules. + * * module: * Load a VPI module. * @@ -376,6 +382,10 @@ static void read_iconfig_file(const char*ipath) } else if (strcmp(buf, "iwidth") == 0) { integer_width = strtoul(cp,0,10); + } else if (strcmp(buf, "library_file") == 0) { + const char* path = strdup(cp); + library_file_map[path] = true; + } else if (strcmp(buf,"module") == 0) { if (vpi_module_list == 0) { vpi_module_list = strdup(cp); @@ -643,11 +653,20 @@ int main(int argc, char*argv[]) for (mod = pform_modules.begin() ; mod != pform_modules.end() ; mod++) { - if (mentioned_p[(*mod).second->mod_name()] == false) { - if (verbose_flag) - cout << " " << (*mod).second->mod_name(); - roots.push_back((*mod).second->mod_name()); - } + + /* Don't choose library modules. */ + if ((*mod).second->library_flag) + continue; + + /* Don't choose modules instantiated in other + modules. */ + if (mentioned_p[(*mod).second->mod_name()]) + continue; + + /* What's left might as well be chosen as a root. */ + if (verbose_flag) + cout << " " << (*mod).second->mod_name(); + roots.push_back((*mod).second->mod_name()); } if (verbose_flag) cout << endl; @@ -796,6 +815,9 @@ int main(int argc, char*argv[]) /* * $Log: main.cc,v $ + * Revision 1.95 2007/04/19 02:52:53 steve + * Add support for -v flag in command file. + * * Revision 1.94 2007/03/07 04:24:59 steve * Make integer width controllable. * diff --git a/pform.cc b/pform.cc index d4ce67558b..504c3b7e6f 100644 --- a/pform.cc +++ b/pform.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: pform.cc,v 1.143 2007/04/13 02:34:35 steve Exp $" +#ident "$Id: pform.cc,v 1.144 2007/04/19 02:52:53 steve Exp $" #endif # include "config.h" @@ -50,6 +50,9 @@ extern int VLparse(); exactly one module currently being parsed, since verilog does not allow nested module definitions. */ static Module*pform_cur_module = 0; + +bool pform_library_flag = false; + /* increment this for generate schemes within a module, and set it to zero when a new module starts. */ static unsigned scope_generate_counter = 1; @@ -242,6 +245,7 @@ void pform_startmodule(const char*name, const char*file, unsigned lineno, pform_cur_module->set_file(file); pform_cur_module->set_lineno(lineno); + pform_cur_module->library_flag = pform_library_flag; /* The generate scheme numbering starts with *1*, not zero. That's just the way it is, thanks to the standard. */ @@ -1765,6 +1769,9 @@ int pform_parse(const char*path, FILE*file) /* * $Log: pform.cc,v $ + * Revision 1.144 2007/04/19 02:52:53 steve + * Add support for -v flag in command file. + * * Revision 1.143 2007/04/13 02:34:35 steve * Parse edge sensitive paths without edge specifier. * diff --git a/pform.h b/pform.h index fcae8b4218..1847d31550 100644 --- a/pform.h +++ b/pform.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: pform.h,v 1.89 2007/04/13 02:34:35 steve Exp $" +#ident "$Id: pform.h,v 1.90 2007/04/19 02:52:53 steve Exp $" #endif # include "netlist.h" @@ -69,6 +69,12 @@ extern enum MIN_TYP_MAX { MIN, TYP, MAX } min_typ_max_flag; extern unsigned min_typ_max_warn; PExpr* pform_select_mtm_expr(PExpr*min, PExpr*typ, PExpr*max); +/* + * This flag is true if the lexor thinks we are in a library source + * file. + */ +extern bool pform_library_flag; + /* * These type are lexical types -- that is, types that are used as * lexical values to decorate the parse tree during parsing. They are @@ -334,6 +340,9 @@ extern void pform_dump(ostream&out, Module*mod); /* * $Log: pform.h,v $ + * Revision 1.90 2007/04/19 02:52:53 steve + * Add support for -v flag in command file. + * * Revision 1.89 2007/04/13 02:34:35 steve * Parse edge sensitive paths without edge specifier. *