Skip to content

Commit

Permalink
Add support for -v flag in command file.
Browse files Browse the repository at this point in the history
  • Loading branch information
steve committed Apr 19, 2007
1 parent 26f47c2 commit f9c1c02
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 23 deletions.
6 changes: 5 additions & 1 deletion Module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -31,6 +31,7 @@
Module::Module(perm_string n)
: name_(n)
{
library_flag = false;
default_nettype = NetNet::NONE;
}

Expand Down Expand Up @@ -150,6 +151,9 @@ const list<PProcess*>& 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.
*
Expand Down
11 changes: 10 additions & 1 deletion Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <list>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
*
Expand Down
14 changes: 12 additions & 2 deletions compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <list>
Expand Down Expand Up @@ -117,13 +117,20 @@ extern char*ivlpp_string;

extern map<perm_string,unsigned> 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<string,bool> 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.
Expand All @@ -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.
*
Expand Down
8 changes: 3 additions & 5 deletions driver/cfparse.y
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down
7 changes: 5 additions & 2 deletions driver/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stddef.h>
Expand Down Expand Up @@ -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);
Expand All @@ -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.
*
Expand Down
11 changes: 8 additions & 3 deletions driver/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -403,14 +403,16 @@ 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);

} else {
fprintf(source_file, "%s\n", name);
source_count += 1;
if (lib_flag)
fprintf(iconfig_file,"library_file:%s\n", name);
}
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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.)
*
Expand Down
10 changes: 9 additions & 1 deletion lexor.lex
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down
34 changes: 28 additions & 6 deletions main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -94,6 +94,7 @@ map<string,const char*> flags;
char*vpi_module_list = 0;

map<perm_string,unsigned> missing_modules;
map<string,bool> library_file_map;

list<const char*> library_suff;

Expand Down Expand Up @@ -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:<path>
* This marks that a source file with the given path is a
* library. Any modules in that file are marked as library
* modules.
*
* module:<name>
* Load a VPI module.
*
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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.
*
Expand Down
9 changes: 8 additions & 1 deletion pform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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. */
Expand Down Expand Up @@ -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.
*
Expand Down
11 changes: 10 additions & 1 deletion pform.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
*
Expand Down

0 comments on commit f9c1c02

Please sign in to comment.