Add support for +libext+ in command files.

This commit is contained in:
steve 2001-11-16 05:07:19 +00:00
parent d8970752b6
commit 0be48388c2
10 changed files with 121 additions and 30 deletions

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: compiler.h,v 1.6 2001/10/20 23:02:40 steve Exp $" #ident "$Id: compiler.h,v 1.7 2001/11/16 05:07:19 steve Exp $"
#endif #endif
# include <list> # include <list>
@ -73,9 +73,13 @@ extern bool verbose_flag;
/* This is an ordered list of libraries to search. */ /* This is an ordered list of libraries to search. */
extern list<const char*>library_dirs; extern list<const char*>library_dirs;
extern list<const char*>library_suff;
/* /*
* $Log: compiler.h,v $ * $Log: compiler.h,v $
* Revision 1.7 2001/11/16 05:07:19 steve
* Add support for +libext+ in command files.
*
* Revision 1.6 2001/10/20 23:02:40 steve * Revision 1.6 2001/10/20 23:02:40 steve
* Add automatic module libraries. * Add automatic module libraries.
* *

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: build_string.c,v 1.5 2001/10/20 23:02:40 steve Exp $" #ident "$Id: build_string.c,v 1.6 2001/11/16 05:07:19 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -136,6 +136,15 @@ int build_string(char*output, size_t olen, const char*pattern)
olen -= strlen(library_flags); olen -= strlen(library_flags);
} }
break; break;
case 'Y':
if (library_flags2) {
strcpy(output, library_flags2);
output += strlen(library_flags2);
olen -= strlen(library_flags2);
}
break;
} }
pattern += 1; pattern += 1;
@ -151,6 +160,9 @@ int build_string(char*output, size_t olen, const char*pattern)
/* /*
* $Log: build_string.c,v $ * $Log: build_string.c,v $
* Revision 1.6 2001/11/16 05:07:19 steve
* Add support for +libext+ in command files.
*
* Revision 1.5 2001/10/20 23:02:40 steve * Revision 1.5 2001/10/20 23:02:40 steve
* Add automatic module libraries. * Add automatic module libraries.
* *

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: cflexor.lex,v 1.3 2001/11/13 03:30:26 steve Exp $" #ident "$Id: cflexor.lex,v 1.4 2001/11/16 05:07:19 steve Exp $"
#endif #endif
# include "cfparse.h" # include "cfparse.h"
@ -70,6 +70,9 @@ static int comment_enter;
"+incdir+" { BEGIN(PLUS_ARGS); return TOK_INCDIR; } "+incdir+" { BEGIN(PLUS_ARGS); return TOK_INCDIR; }
"+libext+" { BEGIN(PLUS_ARGS); return TOK_LIBEXT; }
/* If it is not any known plus-flag, return the generic form. */ /* If it is not any known plus-flag, return the generic form. */
"+"[^\n \t\b\f\r+]* { "+"[^\n \t\b\f\r+]* {
cflval.text = strdup(yytext); cflval.text = strdup(yytext);

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: cfparse.y,v 1.3 2001/11/13 03:30:26 steve Exp $" #ident "$Id: cfparse.y,v 1.4 2001/11/16 05:07:19 steve Exp $"
#endif #endif
@ -31,7 +31,7 @@
}; };
%token TOK_Da TOK_Dv TOK_Dy %token TOK_Da TOK_Dv TOK_Dy
%token TOK_DEFINE TOK_INCDIR %token TOK_DEFINE TOK_INCDIR TOK_LIBEXT
%token <text> TOK_PLUSARG TOK_PLUSWORD TOK_STRING %token <text> TOK_PLUSARG TOK_PLUSWORD TOK_STRING
%% %%
@ -88,6 +88,11 @@ item
| TOK_INCDIR inc_args | TOK_INCDIR inc_args
/* The +libext token introduces a list of +<ext> arguments that
become individual -Y flags to ivl. */
| TOK_LIBEXT libext_args
/* The +<word> tokens that are not otherwise matched, are /* The +<word> tokens that are not otherwise matched, are
ignored. The skip_args rule arranges for all the argument words ignored. The skip_args rule arranges for all the argument words
to be consumed. */ to be consumed. */
@ -116,6 +121,18 @@ inc_arg : TOK_PLUSARG
} }
; ;
/* inc_args are +incdir+ arguments in order. */
libext_args
: libext_args libext_arg
| libext_arg
;
libext_arg : TOK_PLUSARG
{ process_library2_switch($1);
free($1);
}
;
/* skip_args are arguments to a +word flag that is not otherwise /* skip_args are arguments to a +word flag that is not otherwise
parsed. This rule matches them and releases the strings, so that parsed. This rule matches them and releases the strings, so that
they can be safely ignored. */ they can be safely ignored. */

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: globals.h,v 1.9 2001/11/13 03:30:26 steve Exp $" #ident "$Id: globals.h,v 1.10 2001/11/16 05:07:19 steve Exp $"
#endif #endif
# include <stddef.h> # include <stddef.h>
@ -56,6 +56,7 @@ extern void process_file_name(const char*name);
/* Add the name to the list of library directories. */ /* Add the name to the list of library directories. */
extern void process_library_switch(const char*name); extern void process_library_switch(const char*name);
extern void process_library2_switch(const char*name);
/* Add a new include file search directory */ /* Add a new include file search directory */
extern void process_include_dir(const char*name); extern void process_include_dir(const char*name);
@ -68,8 +69,9 @@ extern int verbose_flag;
extern char warning_flags[]; extern char warning_flags[];
/* -y flags from the command line. */ /* -y and -Y flags from the command line. */
extern char* library_flags; extern char* library_flags;
extern char* library_flags2;
extern const char*lookup_pattern(const char*key); extern const char*lookup_pattern(const char*key);
@ -77,6 +79,9 @@ extern int build_string(char*out, size_t olen, const char*pattern);
/* /*
* $Log: globals.h,v $ * $Log: globals.h,v $
* Revision 1.10 2001/11/16 05:07:19 steve
* Add support for +libext+ in command files.
*
* Revision 1.9 2001/11/13 03:30:26 steve * Revision 1.9 2001/11/13 03:30:26 steve
* The +incdir+ plusarg can take multiple directores, * The +incdir+ plusarg can take multiple directores,
* and add initial support for +define+ in the command file. * and add initial support for +define+ in the command file.

View File

@ -1,4 +1,4 @@
.TH iverilog 1 "$Date: 2001/11/14 03:28:15 $" Version "$Date: 2001/11/14 03:28:15 $" .TH iverilog 1 "$Date: 2001/11/16 05:07:19 $" Version "$Date: 2001/11/16 05:07:19 $"
.SH NAME .SH NAME
iverilog - Icarus Verilog compiler iverilog - Icarus Verilog compiler
@ -210,6 +210,13 @@ command line. The difference is that multiple \fI+includedir\fP
directories are valid parameters to a single \fB+incdir+\fP token, directories are valid parameters to a single \fB+incdir+\fP token,
although you may also have multiple \fB+incdir+\fP lines. although you may also have multiple \fB+incdir+\fP lines.
.TP 8
.B +libext+\fIext\fP
The \fB+libext\fP token in command files fives file extensions to try
when looking for a library file. This is useful in conjunction with
\fB-y\fP flags to list suffixes to try in each directory before moving
on to the next library directory.
.TP 8 .TP 8
.B +define+\fINAME\fP=\fIvalue\fP .B +define+\fINAME\fP=\fIvalue\fP
The \fB+define+\fP token is the same as the \fB-D\fP option on the The \fB+define+\fP token is the same as the \fB-D\fP option on the

View File

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ident "$Id: main.c,v 1.29 2001/11/13 03:30:26 steve Exp $" #ident "$Id: main.c,v 1.30 2001/11/16 05:07:19 steve Exp $"
# include "config.h" # include "config.h"
@ -25,7 +25,7 @@ const char HELP[] =
" [-D macro[=defn]] [-I includedir] [-m module]\n" " [-D macro[=defn]] [-I includedir] [-m module]\n"
" [-N file] [-o filename] [-p flag=value]\n" " [-N file] [-o filename] [-p flag=value]\n"
" [-s topmodule] [-t target] [-T min|typ|max]\n" " [-s topmodule] [-t target] [-T min|typ|max]\n"
" [-W class] [-y dur] source_file(s)\n" " [-W class] [-y dir] [-Y suf] source_file(s)\n"
"See man page for details."; "See man page for details.";
#define MAXSIZE 4096 #define MAXSIZE 4096
@ -89,6 +89,7 @@ const char*targ = "vvp";
char warning_flags[16] = ""; char warning_flags[16] = "";
char *library_flags = 0; char *library_flags = 0;
char *library_flags2 = 0;
char*inc_list = 0; char*inc_list = 0;
char*def_list = 0; char*def_list = 0;
@ -284,6 +285,19 @@ void process_library_switch(const char *name)
strcat(library_flags, name); strcat(library_flags, name);
} }
void process_library2_switch(const char *name)
{
if (library_flags2) {
library_flags2 = realloc(library_flags2,
strlen(library_flags2) + strlen(name) + 5);
strcat(library_flags2, " -Y ");
} else {
library_flags2 = malloc(strlen(name) + 4);
strcpy(library_flags2, "-Y ");
}
strcat(library_flags2, name);
}
void process_include_dir(const char *name) void process_include_dir(const char *name)
{ {
if (inc_list == 0) { if (inc_list == 0) {
@ -480,6 +494,9 @@ int main(int argc, char **argv)
case 'y': case 'y':
process_library_switch(optarg); process_library_switch(optarg);
break; break;
case 'Y':
process_library2_switch(optarg);
break;
case '?': case '?':
default: default:
return 1; return 1;
@ -605,6 +622,9 @@ int main(int argc, char **argv)
/* /*
* $Log: main.c,v $ * $Log: main.c,v $
* Revision 1.30 2001/11/16 05:07:19 steve
* Add support for +libext+ in command files.
*
* Revision 1.29 2001/11/13 03:30:26 steve * Revision 1.29 2001/11/13 03:30:26 steve
* The +incdir+ plusarg can take multiple directores, * The +incdir+ plusarg can take multiple directores,
* and add initial support for +define+ in the command file. * and add initial support for +define+ in the command file.

View File

@ -44,6 +44,7 @@
# %W Substitute the ivl warning flags. # %W Substitute the ivl warning flags.
# #
# %y Substitute all the -y flags here. # %y Substitute all the -y flags here.
# %Y Substitute all the -Y flags here.
# #
# %[<c><text>] # %[<c><text>]
# This substitution pattern is magical, and is the only # This substitution pattern is magical, and is the only
@ -58,20 +59,20 @@
# be useful and interesting if the -N flag is included. # be useful and interesting if the -N flag is included.
[-tnull -S] [-tnull -S]
<ivl>%B/ivl %[v-v] %y %W %s %[N-N%N] %[T-T%T] -tdll -fDLL=%B/null.tgt -- - <ivl>%B/ivl %[v-v] %y %Y %W %s %[N-N%N] %[T-T%T] -tdll -fDLL=%B/null.tgt -- -
[-tnull] [-tnull]
<ivl>%B/ivl %[v-v] %y %W %s %[N-N%N] %[T-T%T] -tdll -fDLL=%B/null.tgt -- - <ivl>%B/ivl %[v-v] %y %Y %W %s %[N-N%N] %[T-T%T] -tdll -fDLL=%B/null.tgt -- -
# -- # --
# The vvp target generates code that the vvp simulation engine can execute. # The vvp target generates code that the vvp simulation engine can execute.
# These rules support synthesized and non-synthesized variants. # These rules support synthesized and non-synthesized variants.
[-tvvp -S] [-tvvp -S]
<ivl>%B/ivl %[v-v] %y %W %s %[N-N%N] %[T-T%T] -tdll -fDLL=%B/vvp.tgt -fVVP_EXECUTABLE=%B/../../bin/vvp -Fsynth -Fsyn-rules -Fcprop -Fnodangle %f %m -o%o -- - <ivl>%B/ivl %[v-v] %y %Y %W %s %[N-N%N] %[T-T%T] -tdll -fDLL=%B/vvp.tgt -fVVP_EXECUTABLE=%B/../../bin/vvp -Fsynth -Fsyn-rules -Fcprop -Fnodangle %f %m -o%o -- -
[-tvvp] [-tvvp]
<ivl>%B/ivl %[v-v] %y %W %s %[N-N%N] %[T-T%T] -tdll -fDLL=%B/vvp.tgt -fVVP_EXECUTABLE=%B/../../bin/vvp -Fcprop -Fnodangle %f %m -o%o -- - <ivl>%B/ivl %[v-v] %y %Y %W %s %[N-N%N] %[T-T%T] -tdll -fDLL=%B/vvp.tgt -fVVP_EXECUTABLE=%B/../../bin/vvp -Fcprop -Fnodangle %f %m -o%o -- -
# -- # --
# The vvm target uses the <ivl> string to take the preprocessed code from # The vvm target uses the <ivl> string to take the preprocessed code from
@ -80,20 +81,20 @@
# on the result. # on the result.
[-tvvm] [-tvvm]
<ivl>%B/ivl %[v-v] %y %W %s %[N-N%N] %[T-T%T] -tvvm -Fcprop -Fnodangle -fVPI_MODULE_PATH=%B %f %m -o%o.cc -- - <ivl>%B/ivl %[v-v] %y %Y %W %s %[N-N%N] %[T-T%T] -tvvm -Fcprop -Fnodangle -fVPI_MODULE_PATH=%B %f %m -o%o.cc -- -
# This is the XNF code generator. # This is the XNF code generator.
[-txnf] [-txnf]
<ivl>%B/ivl %y %[v-v] %s %[N-N%N] %[T-T%T] -txnf -Fsynth -Fsyn-rules -Fcprop -Fnodangle -o%o -- - <ivl>%B/ivl %y %Y %[v-v] %s %[N-N%N] %[T-T%T] -txnf -Fsynth -Fsyn-rules -Fcprop -Fnodangle -o%o -- -
# And this is another XNF code generator, under development. # And this is another XNF code generator, under development.
[-tfpga] [-tfpga]
<ivl>%B/ivl %y %[v-v] %s %[N-N%N] %[T-T%T] %f -tdll -fDLL=%B/fpga.tgt -Fsynth -Fsyn-rules -Fcprop -Fnodangle -o%o -- - <ivl>%B/ivl %y %Y %[v-v] %s %[N-N%N] %[T-T%T] %f -tdll -fDLL=%B/fpga.tgt -Fsynth -Fsyn-rules -Fcprop -Fnodangle -o%o -- -
# -- # --
# This is the pal code generator. The target module requires the -fpart=<type> # This is the pal code generator. The target module requires the -fpart=<type>
# flag to specify the part type. # flag to specify the part type.
[-tpal] [-tpal]
<ivl>%B/ivl %y %[v-v] %s %[N-N%N] %[T-T%T] -tdll -fDLL=%B/pal.tgt -Fsynth -Fsyn-rules -Fcprop -Fnodangle -o%o -- - <ivl>%B/ivl %y %Y %[v-v] %s %[N-N%N] %[T-T%T] -tdll -fDLL=%B/pal.tgt -Fsynth -Fsyn-rules -Fcprop -Fnodangle -o%o -- -

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) #if !defined(WINNT)
#ident "$Id: load_module.cc,v 1.2 2001/10/22 02:05:21 steve Exp $" #ident "$Id: load_module.cc,v 1.3 2001/11/16 05:07:19 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -36,18 +36,23 @@ bool load_module(const char*type)
for (list<const char*>::iterator cur = library_dirs.begin() for (list<const char*>::iterator cur = library_dirs.begin()
; cur != library_dirs.end() ; cur != library_dirs.end()
; cur ++ ) { ; cur ++ ) {
sprintf(path, "%s%c%s.v", *cur, dir_character, type); for (list<const char*>::iterator suf = library_suff.begin()
; suf != library_suff.end()
; suf ++ ) {
FILE*file = fopen(path, "r"); sprintf(path, "%s%c%s%s", *cur, dir_character, type, *suf);
if (file == 0)
continue;
if (verbose_flag) { FILE*file = fopen(path, "r");
cerr << "Loading library file " << path << "." << endl; if (file == 0)
continue;
if (verbose_flag) {
cerr << "Loading library file " << path << "." << endl;
}
pform_parse(path, file);
return true;
} }
pform_parse(path, file);
return true;
} }
return false; return false;
@ -55,6 +60,9 @@ bool load_module(const char*type)
/* /*
* $Log: load_module.cc,v $ * $Log: load_module.cc,v $
* Revision 1.3 2001/11/16 05:07:19 steve
* Add support for +libext+ in command files.
*
* Revision 1.2 2001/10/22 02:05:21 steve * Revision 1.2 2001/10/22 02:05:21 steve
* Handle activating tasks in another root. * Handle activating tasks in another root.
* *

18
main.cc
View File

@ -19,7 +19,7 @@ const char COPYRIGHT[] =
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: main.cc,v 1.50 2001/10/20 23:02:40 steve Exp $" #ident "$Id: main.cc,v 1.51 2001/11/16 05:07:19 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -79,6 +79,7 @@ const char*target = "null";
map<string,string> flags; map<string,string> flags;
list<const char*> library_dirs; list<const char*> library_dirs;
list<const char*> library_suff;
/* /*
* These are the warning enable flags. * These are the warning enable flags.
@ -189,7 +190,7 @@ int main(int argc, char*argv[])
min_typ_max_flag = TYP; min_typ_max_flag = TYP;
min_typ_max_warn = 10; min_typ_max_warn = 10;
while ((opt = getopt(argc, argv, "F:f:hm:N:o:P:p:s:T:t:VvW:y:")) != EOF) switch (opt) { while ((opt = getopt(argc, argv, "F:f:hm:N:o:P:p:s:T:t:VvW:Y:y:")) != EOF) switch (opt) {
case 'F': { case 'F': {
net_func tmp = name_to_net_func(optarg); net_func tmp = name_to_net_func(optarg);
if (tmp == 0) { if (tmp == 0) {
@ -261,6 +262,9 @@ int main(int argc, char*argv[])
case 'y': case 'y':
library_dirs.push_back(optarg); library_dirs.push_back(optarg);
break; break;
case 'Y':
library_suff.push_back(optarg);
break;
default: default:
flag_errors += 1; flag_errors += 1;
break; break;
@ -290,6 +294,7 @@ int main(int argc, char*argv[])
".\n" ".\n"
"\t-V Print version and copyright information, and exit.\n" "\t-V Print version and copyright information, and exit.\n"
"\t-y <dir> Add directory to library search path.\n" "\t-y <dir> Add directory to library search path.\n"
"\t-Y <suf> Add suffix string library search path.\n"
; ;
cout << "Netlist functions:" << endl; cout << "Netlist functions:" << endl;
@ -306,6 +311,12 @@ int main(int argc, char*argv[])
return 1; return 1;
} }
/* If there were no -Y flags, then create a minimal library
suffix search list. */
if (library_suff.empty()) {
library_suff.push_back(".v");
}
/* Scan the warnings enable string for warning flags. */ /* Scan the warnings enable string for warning flags. */
for (const char*cp = warn_en ; *cp ; cp += 1) switch (*cp) { for (const char*cp = warn_en ; *cp ; cp += 1) switch (*cp) {
case 'i': case 'i':
@ -466,6 +477,9 @@ int main(int argc, char*argv[])
/* /*
* $Log: main.cc,v $ * $Log: main.cc,v $
* Revision 1.51 2001/11/16 05:07:19 steve
* Add support for +libext+ in command files.
*
* Revision 1.50 2001/10/20 23:02:40 steve * Revision 1.50 2001/10/20 23:02:40 steve
* Add automatic module libraries. * Add automatic module libraries.
* *