V0.8: Mostly back port the version checking code from development.
This is a back port from development of the code to put and check that the vvp input file is the right version. It also adds the -V flag to vvp. It does not add the VERSION_TAG information so will only produce the single string ivl_version tag. The runtime will read both forms since if it is feed a V0.9 file we want it to complain nicely (no syntax error). To change the displayed version for the various programs and checks change version.h.
This commit is contained in:
parent
e8bc5aefb4
commit
a22124a198
|
|
@ -21,12 +21,6 @@
|
|||
#
|
||||
SHELL = /bin/sh
|
||||
|
||||
# This version string is only used in the version message printed
|
||||
# by the compiler. It reflects the assigned version number for the
|
||||
# product as a whole. Most components also print the CVS Name: token
|
||||
# in order to get a more automatic version stamp as well.
|
||||
VERSION = 0.8.6
|
||||
|
||||
# This string is used as an installation suffix. It modifies certain
|
||||
# key install paths/files such that a build and install of Icarus Verilog
|
||||
# with the same $(prefix) but a different $(suffix) will not interfere.
|
||||
|
|
@ -80,7 +74,7 @@ all: dep ivl@EXEEXT@
|
|||
for tgt in $(TARGETS); do (cd $$tgt ; $(MAKE) $@); done
|
||||
for dir in ivlpp tgt-verilog tgt-stub; \
|
||||
do (cd $$dir ; $(MAKE) $@); done
|
||||
cd driver ; $(MAKE) VERSION=$(VERSION) $@
|
||||
cd driver ; $(MAKE) $@
|
||||
|
||||
# In the windows world, the installer will need a dosify program to
|
||||
# dosify text files.
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@
|
|||
#
|
||||
SHELL = /bin/sh
|
||||
|
||||
VERSION = 0.0
|
||||
|
||||
suffix = @install_suffix@
|
||||
|
||||
prefix = @prefix@
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@
|
|||
#
|
||||
SHELL = /bin/sh
|
||||
|
||||
VERSION = 0.8.3
|
||||
|
||||
suffix = @install_suffix@
|
||||
|
||||
prefix = @prefix@
|
||||
|
|
@ -45,7 +43,7 @@ INSTALL = @INSTALL@
|
|||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
CPPFLAGS = @ident_support@ -I. -I$(srcdir)/.. -DVERSION='"$(VERSION)"' @CPPFLAGS@ @DEFS@
|
||||
CPPFLAGS = @ident_support@ -I. -I$(srcdir)/.. @CPPFLAGS@ @DEFS@
|
||||
CFLAGS = -Wall @CFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@
|
|||
#
|
||||
SHELL = /bin/sh
|
||||
|
||||
VERSION = 0.8
|
||||
|
||||
suffix = @install_suffix@
|
||||
|
||||
prefix = @prefix@
|
||||
|
|
@ -45,7 +43,7 @@ INSTALL_DATA = @INSTALL_DATA@
|
|||
MAN = @MAN@
|
||||
PS2PDF = @PS2PDF@
|
||||
|
||||
CPPFLAGS = @ident_support@ -I. -I.. -I$(srcdir)/.. -I$(srcdir) -DVERSION='"$(VERSION)"' @CPPFLAGS@ @DEFS@
|
||||
CPPFLAGS = @ident_support@ -I. -I.. -I$(srcdir)/.. -I$(srcdir) @CPPFLAGS@ @DEFS@
|
||||
CFLAGS = -Wall @CFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#endif
|
||||
|
||||
# include "config.h"
|
||||
# include "version.h"
|
||||
|
||||
const char NOTICE[] =
|
||||
" This program is free software; you can redistribute it and/or modify\n"
|
||||
|
|
@ -704,7 +705,7 @@ int main(int argc, char **argv)
|
|||
pbase = base;
|
||||
|
||||
if (version_flag || verbose_flag) {
|
||||
printf("Icarus Verilog version " VERSION " ($Name: $)\n");
|
||||
printf("Icarus Verilog version " VERSION "\n\n");
|
||||
printf("Copyright 1998-2003 Stephen Williams\n");
|
||||
puts(NOTICE);
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@
|
|||
#
|
||||
SHELL = /bin/sh
|
||||
|
||||
VERSION = 0.0
|
||||
|
||||
suffix = @install_suffix@
|
||||
|
||||
prefix = @prefix@
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ const char COPYRIGHT[] =
|
|||
#endif
|
||||
|
||||
# include "config.h"
|
||||
# include "version.h"
|
||||
|
||||
const char NOTICE[] =
|
||||
" This program is free software; you can redistribute it and/or modify\n"
|
||||
|
|
@ -38,8 +39,6 @@ const char NOTICE[] =
|
|||
" Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA\n"
|
||||
;
|
||||
|
||||
const char VERSION[] = "$Name: $ $State: Exp $";
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
#ifdef HAVE_MALLOC_H
|
||||
|
|
@ -213,7 +212,7 @@ int main(int argc, char*argv[])
|
|||
break;
|
||||
|
||||
case 'v':
|
||||
fprintf(stderr, "Icarus Verilog Preprocessor version %s\n",
|
||||
fprintf(stderr, "Icarus Verilog Preprocessor version %s\n\n",
|
||||
VERSION);
|
||||
fprintf(stderr, "%s\n", COPYRIGHT);
|
||||
fputs(NOTICE, stderr);
|
||||
|
|
|
|||
9
main.cc
9
main.cc
|
|
@ -59,6 +59,7 @@ const char NOTICE[] =
|
|||
# include "netlist.h"
|
||||
# include "target.h"
|
||||
# include "compiler.h"
|
||||
# include "version.h"
|
||||
|
||||
#if defined(__MINGW32__) && !defined(HAVE_GETOPT_H)
|
||||
extern "C" int getopt(int argc, char*argv[], const char*fmt);
|
||||
|
|
@ -75,8 +76,6 @@ extern "C" const char*optarg;
|
|||
/* Count errors detected in flag processing. */
|
||||
unsigned flag_errors = 0;
|
||||
|
||||
const char VERSION[] = "$Name: $";
|
||||
|
||||
const char*basedir = ".";
|
||||
|
||||
const char*target = "null";
|
||||
|
|
@ -504,7 +503,7 @@ int main(int argc, char*argv[])
|
|||
# endif
|
||||
break;
|
||||
case 'V':
|
||||
cout << "Icarus Verilog version " << VERSION << endl;
|
||||
cout << "Icarus Verilog version " << VERSION << endl << endl;
|
||||
cout << COPYRIGHT << endl;
|
||||
cout << endl << NOTICE << endl;
|
||||
return 0;
|
||||
|
|
@ -517,8 +516,8 @@ int main(int argc, char*argv[])
|
|||
return flag_errors;
|
||||
|
||||
if (help_flag) {
|
||||
cout << "Icarus Verilog version " << VERSION << endl <<
|
||||
"usage: ivl <options> <file>\n"
|
||||
cout << "Icarus Verilog version " << VERSION << endl << endl <<
|
||||
"Usage: ivl <options> <file>\n"
|
||||
"options:\n"
|
||||
"\t-C <name> Config file from driver.\n"
|
||||
"\t-h Print usage information, and exit.\n"
|
||||
|
|
|
|||
|
|
@ -29,8 +29,6 @@
|
|||
#
|
||||
SHELL = /bin/sh
|
||||
|
||||
VERSION = 0.0
|
||||
|
||||
suffix = @install_suffix@
|
||||
|
||||
prefix = @prefix@
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@
|
|||
#
|
||||
SHELL = /bin/sh
|
||||
|
||||
VERSION = 0.0
|
||||
|
||||
suffix = @install_suffix@
|
||||
|
||||
prefix = @prefix@
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@
|
|||
#
|
||||
SHELL = /bin/sh
|
||||
|
||||
VERSION = 0.0
|
||||
|
||||
suffix = @install_suffix@
|
||||
|
||||
prefix = @prefix@
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@
|
|||
#
|
||||
SHELL = /bin/sh
|
||||
|
||||
VERSION = 0.0
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
srcdir = @srcdir@
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@
|
|||
#
|
||||
SHELL = /bin/sh
|
||||
|
||||
VERSION = 0.0
|
||||
|
||||
suffix = @install_suffix@
|
||||
|
||||
prefix = @prefix@
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@
|
|||
#
|
||||
SHELL = /bin/sh
|
||||
|
||||
VERSION = 0.0
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
srcdir = @srcdir@
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@
|
|||
#
|
||||
SHELL = /bin/sh
|
||||
|
||||
VERSION = 0.0
|
||||
|
||||
suffix = @install_suffix@
|
||||
|
||||
prefix = @prefix@
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
|
||||
# include "vvp_priv.h"
|
||||
# include "version.h"
|
||||
# include <string.h>
|
||||
# include <assert.h>
|
||||
# include <sys/types.h>
|
||||
|
|
@ -39,7 +40,10 @@ inline static void draw_execute_header(ivl_design_t des)
|
|||
fprintf(vvp_out, "#! %s\n", cp);
|
||||
fchmod(fileno(vvp_out), 0755);
|
||||
}
|
||||
#else
|
||||
fprintf(vvp_out, "# MinGW does not support an executable header.\n");
|
||||
#endif
|
||||
fprintf(vvp_out, ":ivl_version \"" VERSION "\";\n");
|
||||
}
|
||||
|
||||
inline static void draw_module_declarations(ivl_design_t des)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
/*
|
||||
* Set the version information here.
|
||||
*/
|
||||
#define VERSION "0.8.6"
|
||||
|
|
@ -21,8 +21,6 @@
|
|||
#
|
||||
SHELL = /bin/sh
|
||||
|
||||
VERSION = 0.0
|
||||
|
||||
suffix = @install_suffix@
|
||||
|
||||
prefix = @prefix@
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
%%
|
||||
|
||||
/* These are some special header keywords. */
|
||||
^":ivl_version" { return K_ivl_version; }
|
||||
^":vpi_module" { return K_vpi_module; }
|
||||
^":vpi_time_precision" { return K_vpi_time_precision; }
|
||||
|
||||
|
|
|
|||
93
vvp/main.cc
93
vvp/main.cc
|
|
@ -21,6 +21,7 @@
|
|||
#endif
|
||||
|
||||
# include "config.h"
|
||||
# include "version.h"
|
||||
# include "parse_misc.h"
|
||||
# include "compile.h"
|
||||
# include "schedule.h"
|
||||
|
|
@ -51,6 +52,7 @@ extern "C" const char*optarg;
|
|||
#endif
|
||||
|
||||
bool verbose_flag = false;
|
||||
bool version_flag = false;
|
||||
|
||||
static char log_buffer[4096];
|
||||
|
||||
|
|
@ -110,6 +112,62 @@ inline static void print_rusage(struct rusage *, struct rusage *){};
|
|||
|
||||
#endif // ! defined(HAVE_SYS_RESOURCE_H)
|
||||
|
||||
static bool have_ivl_version = false;
|
||||
/*
|
||||
* Verify that the input file has a compatible version.
|
||||
*/
|
||||
void verify_version(char*ivl_ver, char*commit)
|
||||
{
|
||||
have_ivl_version = true;
|
||||
|
||||
if (verbose_flag) {
|
||||
vpi_mcd_printf(1, " ... VVP file version %s", ivl_ver);
|
||||
if (commit) vpi_mcd_printf(1, " %s", commit);
|
||||
vpi_mcd_printf(1, "\n");
|
||||
}
|
||||
free(commit);
|
||||
|
||||
char*vvp_ver = strdup(VERSION);
|
||||
char *vp, *ip;
|
||||
|
||||
/* Check the major/minor version. */
|
||||
ip = strrchr(ivl_ver, '.');
|
||||
*ip = '\0';
|
||||
vp = strrchr(vvp_ver, '.');
|
||||
*vp = '\0';
|
||||
if (strcmp(ivl_ver, vvp_ver) != 0) {
|
||||
vpi_mcd_printf(1, "Error: VVP input file version %s can not "
|
||||
"be run with run time version %s!\n",
|
||||
ivl_ver, vvp_ver);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Check that the sub-version is compatible. */
|
||||
ip += 1;
|
||||
vp += 1;
|
||||
int ivl_sv, vvp_sv;
|
||||
if (strcmp(ip, "devel") == 0) {
|
||||
ivl_sv = -1;
|
||||
} else {
|
||||
int res = sscanf(ip, "%d", &ivl_sv);
|
||||
assert(res == 1);
|
||||
}
|
||||
if (strcmp(vp, "devel") == 0) {
|
||||
vvp_sv = -1;
|
||||
} else {
|
||||
int res = sscanf(vp, "%d", &vvp_sv);
|
||||
assert(res == 1);
|
||||
}
|
||||
if (ivl_sv > vvp_sv) {
|
||||
if (verbose_flag) vpi_mcd_printf(1, " ... ");
|
||||
vpi_mcd_printf(1, "Warning: VVP input file sub-version %s is "
|
||||
"greater than the run time sub-version %s!\n",
|
||||
ip, vp);
|
||||
}
|
||||
|
||||
free(ivl_ver);
|
||||
free(vvp_ver);
|
||||
}
|
||||
|
||||
unsigned module_cnt = 0;
|
||||
const char*module_tab[64];
|
||||
|
|
@ -145,7 +203,7 @@ int main(int argc, char*argv[])
|
|||
/* For non-interactive runs we do not want to run the interactive
|
||||
* debugger, so make $stop just execute a $finish. */
|
||||
stop_is_finish = false;
|
||||
while ((opt = getopt(argc, argv, "+dhl:M:m:nv")) != EOF) switch (opt) {
|
||||
while ((opt = getopt(argc, argv, "+dhl:M:m:nvV")) != EOF) switch (opt) {
|
||||
case 'h':
|
||||
fprintf(stderr,
|
||||
"Usage: vvp [options] input-file [+plusargs...]\n"
|
||||
|
|
@ -156,7 +214,8 @@ int main(int argc, char*argv[])
|
|||
" -M - Clear VPI module path\n"
|
||||
" -m module Load vpi module.\n"
|
||||
" -n Non-interactive ($stop = $finish).\n"
|
||||
" -v Verbose progress messages.\n" );
|
||||
" -v Verbose progress messages.\n"
|
||||
" -V Print the version information.\n" );
|
||||
exit(0);
|
||||
case 'l':
|
||||
logfile_name = optarg;
|
||||
|
|
@ -178,6 +237,9 @@ int main(int argc, char*argv[])
|
|||
case 'v':
|
||||
verbose_flag = true;
|
||||
break;
|
||||
case 'V':
|
||||
version_flag = true;
|
||||
break;
|
||||
default:
|
||||
flag_errors += 1;
|
||||
}
|
||||
|
|
@ -185,6 +247,27 @@ int main(int argc, char*argv[])
|
|||
if (flag_errors)
|
||||
return flag_errors;
|
||||
|
||||
if (version_flag) {
|
||||
fprintf(stderr, "Icarus Verilog runtime version " VERSION "\n\n");
|
||||
fprintf(stderr, "Copyright 2001-2006 Stephen Williams\n\n");
|
||||
fprintf(stderr,
|
||||
" This program is free software; you can redistribute it and/or modify\n"
|
||||
" it under the terms of the GNU General Public License as published by\n"
|
||||
" the Free Software Foundation; either version 2 of the License, or\n"
|
||||
" (at your option) any later version.\n"
|
||||
"\n"
|
||||
" This program is distributed in the hope that it will be useful,\n"
|
||||
" but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
||||
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
|
||||
" GNU General Public License for more details.\n"
|
||||
"\n"
|
||||
" You should have received a copy of the GNU General Public License along\n"
|
||||
" with this program; if not, write to the Free Software Foundation, Inc.,\n"
|
||||
" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n\n"
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (optind == argc) {
|
||||
fprintf(stderr, "%s: no input file.\n", argv[0]);
|
||||
return -1;
|
||||
|
|
@ -229,6 +312,12 @@ int main(int argc, char*argv[])
|
|||
if (int rc = compile_design(design_path))
|
||||
return rc;
|
||||
|
||||
if (!have_ivl_version) {
|
||||
if (verbose_flag) vpi_mcd_printf(1, "... ");
|
||||
vpi_mcd_printf(1, "Warning: vvp input file may not be correct "
|
||||
"version!\n");
|
||||
}
|
||||
|
||||
if (verbose_flag) {
|
||||
vpi_mcd_printf(1, "Compile cleanup...\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ extern FILE*yyin;
|
|||
%token K_FORCE K_WORD
|
||||
%token K_VAR K_VAR_S K_VAR_I K_vpi_call K_vpi_func K_vpi_func_r
|
||||
%token K_disable K_fork
|
||||
%token K_vpi_module K_vpi_time_precision
|
||||
%token K_ivl_version K_vpi_module K_vpi_time_precision
|
||||
|
||||
%token <text> T_INSTR
|
||||
%token <text> T_LABEL
|
||||
|
|
@ -101,7 +101,11 @@ header_lines
|
|||
;
|
||||
|
||||
header_line
|
||||
: K_vpi_module T_STRING ';'
|
||||
: K_ivl_version T_STRING ';'
|
||||
{ verify_version($2, NULL); }
|
||||
| K_ivl_version T_STRING T_STRING';'
|
||||
{ verify_version($2, $3); }
|
||||
| K_vpi_module T_STRING ';'
|
||||
{ compile_load_vpi_module($2); }
|
||||
| K_vpi_time_precision '+' T_NUMBER ';'
|
||||
{ compile_vpi_time_precision($3); }
|
||||
|
|
|
|||
|
|
@ -31,6 +31,12 @@
|
|||
*/
|
||||
extern int compile_design(const char*path);
|
||||
|
||||
/*
|
||||
* This routine is called to check that the input file has a compatible
|
||||
* version.
|
||||
*/
|
||||
extern void verify_version(char *ivl_ver, char* commit);
|
||||
|
||||
/*
|
||||
* various functions shared by the lexor and the parser.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue