Add support for +libext+ in command files.
This commit is contained in:
parent
d8970752b6
commit
0be48388c2
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#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
|
||||
|
||||
# include <list>
|
||||
|
|
@ -73,9 +73,13 @@ extern bool verbose_flag;
|
|||
|
||||
/* This is an ordered list of libraries to search. */
|
||||
extern list<const char*>library_dirs;
|
||||
extern list<const char*>library_suff;
|
||||
|
||||
/*
|
||||
* $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
|
||||
* Add automatic module libraries.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#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
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -136,6 +136,15 @@ int build_string(char*output, size_t olen, const char*pattern)
|
|||
olen -= strlen(library_flags);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'Y':
|
||||
if (library_flags2) {
|
||||
strcpy(output, library_flags2);
|
||||
output += strlen(library_flags2);
|
||||
olen -= strlen(library_flags2);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
pattern += 1;
|
||||
|
||||
|
|
@ -151,6 +160,9 @@ int build_string(char*output, size_t olen, const char*pattern)
|
|||
|
||||
/*
|
||||
* $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
|
||||
* Add automatic module libraries.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#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
|
||||
|
||||
# include "cfparse.h"
|
||||
|
|
@ -70,6 +70,9 @@ static int comment_enter;
|
|||
|
||||
"+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. */
|
||||
"+"[^\n \t\b\f\r+]* {
|
||||
cflval.text = strdup(yytext);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#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
|
||||
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
};
|
||||
|
||||
%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
|
||||
|
||||
%%
|
||||
|
|
@ -88,6 +88,11 @@ item
|
|||
|
||||
| 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
|
||||
ignored. The skip_args rule arranges for all the argument words
|
||||
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
|
||||
parsed. This rule matches them and releases the strings, so that
|
||||
they can be safely ignored. */
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#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
|
||||
|
||||
# include <stddef.h>
|
||||
|
|
@ -56,6 +56,7 @@ extern void process_file_name(const char*name);
|
|||
|
||||
/* Add the name to the list of library directories. */
|
||||
extern void process_library_switch(const char*name);
|
||||
extern void process_library2_switch(const char*name);
|
||||
|
||||
/* Add a new include file search directory */
|
||||
extern void process_include_dir(const char*name);
|
||||
|
|
@ -68,8 +69,9 @@ extern int verbose_flag;
|
|||
|
||||
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_flags2;
|
||||
|
||||
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 $
|
||||
* 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
|
||||
* The +incdir+ plusarg can take multiple directores,
|
||||
* and add initial support for +define+ in the command 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
|
||||
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,
|
||||
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
|
||||
.B +define+\fINAME\fP=\fIvalue\fP
|
||||
The \fB+define+\fP token is the same as the \fB-D\fP option on the
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* 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"
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ const char HELP[] =
|
|||
" [-D macro[=defn]] [-I includedir] [-m module]\n"
|
||||
" [-N file] [-o filename] [-p flag=value]\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.";
|
||||
|
||||
#define MAXSIZE 4096
|
||||
|
|
@ -89,6 +89,7 @@ const char*targ = "vvp";
|
|||
|
||||
char warning_flags[16] = "";
|
||||
char *library_flags = 0;
|
||||
char *library_flags2 = 0;
|
||||
|
||||
char*inc_list = 0;
|
||||
char*def_list = 0;
|
||||
|
|
@ -284,6 +285,19 @@ void process_library_switch(const char *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)
|
||||
{
|
||||
if (inc_list == 0) {
|
||||
|
|
@ -480,6 +494,9 @@ int main(int argc, char **argv)
|
|||
case 'y':
|
||||
process_library_switch(optarg);
|
||||
break;
|
||||
case 'Y':
|
||||
process_library2_switch(optarg);
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
return 1;
|
||||
|
|
@ -605,6 +622,9 @@ int main(int argc, char **argv)
|
|||
|
||||
/*
|
||||
* $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
|
||||
* The +incdir+ plusarg can take multiple directores,
|
||||
* and add initial support for +define+ in the command file.
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
# %W Substitute the ivl warning flags.
|
||||
#
|
||||
# %y Substitute all the -y flags here.
|
||||
# %Y Substitute all the -Y flags here.
|
||||
#
|
||||
# %[<c><text>]
|
||||
# This substitution pattern is magical, and is the only
|
||||
|
|
@ -58,20 +59,20 @@
|
|||
# be useful and interesting if the -N flag is included.
|
||||
|
||||
[-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]
|
||||
<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.
|
||||
# These rules support synthesized and non-synthesized variants.
|
||||
|
||||
[-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]
|
||||
<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
|
||||
|
|
@ -80,20 +81,20 @@
|
|||
# on the result.
|
||||
|
||||
[-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.
|
||||
|
||||
[-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.
|
||||
[-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>
|
||||
# flag to specify the part type.
|
||||
[-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 -- -
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#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
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -36,18 +36,23 @@ bool load_module(const char*type)
|
|||
for (list<const char*>::iterator cur = library_dirs.begin()
|
||||
; cur != library_dirs.end()
|
||||
; 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");
|
||||
if (file == 0)
|
||||
continue;
|
||||
sprintf(path, "%s%c%s%s", *cur, dir_character, type, *suf);
|
||||
|
||||
if (verbose_flag) {
|
||||
cerr << "Loading library file " << path << "." << endl;
|
||||
FILE*file = fopen(path, "r");
|
||||
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;
|
||||
|
|
@ -55,6 +60,9 @@ bool load_module(const char*type)
|
|||
|
||||
/*
|
||||
* $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
|
||||
* Handle activating tasks in another root.
|
||||
*
|
||||
|
|
|
|||
18
main.cc
18
main.cc
|
|
@ -19,7 +19,7 @@ const char COPYRIGHT[] =
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#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
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -79,6 +79,7 @@ const char*target = "null";
|
|||
map<string,string> flags;
|
||||
|
||||
list<const char*> library_dirs;
|
||||
list<const char*> library_suff;
|
||||
|
||||
/*
|
||||
* These are the warning enable flags.
|
||||
|
|
@ -189,7 +190,7 @@ int main(int argc, char*argv[])
|
|||
min_typ_max_flag = TYP;
|
||||
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': {
|
||||
net_func tmp = name_to_net_func(optarg);
|
||||
if (tmp == 0) {
|
||||
|
|
@ -261,6 +262,9 @@ int main(int argc, char*argv[])
|
|||
case 'y':
|
||||
library_dirs.push_back(optarg);
|
||||
break;
|
||||
case 'Y':
|
||||
library_suff.push_back(optarg);
|
||||
break;
|
||||
default:
|
||||
flag_errors += 1;
|
||||
break;
|
||||
|
|
@ -290,6 +294,7 @@ int main(int argc, char*argv[])
|
|||
".\n"
|
||||
"\t-V Print version and copyright information, and exit.\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;
|
||||
|
|
@ -306,6 +311,12 @@ int main(int argc, char*argv[])
|
|||
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. */
|
||||
for (const char*cp = warn_en ; *cp ; cp += 1) switch (*cp) {
|
||||
case 'i':
|
||||
|
|
@ -466,6 +477,9 @@ int main(int argc, char*argv[])
|
|||
|
||||
/*
|
||||
* $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
|
||||
* Add automatic module libraries.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue