Use the conf file to generate the vvm ivl string.

This commit is contained in:
steve 2000-10-28 03:45:47 +00:00
parent 7545db5e26
commit 07d7008853
4 changed files with 79 additions and 12 deletions

View File

@ -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.1 2000/10/08 22:36:56 steve Exp $"
#ident "$Id: build_string.c,v 1.2 2000/10/28 03:45:47 steve Exp $"
#endif
# include "globals.h"
@ -41,11 +41,11 @@ int build_string(char*output, size_t olen, const char*pattern)
*output++ = '%';
break;
case '?': {
case '[': {
const char*tail;
pattern += 1;
assert(*pattern);
tail = strchr(pattern+1, ';');
tail = strchr(pattern+1, ']');
assert(tail);
strncpy(tmp_buf, pattern+1, tail-pattern-1);
tmp_buf[tail-pattern-1] = 0;
@ -68,6 +68,22 @@ int build_string(char*output, size_t olen, const char*pattern)
olen -= strlen(base);
break;
case 'f':
if (f_list) {
strcpy(output, f_list);
output += strlen(f_list);
olen -= strlen(f_list);
}
break;
case 'm':
if (mod_list) {
strcpy(output, mod_list);
output += strlen(mod_list);
olen -= strlen(mod_list);
}
break;
case 'N':
if (npath) {
strcpy(output, npath);
@ -76,6 +92,12 @@ int build_string(char*output, size_t olen, const char*pattern)
}
break;
case 'o':
strcpy(output, opath);
output += strlen(opath);
olen -= strlen(opath);
break;
case 's':
if (start) {
strcpy(output, start);
@ -97,6 +119,13 @@ int build_string(char*output, size_t olen, const char*pattern)
output += strlen(targ);
olen -= strlen(targ);
break;
case 'W':
strcpy(output, warning_flags);
output += strlen(warning_flags);
olen -= strlen(warning_flags);
break;
}
pattern += 1;
@ -112,6 +141,9 @@ int build_string(char*output, size_t olen, const char*pattern)
/*
* $Log: build_string.c,v $
* Revision 1.2 2000/10/28 03:45:47 steve
* Use the conf file to generate the vvm ivl string.
*
* Revision 1.1 2000/10/08 22:36:56 steve
* iverilog with an iverilog.conf configuration file.
*

View File

@ -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.1 2000/10/08 22:36:56 steve Exp $"
#ident "$Id: globals.h,v 1.2 2000/10/28 03:45:47 steve Exp $"
#endif
# include <stddef.h>
@ -27,24 +27,38 @@
/* This is the base (i.e. -B<value>) of the Icarus Verilog files. */
extern const char*base;
/* This is a list of all the -f<key>=<value> options from the
command line, concatenated together. */
extern char*f_list;
extern char*mod_list;
/* This is the optional -Tmin|typ|max setting. */
extern const char*mtm;
/* Ths is the optional -N<path> value, if one was supplied. */
extern const char*npath;
/* This is the name of the output file that the user selected. */
extern const char*opath;
/* This pointer is set if there was a -s<value> parameter. */
extern const char*start;
/* This is the name of the selected target. */
extern const char*targ;
extern char warning_flags[];
extern const char*lookup_pattern(const char*key);
extern int build_string(char*out, size_t olen, const char*pattern);
/*
* $Log: globals.h,v $
* Revision 1.2 2000/10/28 03:45:47 steve
* Use the conf file to generate the vvm ivl string.
*
* Revision 1.1 2000/10/08 22:36:56 steve
* iverilog with an iverilog.conf configuration file.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: main.c,v 1.2 2000/10/28 03:45:47 steve Exp $"
#ident "$Id: main.c,v 1.3 2000/10/28 03:47:25 steve Exp $"
#endif
#include <stdio.h>
@ -117,7 +117,7 @@ static int t_vvm(char*cmd, unsigned ncmd)
{
int rc;
pattern = lookup_pattern("<ivl>");
const char*pattern = lookup_pattern("<ivl>");
if (pattern == 0) {
fprintf(stderr, "No such target: %s\n", targ);
return -1;
@ -456,6 +456,9 @@ int main(int argc, char **argv)
/*
* $Log: main.c,v $
* Revision 1.3 2000/10/28 03:47:25 steve
* Use the conf file to generate the vvm ivl string.
*
* Revision 1.2 2000/10/28 03:45:47 steve
* Use the conf file to generate the vvm ivl string.
*

View File

@ -28,19 +28,27 @@
#
# %B Substitute the base libdir, -B flag of iverilog.
#
# %f Substitute the -f flags from the command line.
#
# %s Substitute the start module (-s flag) from the user.
#
# %N Substitute the value of the -N<path> flag.
#
# %o Substitute the value of the -o<path> flag, or the default
# output path if there is no -o flag.
#
# %T Substitute min, typ or max depending on the -T flag from the
# command line.
#
# %?<c><text>;
#
# %W Substitute the ivl warning flags.
#
# %[<c><text>]
# This substitution pattern is magical, and is the only
# multicharacter pattern. This tests the code <c>, and
# substitutes <text> into the output only if <c> is true.
# The <text> may include further substitution strings, and is
# terminated by a semi-colon (;) character.
# terminated by a ``]'' character.
# This is the null (no op) target. Thre is a synthesis version and a
@ -48,15 +56,25 @@
# be useful and interesting if the -N flag is included.
[-tnull -S]
<ivl>%B/ivl %?s-s%s; %?N-N%N; %?T-T%T; -tnull -- -
<ivl>%B/ivl %W %[s-s%s] %[N-N%N] %[T-T%T] -tnull -- -
[-tnull]
<ivl>%B/ivl %?s-s%s; %?N-N%N; %?T-T%T; -tnull -- -
<ivl>%B/ivl %W %[s-s%s] %[N-N%N] %[T-T%T] -tnull -- -
# --
# The vvm target uses the <ivl> string to take the preprocessed code from
# standard input, compile it with the vvm code generator and write the
# result to %o.cc. The driver assumes this when invoking the C++ compiler
# on the result.
[-tvvm]
<ivl>%B/ivl %W %[s-s%s] %[N-N%N] %[T-T%T] -tvvm -Fcprop -Fnodangle -fVPI_MODULE_PATH=%B %f %m -o%o.cc -- -
# -- (not supported yet)
# The <ivl> string for the vvm target is the ivl command that takes as
# standard input the output from the preprocessor and writes the result
# into a .cc file named after the output file.
[-tvvm]
<ivl>%B/ivl %?s-s%s; %?N-N%N; %?T-T%T; -tvvm -Fcprop -Fnodangle -fVPI_MODULE_PATH=%B -- -
[-txnf]
<ivl>%B/ivl %[s-s%s] %[N-N%N] %[T-T%T] -tvvm -Fsynth -Fsyn-rules -Fcprop -Fnodangle -o%o -- -