From d5be428e452af61bdf3c1d778b8db84338ef115a Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Fri, 28 Sep 2018 10:01:15 +0100 Subject: [PATCH 01/27] Fix broken links to SourceForge bug/patch trackers (GitHub issue #207). Also add link to GitHub issues, as a lot of users report bugs there. (cherry picked from commit 8df2f0cadf4b41695b99e9472dc3632062ef5e17) --- BUGS.txt | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/BUGS.txt b/BUGS.txt index 14e39b774..3d201b240 100644 --- a/BUGS.txt +++ b/BUGS.txt @@ -116,13 +116,17 @@ programs. RESEARCHING EXISTING/PAST BUGS, AND FILING REPORTS -The URL is the main -bug tracking system. Once you believe you have found a bug, you may -browse the bugs database for existing bugs that may be related to -yours. You might find that your bug has already been fixed in a later -release or snapshot. If that's the case, then you are set. Also, -consider if you are reporting a bug or really asking for a new -feature, and use the appropriate tracker. +The URL is the main +bug tracking system, although some users have reported bugs at +. Once you believe +you have found a bug, you may browse the bugs database for existing +bugs that may be related to yours. You might find that your bug has +already been fixed in a later release or snapshot. If that's the case, +then you are set. Also, consider if you are reporting a bug or really +asking for a new feature, and use the appropriate tracker. + + system (although you will also find bug rep + The bug database supports basic keyword searches, and you can optionally limit your search to active bugs, or fixed bugs. You may @@ -145,7 +149,7 @@ version from git. Please see the developer documentation for more detailed instructions -- . When you make a patch, submit it to the "Patches" tracker at -. Patches added to +. Patches added to the "Patches" tracker enter the developer workflow, are checked, applied to the appropriate git branch, and are pushed. Then the tracker item is closed. @@ -158,7 +162,7 @@ clarification before applying it.) COPYRIGHT ISSUES -Icarus Verilog is Copyright (c) 1998-2008 Stephen Williams except +Icarus Verilog is Copyright (c) 1998-2018 Stephen Williams except where otherwise noted. Minor patches are covered as derivative works (or editorial comment or whatever the appropriate legal term is) and folded into the rest of ivl. However, if a submission can reasonably From 5474f9d5acb0a71f26c3c25a5fb2f141cc6b90e5 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 29 Sep 2018 21:22:17 +0100 Subject: [PATCH 02/27] Allow %c format to output null characters (GitHub issue #209) Currently $display et al. output nothing when the expression corresponding to a %c format specification has the value 0. As Verilog provides no other way to write raw bytes to a file, we should allow 0 values to be written. Other simulators allow this. (cherry picked from commit b066a5815e3a96538658fd31fab7f70e1cb677f1) --- vpi/sys_display.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/vpi/sys_display.c b/vpi/sys_display.c index 30200d85a..6c2db71b0 100644 --- a/vpi/sys_display.c +++ b/vpi/sys_display.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2017 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -414,23 +414,23 @@ static unsigned int get_format_char(char **rtn, int ljust, int plus, } else { char ch = value.value.str[strlen(value.value.str)-1]; - /* If the default buffer is too small, make it big enough. */ - size = width + 1; - if (size > ini_size) result = realloc(result, size*sizeof(char)); - /* If the width is less than one then use a width of one. */ if (width < 1) width = 1; + size = width + 1; + assert(size <= ini_size); + if (ljust == 0) { if (width > 1) { - char *cp = malloc((width+1)*sizeof(char)); - memset(cp, (ld_zero == 1 ? '0': ' '), width-1); - cp[width-1] = ch; - cp[width] = '\0'; - sprintf(result, "%*s", width, cp); - free(cp); - } else sprintf(result, "%c", ch); - } else sprintf(result, "%-*c", width, ch); - size = strlen(result) + 1; + memset(result, (ld_zero == 1 ? '0': ' '), width-1); + } + result[width-1] = ch; + } else { + result[0] = ch; + if (width > 1) { + memset(result+1, ' ', width-1); + } + } + result[width] = '\0'; } } break; From 16c18eda2e59b6f2eef7bd9c7def99dfe5d2ddf4 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 29 Sep 2018 08:53:32 +0100 Subject: [PATCH 03/27] Further fixes for const-correctness. - allow ICARUS_VPI_CONST to be pre-defined by the user - use it for sizetf as well as for compiletf and calltf - fix remaining warnings when it is defined as 'const' (cherry picked from commit 0d494da702a8c481f0d0f7b2b411e5b76d50d629) --- libveriuser/veriusertfs.c | 12 ++++++------ vpi/sys_convert.c | 7 +++---- vpi/sys_random.c | 4 ++-- vpi/sys_scanf.c | 28 ++++++++++++++-------------- vpi/v2009_enum.c | 6 +++--- vpi/vams_simparam.c | 4 ++-- vpi_user.h | 8 +++++--- 7 files changed, 35 insertions(+), 34 deletions(-) diff --git a/libveriuser/veriusertfs.c b/libveriuser/veriusertfs.c index 979b2b5d3..3c455b800 100644 --- a/libveriuser/veriusertfs.c +++ b/libveriuser/veriusertfs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2014 Michael Ruff (mruff at chiaro.com) + * Copyright (c) 2002-2018 Michael Ruff (mruff at chiaro.com) * Michael Runyan (mrunyan at chiaro.com) * * This source code is free software; you can redistribute it @@ -42,8 +42,8 @@ typedef struct t_pli_data { int paramvc; /* parameter number for misctf */ } s_pli_data, *p_pli_data; -static PLI_INT32 compiletf(char *); -static PLI_INT32 calltf(char *); +static PLI_INT32 compiletf(ICARUS_VPI_CONST PLI_BYTE8 *); +static PLI_INT32 calltf(ICARUS_VPI_CONST PLI_BYTE8 *); static PLI_INT32 callback(p_cb_data); /* @@ -150,7 +150,7 @@ void veriusertfs_register_table(p_tfcell vtable) tf_data.tfname = tf->tfname; tf_data.compiletf = compiletf; tf_data.calltf = calltf; - tf_data.sizetf = (PLI_INT32 (*)(PLI_BYTE8 *))tf->sizetf; + tf_data.sizetf = (PLI_INT32 (*)(ICARUS_VPI_CONST PLI_BYTE8 *))tf->sizetf; tf_data.user_data = (char *)data; if (pli_trace) { @@ -180,7 +180,7 @@ void veriusertfs_register_table(p_tfcell vtable) * This function calls the veriusertfs checktf and sets up all the * callbacks misctf requires. */ -static PLI_INT32 compiletf(char *data) +static PLI_INT32 compiletf(ICARUS_VPI_CONST PLI_BYTE8*data) { p_pli_data pli; p_tfcell tf; @@ -260,7 +260,7 @@ static PLI_INT32 compiletf(char *data) /* * This function is the wrapper for the veriusertfs calltf routine. */ -static PLI_INT32 calltf(char *data) +static PLI_INT32 calltf(ICARUS_VPI_CONST PLI_BYTE8*data) { int rc = 0; p_pli_data pli; diff --git a/vpi/sys_convert.c b/vpi/sys_convert.c index 389e3c764..8f78fec5a 100644 --- a/vpi/sys_convert.c +++ b/vpi/sys_convert.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2014 Michael Ruff (mruff at chiaro.com) + * Copyright (c) 2003-2018 Michael Ruff (mruff at chiaro.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -90,12 +90,12 @@ static void error_message(vpiHandle callh, const char* msg) vpi_control(vpiFinish, 1); } -static PLI_INT32 sizetf_32 (PLI_BYTE8*name) +static PLI_INT32 sizetf_32 (ICARUS_VPI_CONST PLI_BYTE8*name) { (void)name; /* Parameter is not used. */ return 32; } -static PLI_INT32 sizetf_64 (PLI_BYTE8*name) +static PLI_INT32 sizetf_64 (ICARUS_VPI_CONST PLI_BYTE8*name) { (void)name; /* Parameter is not used. */ return 64; @@ -288,4 +288,3 @@ void sys_convert_register(void) res = vpi_register_systf(&tf_data); vpip_make_systf_system_defined(res); } - diff --git a/vpi/sys_random.c b/vpi/sys_random.c index f774764a6..72bb1c66f 100644 --- a/vpi/sys_random.c +++ b/vpi/sys_random.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2014 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -924,7 +924,7 @@ static PLI_INT32 sys_dist_erlang_calltf(ICARUS_VPI_CONST PLI_BYTE8 *name) return 0; } -static PLI_INT32 sys_rand_func_sizetf(PLI_BYTE8 *name) +static PLI_INT32 sys_rand_func_sizetf(ICARUS_VPI_CONST PLI_BYTE8 *name) { (void)name; /* Parameter is not used. */ return 32; diff --git a/vpi/sys_scanf.c b/vpi/sys_scanf.c index 2e86cae2d..de567eba6 100644 --- a/vpi/sys_scanf.c +++ b/vpi/sys_scanf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2015 Stephen Williams (steve@icarus.com) + * Copyright (c) 2006-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -219,7 +219,7 @@ static double get_float(struct byte_source *src, unsigned width, int *match) */ static int scan_format_float(vpiHandle callh, vpiHandle argv, struct byte_source *src, unsigned width, - unsigned suppress_flag, PLI_BYTE8 *name, + unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name, char code) { vpiHandle arg; @@ -266,7 +266,7 @@ static int scan_format_float(vpiHandle callh, vpiHandle argv, */ static int scan_format_float_time(vpiHandle callh, vpiHandle argv, struct byte_source*src, unsigned width, - unsigned suppress_flag, PLI_BYTE8 *name) + unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name) { vpiHandle scope = vpi_handle(vpiScope, callh); int time_units = vpi_get(vpiTimeUnit, scope); @@ -330,7 +330,7 @@ static int scan_format_float_time(vpiHandle callh, vpiHandle argv, */ static int scan_format_base(vpiHandle callh, vpiHandle argv, struct byte_source *src, unsigned width, - unsigned suppress_flag, PLI_BYTE8 *name, + unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name, const char *match, char code, PLI_INT32 type) { @@ -406,7 +406,7 @@ static int scan_format_base(vpiHandle callh, vpiHandle argv, */ static int scan_format_binary(vpiHandle callh, vpiHandle argv, struct byte_source *src, int width, - unsigned suppress_flag, PLI_BYTE8 *name) + unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name) { return scan_format_base(callh, argv, src, width, suppress_flag, name, "01xzXZ?_", 'b', vpiBinStrVal); @@ -420,7 +420,7 @@ static int scan_format_binary(vpiHandle callh, vpiHandle argv, */ static int scan_format_char(vpiHandle callh, vpiHandle argv, struct byte_source *src, unsigned width, - unsigned suppress_flag, PLI_BYTE8 *name) + unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name) { vpiHandle arg; s_vpi_value val; @@ -466,7 +466,7 @@ static int scan_format_char(vpiHandle callh, vpiHandle argv, */ static int scan_format_decimal(vpiHandle callh, vpiHandle argv, struct byte_source *src, unsigned width, - unsigned suppress_flag, PLI_BYTE8 *name) + unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name) { vpiHandle arg; char *strval = malloc(1); @@ -585,7 +585,7 @@ static int scan_format_decimal(vpiHandle callh, vpiHandle argv, */ static int scan_format_hex(vpiHandle callh, vpiHandle argv, struct byte_source *src, unsigned width, - unsigned suppress_flag, PLI_BYTE8 *name) + unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name) { return scan_format_base(callh, argv, src, width, suppress_flag, name, "0123456789abcdefxzABCDEFXZ?_", 'h', @@ -597,7 +597,7 @@ static int scan_format_hex(vpiHandle callh, vpiHandle argv, */ static int scan_format_octal(vpiHandle callh, vpiHandle argv, struct byte_source *src, unsigned width, - unsigned suppress_flag, PLI_BYTE8 *name) + unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name) { return scan_format_base(callh, argv, src, width, suppress_flag, name, "01234567xzXZ?_", 'o', vpiOctStrVal); @@ -608,7 +608,7 @@ static int scan_format_octal(vpiHandle callh, vpiHandle argv, * Routine to return the current hierarchical path (implements %m). */ static int scan_format_module_path(vpiHandle callh, vpiHandle argv, - unsigned suppress_flag, PLI_BYTE8 *name) + unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name) { vpiHandle scope, arg; char *module_path; @@ -650,7 +650,7 @@ static int scan_format_module_path(vpiHandle callh, vpiHandle argv, */ static int scan_format_string(vpiHandle callh, vpiHandle argv, struct byte_source *src, unsigned width, - unsigned suppress_flag, PLI_BYTE8 *name) + unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name) { vpiHandle arg; char *strval = malloc(1); @@ -729,7 +729,7 @@ static int scan_format_string(vpiHandle callh, vpiHandle argv, */ static int scan_format_two_state(vpiHandle callh, vpiHandle argv, struct byte_source *src, unsigned width, - unsigned suppress_flag, PLI_BYTE8 *name) + unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name) { vpiHandle arg; p_vpi_vecval val_ptr; @@ -868,7 +868,7 @@ static int scan_format_two_state(vpiHandle callh, vpiHandle argv, */ static int scan_format_four_state(vpiHandle callh, vpiHandle argv, struct byte_source *src, unsigned width, - unsigned suppress_flag, PLI_BYTE8 *name) + unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name) { vpiHandle arg; p_vpi_vecval val_ptr; @@ -1006,7 +1006,7 @@ static int scan_format_four_state(vpiHandle callh, vpiHandle argv, * passed to this function, which processes the rest of the function. */ static int scan_format(vpiHandle callh, struct byte_source*src, vpiHandle argv, - PLI_BYTE8 *name) + ICARUS_VPI_CONST PLI_BYTE8 *name) { s_vpi_value val; vpiHandle item; diff --git a/vpi/v2009_enum.c b/vpi/v2009_enum.c index be9aaa9fa..a8983e28a 100644 --- a/vpi/v2009_enum.c +++ b/vpi/v2009_enum.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2014 Stephen Williams (steve@icarus.com) + * Copyright (c) 2010-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -226,7 +226,7 @@ static void fill_handle_with_init(vpiHandle arg, int is_two_state) /* * Implement the next()/prev() enumeration methods. */ -static PLI_INT32 ivl_enum_method_next_prev_calltf(PLI_BYTE8*name) +static PLI_INT32 ivl_enum_method_next_prev_calltf(ICARUS_VPI_CONST PLI_BYTE8*name) { vpiHandle sys = vpi_handle(vpiSysTfCall, 0); vpiHandle argv = vpi_iterate(vpiArgument, sys); @@ -431,7 +431,7 @@ static PLI_INT32 ivl_enum_method_name_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) /* * Implement the name() enumeration method. */ -static PLI_INT32 ivl_enum_method_name_calltf(PLI_BYTE8*name) +static PLI_INT32 ivl_enum_method_name_calltf(ICARUS_VPI_CONST PLI_BYTE8*name) { vpiHandle sys = vpi_handle(vpiSysTfCall, 0); vpiHandle argv = vpi_iterate(vpiArgument, sys); diff --git a/vpi/vams_simparam.c b/vpi/vams_simparam.c index 6d5e8b30d..2de9818a9 100644 --- a/vpi/vams_simparam.c +++ b/vpi/vams_simparam.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2014 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2008-2018 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -247,7 +247,7 @@ static PLI_INT32 simparam_str_calltf(ICARUS_VPI_CONST PLI_BYTE8 *name_ext) return 0; } -static PLI_INT32 simparam_str_sizetf(PLI_BYTE8 *name_ext) +static PLI_INT32 simparam_str_sizetf(ICARUS_VPI_CONST PLI_BYTE8 *name_ext) { (void) name_ext; /* Parameter is not used. */ return MAX_STRING_RESULT; /* 128 characters max! */ diff --git a/vpi_user.h b/vpi_user.h index 8fb8b12d8..db0a9bd5f 100644 --- a/vpi_user.h +++ b/vpi_user.h @@ -1,7 +1,7 @@ #ifndef VPI_USER_H #define VPI_USER_H /* - * Copyright (c) 1999-2014 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -46,7 +46,9 @@ EXTERN_C_START # include # include "_pli_types.h" +#ifndef ICARUS_VPI_CONST #define ICARUS_VPI_CONST +#endif #ifdef __cplusplus typedef class __vpiHandle *vpiHandle; #else @@ -63,7 +65,7 @@ typedef struct t_vpi_systf_data { const char *tfname; PLI_INT32 (*calltf) (ICARUS_VPI_CONST PLI_BYTE8*); PLI_INT32 (*compiletf)(ICARUS_VPI_CONST PLI_BYTE8*); - PLI_INT32 (*sizetf) (PLI_BYTE8*); + PLI_INT32 (*sizetf) (ICARUS_VPI_CONST PLI_BYTE8*); ICARUS_VPI_CONST PLI_BYTE8 *user_data; } s_vpi_systf_data, *p_vpi_systf_data; @@ -466,7 +468,7 @@ typedef struct t_cb_data { p_vpi_time time; p_vpi_value value; PLI_INT32 index; - char *user_data; + ICARUS_VPI_CONST PLI_BYTE8 *user_data; } s_cb_data, *p_cb_data; #define cbValueChange 1 From dc6fc7ee773df8c726b4ae10589a91d9eb89398d Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 6 Oct 2018 11:48:19 +0100 Subject: [PATCH 04/27] Enable checks for VPI const-correctness. Note we only want these enabled when building the compiler and runtime binaries. If we included the ICARUS_VPI_CONST definition in the global CPP_FLAGS, that would propagate to the flags used by iverilog-vpi, so would affect compilation of user VPI code. (cherry picked from commit 542fe2cf77f0e99032f75b8c651156b41da338f7) --- libveriuser/Makefile.in | 2 +- vpi/Makefile.in | 2 +- vvp/Makefile.in | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libveriuser/Makefile.in b/libveriuser/Makefile.in index 868f3e257..a91833fb4 100644 --- a/libveriuser/Makefile.in +++ b/libveriuser/Makefile.in @@ -47,7 +47,7 @@ LDRELOCFLAGS = @LDRELOCFLAGS@ LDTARGETFLAGS = @LDTARGETFLAGS@ -CPPFLAGS = $(INCLUDE_PATH) @CPPFLAGS@ @DEFS@ @PICFLAG@ +CPPFLAGS = $(INCLUDE_PATH) @CPPFLAGS@ @DEFS@ -DICARUS_VPI_CONST=const @PICFLAG@ CFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CC@ @CFLAGS@ A = a_close.o a_compare_handles.o a_configure.o a_fetch_argc.o \ diff --git a/vpi/Makefile.in b/vpi/Makefile.in index 30e537784..1f8fbd0aa 100644 --- a/vpi/Makefile.in +++ b/vpi/Makefile.in @@ -45,7 +45,7 @@ else INCLUDE_PATH = -I. -I.. -I$(srcdir) -I$(srcdir)/.. endif -CPPFLAGS = $(INCLUDE_PATH) @file64_support@ @CPPFLAGS@ @DEFS@ @PICFLAG@ +CPPFLAGS = $(INCLUDE_PATH) @file64_support@ @CPPFLAGS@ @DEFS@ -DICARUS_VPI_CONST=const @PICFLAG@ CFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CC@ @CFLAGS@ CXXFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CXX@ @CXXFLAGS@ LDFLAGS = @LDFLAGS@ diff --git a/vvp/Makefile.in b/vvp/Makefile.in index 35750f69d..df5fcb6bd 100644 --- a/vvp/Makefile.in +++ b/vvp/Makefile.in @@ -55,7 +55,7 @@ else INCLUDE_PATH = -I. -I.. -I$(srcdir) -I$(srcdir)/.. endif -CPPFLAGS = $(INCLUDE_PATH) @CPPFLAGS@ @DEFS@ +CPPFLAGS = $(INCLUDE_PATH) @CPPFLAGS@ @DEFS@ -DICARUS_VPI_CONST=const CFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CC@ @CFLAGS@ CXXFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CXX@ @CXXFLAGS@ LDFLAGS = @rdynamic@ @LDFLAGS@ From f2a711b8f12cf47dc33640aafab214588bdd2437 Mon Sep 17 00:00:00 2001 From: Cary R Date: Sat, 6 Oct 2018 09:24:31 -0700 Subject: [PATCH 05/27] Update to latest GTKWAve files --- vpi/fstapi.c | 280 +++++++++++++++++++++++------------------------ vpi/lxt2_write.c | 22 ++-- vpi/lxt2_write.h | 3 +- vpi/lz4.c | 3 + vpi/wavealloca.h | 23 +++- 5 files changed, 174 insertions(+), 157 deletions(-) diff --git a/vpi/fstapi.c b/vpi/fstapi.c index 386d6705e..13342fa7d 100644 --- a/vpi/fstapi.c +++ b/vpi/fstapi.c @@ -283,7 +283,7 @@ static char *fstRealpath(const char *path, char *resolved_path) #if (defined(__MACH__) && defined(__APPLE__)) if(!resolved_path) { - resolved_path = malloc(PATH_MAX+1); /* fixes bug on Leopard when resolved_path == NULL */ + resolved_path = (unsigned char *)malloc(PATH_MAX+1); /* fixes bug on Leopard when resolved_path == NULL */ } #endif @@ -293,7 +293,7 @@ return(realpath(path, resolved_path)); #ifdef __MINGW32__ if(!resolved_path) { - resolved_path = malloc(PATH_MAX+1); + resolved_path = (unsigned char *)malloc(PATH_MAX+1); } return(_fullpath(resolved_path, path, PATH_MAX)); #else @@ -317,7 +317,7 @@ static void *fstMmap2(size_t __len, int __fd, off_t __off) { (void)__off; -unsigned char *pnt = malloc(__len); +unsigned char *pnt = (unsigned char *)malloc(__len); off_t cur_offs = lseek(__fd, 0, SEEK_CUR); size_t i; @@ -804,7 +804,7 @@ if(rc<0) { xc->fseek_failed = 1; #ifdef FST_DEBUG - fprintf(stderr, FST_APIMESS"Seek to #%"PRId64" (whence = %d) failed!\n", offset, whence); + fprintf(stderr, FST_APIMESS"Seek to #%" PRId64 " (whence = %d) failed!\n", offset, whence); perror("Why"); #endif } @@ -970,12 +970,12 @@ fflush(xc->handle); if(!xc->valpos_mem) { fflush(xc->valpos_handle); - xc->valpos_mem = fstMmap(NULL, xc->maxhandle * 4 * sizeof(uint32_t), PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->valpos_handle), 0); + xc->valpos_mem = (uint32_t *)fstMmap(NULL, xc->maxhandle * 4 * sizeof(uint32_t), PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->valpos_handle), 0); } if(!xc->curval_mem) { fflush(xc->curval_handle); - xc->curval_mem = fstMmap(NULL, xc->maxvalpos, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->curval_handle), 0); + xc->curval_mem = (unsigned char *)fstMmap(NULL, xc->maxvalpos, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->curval_handle), 0); } } @@ -1106,7 +1106,7 @@ xc->next_huge_break = FST_ACTIVATE_HUGE_BREAK; */ void *fstWriterCreate(const char *nam, int use_compressed_hier) { -struct fstWriterContext *xc = calloc(1, sizeof(struct fstWriterContext)); +struct fstWriterContext *xc = (struct fstWriterContext *)calloc(1, sizeof(struct fstWriterContext)); xc->compress_hier = use_compressed_hier; fstDetermineBreakSize(xc); @@ -1120,7 +1120,7 @@ if((!nam)|| else { int flen = strlen(nam); - char *hf = calloc(1, flen + 6); + char *hf = (char *)calloc(1, flen + 6); memcpy(hf, nam, flen); strcpy(hf + flen, ".hier"); @@ -1131,7 +1131,7 @@ if((!nam)|| xc->curval_handle = tmpfile_open(&xc->curval_handle_nam); /* .bits */ xc->tchn_handle = tmpfile_open(&xc->tchn_handle_nam); /* .tchn */ xc->vchg_alloc_siz = xc->fst_break_size + xc->fst_break_add_size; - xc->vchg_mem = malloc(xc->vchg_alloc_siz); + xc->vchg_mem = (unsigned char *)malloc(xc->vchg_alloc_siz); if(xc->hier_handle && xc->geom_handle && xc->valpos_handle && xc->curval_handle && xc->vchg_mem && xc->tchn_handle) { @@ -1180,7 +1180,7 @@ if(xc) int rc; destlen = xc->maxvalpos; - dmem = malloc(compressBound(destlen)); + dmem = (unsigned char *)malloc(compressBound(destlen)); rc = compress2(dmem, &destlen, xc->curval_mem, xc->maxvalpos, 4); /* was 9...which caused performance drag on traces with many signals */ fputc(FST_BL_SKIP, xc->handle); /* temporarily tag the section, use FST_BL_VCDATA on finalize */ @@ -1269,7 +1269,7 @@ if((xc->vchg_siz <= 1)||(xc->already_in_flush)) return; xc->already_in_flush = 1; /* should really do this with a semaphore */ xc->section_header_only = 0; -scratchpad = malloc(xc->vchg_siz); +scratchpad = (unsigned char *)malloc(xc->vchg_siz); vchg_mem = xc->vchg_mem; @@ -1279,7 +1279,7 @@ fputc(xc->fourpack ? '4' : (xc->fastpack ? 'F' : 'Z'), f); fpos = 1; packmemlen = 1024; /* maintain a running "longest" allocation to */ -packmem = malloc(packmemlen); /* prevent continual malloc...free every loop iter */ +packmem = (unsigned char *)malloc(packmemlen); /* prevent continual malloc...free every loop iter */ for(i=0;imaxhandle;i++) { @@ -1399,13 +1399,13 @@ for(i=0;imaxhandle;i++) idx = ((vm4ip[1]+7) & ~7); switch(vm4ip[1] & 7) { - case 0: do { acc = (pnt[idx+7-8] & 1) << 0; - case 7: acc |= (pnt[idx+6-8] & 1) << 1; - case 6: acc |= (pnt[idx+5-8] & 1) << 2; - case 5: acc |= (pnt[idx+4-8] & 1) << 3; - case 4: acc |= (pnt[idx+3-8] & 1) << 4; - case 3: acc |= (pnt[idx+2-8] & 1) << 5; - case 2: acc |= (pnt[idx+1-8] & 1) << 6; + case 0: do { acc = (pnt[idx+7-8] & 1) << 0; /* fallthrough */ + case 7: acc |= (pnt[idx+6-8] & 1) << 1; /* fallthrough */ + case 6: acc |= (pnt[idx+5-8] & 1) << 2; /* fallthrough */ + case 5: acc |= (pnt[idx+4-8] & 1) << 3; /* fallthrough */ + case 4: acc |= (pnt[idx+3-8] & 1) << 4; /* fallthrough */ + case 3: acc |= (pnt[idx+2-8] & 1) << 5; /* fallthrough */ + case 2: acc |= (pnt[idx+1-8] & 1) << 6; /* fallthrough */ case 1: acc |= (pnt[idx+0-8] & 1) << 7; *(--scratchpnt) = acc; idx -= 8; @@ -1441,7 +1441,7 @@ for(i=0;imaxhandle;i++) else { free(packmem); - dmem = packmem = malloc(compressBound(packmemlen = wrlen)); + dmem = packmem = (unsigned char *)malloc(compressBound(packmemlen = wrlen)); } rc = compress2(dmem, &destlen, scratchpnt, wrlen, 4); @@ -1496,7 +1496,7 @@ for(i=0;imaxhandle;i++) else { free(packmem); - dmem = packmem = malloc(packmemlen = (wrlen * 2) + 2); + dmem = packmem = (unsigned char *)malloc(packmemlen = (wrlen * 2) + 2); } rc = (xc->fourpack) ? LZ4_compress((char *)scratchpnt, (char *)dmem, wrlen) : fastlz_compress(scratchpnt, wrlen, dmem); @@ -1678,11 +1678,11 @@ fflush(xc->tchn_handle); tlen = ftello(xc->tchn_handle); fstWriterFseeko(xc, xc->tchn_handle, 0, SEEK_SET); -tmem = fstMmap(NULL, tlen, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->tchn_handle), 0); +tmem = (unsigned char *)fstMmap(NULL, tlen, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->tchn_handle), 0); if(tmem) { unsigned long destlen = tlen; - unsigned char *dmem = malloc(compressBound(destlen)); + unsigned char *dmem = (unsigned char *)malloc(compressBound(destlen)); int rc = compress2(dmem, &destlen, tmem, tlen, 9); if((rc == Z_OK) && (((off_t)destlen) < tlen)) @@ -1781,7 +1781,7 @@ struct fstWriterContext *xc = (struct fstWriterContext *)ctx; if(xc->parallel_enabled) { - struct fstWriterContext *xc2 = malloc(sizeof(struct fstWriterContext)); + struct fstWriterContext *xc2 = (struct fstWriterContext *)malloc(sizeof(struct fstWriterContext)); unsigned int i; pthread_mutex_lock(&xc->mutex); @@ -1790,16 +1790,16 @@ if(xc->parallel_enabled) xc->xc_parent = xc; memcpy(xc2, xc, sizeof(struct fstWriterContext)); - xc2->valpos_mem = malloc(xc->maxhandle * 4 * sizeof(uint32_t)); + xc2->valpos_mem = (uint32_t *)malloc(xc->maxhandle * 4 * sizeof(uint32_t)); memcpy(xc2->valpos_mem, xc->valpos_mem, xc->maxhandle * 4 * sizeof(uint32_t)); /* curval mem is updated in the thread */ #ifdef FST_REMOVE_DUPLICATE_VC - xc2->curval_mem = malloc(xc->maxvalpos); + xc2->curval_mem = (unsigned char *)malloc(xc->maxvalpos); memcpy(xc2->curval_mem, xc->curval_mem, xc->maxvalpos); #endif - xc->vchg_mem = malloc(xc->vchg_alloc_siz); + xc->vchg_mem = (unsigned char *)malloc(xc->vchg_alloc_siz); xc->vchg_mem[0] = '!'; xc->vchg_siz = 1; @@ -1908,11 +1908,11 @@ if(xc && !xc->already_in_close && !xc->already_in_flush) /* write out geom section */ fflush(xc->geom_handle); tlen = ftello(xc->geom_handle); - tmem = fstMmap(NULL, tlen, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->geom_handle), 0); + tmem = (unsigned char *)fstMmap(NULL, tlen, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->geom_handle), 0); if(tmem) { unsigned long destlen = tlen; - unsigned char *dmem = malloc(compressBound(destlen)); + unsigned char *dmem = (unsigned char *)malloc(compressBound(destlen)); int rc = compress2(dmem, &destlen, tmem, tlen, 9); if((rc != Z_OK) || (((off_t)destlen) > tlen)) @@ -1980,7 +1980,7 @@ if(xc && !xc->already_in_close && !xc->already_in_flush) int zfd; int fourpack_duo = 0; #ifndef __MINGW32__ - char *fnam = malloc(strlen(xc->filename) + 5 + 1); + char *fnam = (char *)malloc(strlen(xc->filename) + 5 + 1); #endif fixup_offs = ftello(xc->handle); @@ -1991,7 +1991,7 @@ if(xc && !xc->already_in_close && !xc->already_in_flush) if(!xc->fourpack) { - unsigned char *mem = malloc(FST_GZIO_LEN); + unsigned char *mem = (unsigned char *)malloc(FST_GZIO_LEN); zfd = dup(fileno(xc->handle)); fflush(xc->handle); zhandle = gzdopen(zfd, "wb4"); @@ -2022,8 +2022,8 @@ if(xc && !xc->already_in_close && !xc->already_in_flush) fflush(xc->handle); lz4_maxlen = LZ4_compressBound(xc->hier_file_len); - mem = malloc(lz4_maxlen); - hmem = fstMmap(NULL, xc->hier_file_len, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->hier_handle), 0); + mem = (unsigned char *)malloc(lz4_maxlen); + hmem = (unsigned char *)fstMmap(NULL, xc->hier_file_len, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->hier_handle), 0); packed_len = LZ4_compress((char *)hmem, (char *)mem, xc->hier_file_len); fstMunmap(hmem, xc->hier_file_len); @@ -2036,7 +2036,7 @@ if(xc && !xc->already_in_close && !xc->already_in_flush) int packed_len_duo; lz4_maxlen_duo = LZ4_compressBound(packed_len); - mem_duo = malloc(lz4_maxlen_duo); + mem_duo = (unsigned char *)malloc(lz4_maxlen_duo); packed_len_duo = LZ4_compress((char *)mem, (char *)mem_duo, packed_len); fstWriterVarint(xc->handle, packed_len); /* 1st round compressed length */ @@ -2096,7 +2096,7 @@ if(xc && !xc->already_in_close && !xc->already_in_flush) FILE *fp; off_t offpnt, uclen; int flen = strlen(xc->filename); - char *hf = calloc(1, flen + 5); + char *hf = (char *)calloc(1, flen + 5); strcpy(hf, xc->filename); strcpy(hf+flen, ".pak"); @@ -2104,7 +2104,7 @@ if(xc && !xc->already_in_close && !xc->already_in_flush) if(fp) { - void *dsth; + gzFile dsth; int zfd; char gz_membuf[FST_GZIO_LEN]; @@ -2586,7 +2586,7 @@ if(xc && nam) xc->vchg_alloc_siz = xc->fst_break_size + xc->fst_break_add_size; if(xc->vchg_mem) { - xc->vchg_mem = realloc(xc->vchg_mem, xc->vchg_alloc_siz); + xc->vchg_mem = (unsigned char *)realloc(xc->vchg_mem, xc->vchg_alloc_siz); } } } @@ -2758,7 +2758,7 @@ if((xc) && (handle <= xc->maxhandle)) if((fpos + len + 10) > xc->vchg_alloc_siz) { xc->vchg_alloc_siz += (xc->fst_break_add_size + len); /* +len added in the case of extremely long vectors and small break add sizes */ - xc->vchg_mem = realloc(xc->vchg_mem, xc->vchg_alloc_siz); + xc->vchg_mem = (unsigned char *)realloc(xc->vchg_mem, xc->vchg_alloc_siz); if(!xc->vchg_mem) { fprintf(stderr, FST_APIMESS"Could not realloc() in fstWriterEmitValueChange, exiting.\n"); @@ -2872,7 +2872,7 @@ if((xc) && (handle <= xc->maxhandle)) if((fpos + len + 10 + 5) > xc->vchg_alloc_siz) { xc->vchg_alloc_siz += (xc->fst_break_add_size + len + 5); /* +len added in the case of extremely long vectors and small break add sizes */ - xc->vchg_mem = realloc(xc->vchg_mem, xc->vchg_alloc_siz); + xc->vchg_mem = (unsigned char *)realloc(xc->vchg_mem, xc->vchg_alloc_siz); if(!xc->vchg_mem) { fprintf(stderr, FST_APIMESS"Could not realloc() in fstWriterEmitVariableLengthValueChange, exiting.\n"); @@ -2949,7 +2949,7 @@ struct fstWriterContext *xc = (struct fstWriterContext *)ctx; if(xc) { - struct fstBlackoutChain *b = calloc(1, sizeof(struct fstBlackoutChain)); + struct fstBlackoutChain *b = (struct fstBlackoutChain *)calloc(1, sizeof(struct fstBlackoutChain)); b->tim = xc->curtime; b->active = (enable != 0); @@ -3120,7 +3120,7 @@ if(rc<0) { xc->fseek_failed = 1; #ifdef FST_DEBUG - fprintf(stderr, FST_APIMESS"Seek to #%"PRId64" (whence = %d) failed!\n", offset, whence); + fprintf(stderr, FST_APIMESS"Seek to #%" PRId64 " (whence = %d) failed!\n", offset, whence); perror("Why"); #endif } @@ -3248,12 +3248,12 @@ const char *fstReaderPushScope(void *ctx, const char *nam, void *user_info) struct fstReaderContext *xc = (struct fstReaderContext *)ctx; if(xc) { - struct fstCurrHier *ch = malloc(sizeof(struct fstCurrHier)); + struct fstCurrHier *ch = (struct fstCurrHier *)malloc(sizeof(struct fstCurrHier)); int chl = xc->curr_hier ? xc->curr_hier->len : 0; int len = chl + 1 + strlen(nam); if(len >= xc->flat_hier_alloc_len) { - xc->curr_flat_hier_nam = xc->curr_flat_hier_nam ? realloc(xc->curr_flat_hier_nam, len+1) : malloc(len+1); + xc->curr_flat_hier_nam = xc->curr_flat_hier_nam ? (char *)realloc(xc->curr_flat_hier_nam, len+1) : (char *)malloc(len+1); } if(chl) @@ -3473,7 +3473,7 @@ return(xc ? xc->date : NULL); int fstReaderGetFileType(void *ctx) { struct fstReaderContext *xc = (struct fstReaderContext *)ctx; -return(xc ? xc->filetype : FST_FT_VERILOG); +return(xc ? (int)xc->filetype : (int)FST_FT_VERILOG); } @@ -3606,8 +3606,8 @@ int pass_status = 1; if(!xc->fh) { off_t offs_cache = ftello(xc->f); - char *fnam = malloc(strlen(xc->filename) + 6 + 16 + 32 + 1); - unsigned char *mem = malloc(FST_GZIO_LEN); + char *fnam = (char *)malloc(strlen(xc->filename) + 6 + 16 + 32 + 1); + unsigned char *mem = (unsigned char *)malloc(FST_GZIO_LEN); off_t hl, uclen; off_t clen = 0; gzFile zhandle = NULL; @@ -3704,8 +3704,8 @@ if(!xc->fh) else if(htyp == FST_BL_HIER_LZ4DUO) { - unsigned char *lz4_cmem = malloc(clen); - unsigned char *lz4_ucmem = malloc(uclen); + unsigned char *lz4_cmem = (unsigned char *)malloc(clen); + unsigned char *lz4_ucmem = (unsigned char *)malloc(uclen); unsigned char *lz4_ucmem2; uint64_t uclen2; int skiplen2 = 0; @@ -3713,7 +3713,7 @@ if(!xc->fh) fstFread(lz4_cmem, clen, 1, xc->f); uclen2 = fstGetVarint64(lz4_cmem, &skiplen2); - lz4_ucmem2 = malloc(uclen2); + lz4_ucmem2 = (unsigned char *)malloc(uclen2); pass_status = (uclen2 == (uint64_t)LZ4_decompress_safe_partial ((char *)lz4_cmem + skiplen2, (char *)lz4_ucmem2, clen - skiplen2, uclen2, uclen2)); if(pass_status) { @@ -3732,8 +3732,8 @@ if(!xc->fh) else if(htyp == FST_BL_HIER_LZ4) { - unsigned char *lz4_cmem = malloc(clen); - unsigned char *lz4_ucmem = malloc(uclen); + unsigned char *lz4_cmem = (unsigned char *)malloc(clen); + unsigned char *lz4_ucmem = (unsigned char *)malloc(uclen); fstFread(lz4_cmem, clen, 1, xc->f); pass_status = (uclen == LZ4_decompress_safe_partial ((char *)lz4_cmem, (char *)lz4_ucmem, clen, uclen, uclen)); @@ -3970,7 +3970,7 @@ if(!xc->fh) } } -str = malloc(FST_ID_NAM_ATTR_SIZ+1); +str = (char *)malloc(FST_ID_NAM_ATTR_SIZ+1); if(fv) { @@ -3979,40 +3979,40 @@ if(fv) fprintf(fv, "$date\n\t%s\n$end\n", xc->date); fprintf(fv, "$version\n\t%s\n$end\n", xc->version); - if(xc->timezero) fprintf(fv, "$timezero\n\t%"PRId64"\n$end\n", xc->timezero); + if(xc->timezero) fprintf(fv, "$timezero\n\t%" PRId64 "\n$end\n", xc->timezero); switch(xc->timescale) { case 2: time_scale = 100; time_dimension[0] = 0; break; - case 1: time_scale = 10; + case 1: time_scale = 10; /* fallthrough */ case 0: time_dimension[0] = 0; break; case -1: time_scale = 100; time_dimension[0] = 'm'; break; - case -2: time_scale = 10; + case -2: time_scale = 10; /* fallthrough */ case -3: time_dimension[0] = 'm'; break; case -4: time_scale = 100; time_dimension[0] = 'u'; break; - case -5: time_scale = 10; + case -5: time_scale = 10; /* fallthrough */ case -6: time_dimension[0] = 'u'; break; case -10: time_scale = 100; time_dimension[0] = 'p'; break; - case -11: time_scale = 10; + case -11: time_scale = 10; /* fallthrough */ case -12: time_dimension[0] = 'p'; break; case -13: time_scale = 100; time_dimension[0] = 'f'; break; - case -14: time_scale = 10; + case -14: time_scale = 10; /* fallthrough */ case -15: time_dimension[0] = 'f'; break; case -16: time_scale = 100; time_dimension[0] = 'a'; break; - case -17: time_scale = 10; + case -17: time_scale = 10; /* fallthrough */ case -18: time_dimension[0] = 'a'; break; case -19: time_scale = 100; time_dimension[0] = 'z'; break; - case -20: time_scale = 10; + case -20: time_scale = 10; /* fallthrough */ case -21: time_dimension[0] = 'z'; break; case -7: time_scale = 100; time_dimension[0] = 'n'; break; - case -8: time_scale = 10; + case -8: time_scale = 10; /* fallthrough */ case -9: default: time_dimension[0] = 'n'; break; } @@ -4024,10 +4024,10 @@ xc->maxhandle = 0; xc->num_alias = 0; free(xc->signal_lens); -xc->signal_lens = malloc(num_signal_dyn*sizeof(uint32_t)); +xc->signal_lens = (uint32_t *)malloc(num_signal_dyn*sizeof(uint32_t)); free(xc->signal_typs); -xc->signal_typs = malloc(num_signal_dyn*sizeof(unsigned char)); +xc->signal_typs = (unsigned char *)malloc(num_signal_dyn*sizeof(unsigned char)); fstReaderFseeko(xc, xc->fh, 0, SEEK_SET); while(!feof(xc->fh)) @@ -4072,13 +4072,13 @@ while(!feof(xc->fh)) switch(attrtype) { case FST_AT_ARRAY: if((subtype < FST_AR_NONE) || (subtype > FST_AR_MAX)) subtype = FST_AR_NONE; - fprintf(fv, "$attrbegin %s %s %s %"PRId64" $end\n", attrtypes[attrtype], arraytypes[subtype], str, attrarg); + fprintf(fv, "$attrbegin %s %s %s %" PRId64 " $end\n", attrtypes[attrtype], arraytypes[subtype], str, attrarg); break; case FST_AT_ENUM: if((subtype < FST_EV_SV_INTEGER) || (subtype > FST_EV_MAX)) subtype = FST_EV_SV_INTEGER; - fprintf(fv, "$attrbegin %s %s %s %"PRId64" $end\n", attrtypes[attrtype], enumvaluetypes[subtype], str, attrarg); + fprintf(fv, "$attrbegin %s %s %s %" PRId64 " $end\n", attrtypes[attrtype], enumvaluetypes[subtype], str, attrarg); break; case FST_AT_PACK: if((subtype < FST_PT_NONE) || (subtype > FST_PT_MAX)) subtype = FST_PT_NONE; - fprintf(fv, "$attrbegin %s %s %s %"PRId64" $end\n", attrtypes[attrtype], packtypes[subtype], str, attrarg); + fprintf(fv, "$attrbegin %s %s %s %" PRId64 " $end\n", attrtypes[attrtype], packtypes[subtype], str, attrarg); break; case FST_AT_MISC: default: attrtype = FST_AT_MISC; @@ -4093,11 +4093,11 @@ while(!feof(xc->fh)) int sidx_skiplen_dummy = 0; uint64_t sidx = fstGetVarint64((unsigned char *)str, &sidx_skiplen_dummy); - fprintf(fv, "$attrbegin %s %02x %"PRId64" %"PRId64" $end\n", attrtypes[attrtype], subtype, sidx, attrarg); + fprintf(fv, "$attrbegin %s %02x %" PRId64 " %" PRId64 " $end\n", attrtypes[attrtype], subtype, sidx, attrarg); } else { - fprintf(fv, "$attrbegin %s %02x %s %"PRId64" $end\n", attrtypes[attrtype], subtype, str, attrarg); + fprintf(fv, "$attrbegin %s %02x %s %" PRId64 " $end\n", attrtypes[attrtype], subtype, str, attrarg); } } break; @@ -4155,8 +4155,8 @@ while(!feof(xc->fh)) if(xc->maxhandle == num_signal_dyn) { num_signal_dyn *= 2; - xc->signal_lens = realloc(xc->signal_lens, num_signal_dyn*sizeof(uint32_t)); - xc->signal_typs = realloc(xc->signal_typs, num_signal_dyn*sizeof(unsigned char)); + xc->signal_lens = (uint32_t *)realloc(xc->signal_lens, num_signal_dyn*sizeof(uint32_t)); + xc->signal_typs = (unsigned char *)realloc(xc->signal_typs, num_signal_dyn*sizeof(unsigned char)); } xc->signal_lens[xc->maxhandle] = len; xc->signal_typs[xc->maxhandle] = vartype; @@ -4177,7 +4177,7 @@ while(!feof(xc->fh)) char vcdid_buf[16]; uint32_t modlen = (vartype != FST_VT_VCD_PORT) ? len : ((len - 2) / 3); fstVcdID(vcdid_buf, xc->maxhandle+1); - fprintf(fv, "$var %s %"PRIu32" %s %s $end\n", vartypes[vartype], modlen, vcdid_buf, str); + fprintf(fv, "$var %s %" PRIu32 " %s %s $end\n", vartypes[vartype], modlen, vcdid_buf, str); } xc->maxhandle++; } @@ -4193,7 +4193,7 @@ while(!feof(xc->fh)) char vcdid_buf[16]; uint32_t modlen = (vartype != FST_VT_VCD_PORT) ? len : ((len - 2) / 3); fstVcdID(vcdid_buf, alias); - fprintf(fv, "$var %s %"PRIu32" %s %s $end\n", vartypes[vartype], modlen, vcdid_buf, str); + fprintf(fv, "$var %s %" PRIu32 " %s %s $end\n", vartypes[vartype], modlen, vcdid_buf, str); } xc->num_alias++; } @@ -4208,14 +4208,14 @@ if(fv) fprintf(fv, "$enddefinitions $end\n"); maxhandle_scanbuild = xc->maxhandle ? xc->maxhandle : 1; /*scan-build warning suppression, in reality we have at least one signal */ -xc->signal_lens = realloc(xc->signal_lens, maxhandle_scanbuild*sizeof(uint32_t)); -xc->signal_typs = realloc(xc->signal_typs, maxhandle_scanbuild*sizeof(unsigned char)); +xc->signal_lens = (uint32_t *)realloc(xc->signal_lens, maxhandle_scanbuild*sizeof(uint32_t)); +xc->signal_typs = (unsigned char *)realloc(xc->signal_typs, maxhandle_scanbuild*sizeof(unsigned char)); free(xc->process_mask); -xc->process_mask = calloc(1, (maxhandle_scanbuild+7)/8); +xc->process_mask = (unsigned char *)calloc(1, (maxhandle_scanbuild+7)/8); free(xc->temp_signal_value_buf); -xc->temp_signal_value_buf = malloc(xc->longest_signal_value_len + 1); +xc->temp_signal_value_buf = (unsigned char *)malloc(xc->longest_signal_value_len + 1); xc->var_count = xc->maxhandle + xc->num_alias; @@ -4244,7 +4244,7 @@ if(sectype == FST_BL_ZWRAPPER) FILE *fcomp; off_t offpnt, uclen; char gz_membuf[FST_GZIO_LEN]; - void *zhandle; + gzFile zhandle; int zfd; int flen = strlen(xc->filename); char *hf; @@ -4254,7 +4254,7 @@ if(sectype == FST_BL_ZWRAPPER) if(!seclen) return(0); /* not finished compressing, this is a failed read */ - hf = calloc(1, flen + 16 + 32 + 1); + hf = (char *)calloc(1, flen + 16 + 32 + 1); sprintf(hf, "%s.upk_%d_%p", xc->filename, getpid(), (void *)xc); fcomp = fopen(hf, "w+b"); @@ -4417,7 +4417,7 @@ if(gzread_pass_status) { uint64_t clen = seclen - 24; uint64_t uclen = fstReaderUint64(xc->f); - unsigned char *ucdata = malloc(uclen); + unsigned char *ucdata = (unsigned char *)malloc(uclen); unsigned char *pnt = ucdata; unsigned int i; @@ -4426,11 +4426,11 @@ if(gzread_pass_status) xc->longest_signal_value_len = 32; /* arbitrarily set at 32...this is much longer than an expanded double */ free(xc->process_mask); - xc->process_mask = calloc(1, (xc->maxhandle+7)/8); + xc->process_mask = (unsigned char *)calloc(1, (xc->maxhandle+7)/8); if(clen != uclen) { - unsigned char *cdata = malloc(clen); + unsigned char *cdata = (unsigned char *)malloc(clen); unsigned long destlen = uclen; unsigned long sourcelen = clen; int rc; @@ -4452,9 +4452,9 @@ if(gzread_pass_status) } free(xc->signal_lens); - xc->signal_lens = malloc(sizeof(uint32_t) * xc->maxhandle); + xc->signal_lens = (uint32_t *)malloc(sizeof(uint32_t) * xc->maxhandle); free(xc->signal_typs); - xc->signal_typs = malloc(sizeof(unsigned char) * xc->maxhandle); + xc->signal_typs = (unsigned char *)malloc(sizeof(unsigned char) * xc->maxhandle); for(i=0;imaxhandle;i++) { @@ -4481,7 +4481,7 @@ if(gzread_pass_status) } free(xc->temp_signal_value_buf); - xc->temp_signal_value_buf = malloc(xc->longest_signal_value_len + 1); + xc->temp_signal_value_buf = (unsigned char *)malloc(xc->longest_signal_value_len + 1); free(ucdata); } @@ -4510,9 +4510,9 @@ if(gzread_pass_status) xc->num_blackouts = fstReaderVarint32(xc->f); free(xc->blackout_times); - xc->blackout_times = calloc(xc->num_blackouts, sizeof(uint64_t)); + xc->blackout_times = (uint64_t *)calloc(xc->num_blackouts, sizeof(uint64_t)); free(xc->blackout_activity); - xc->blackout_activity = calloc(xc->num_blackouts, sizeof(unsigned char)); + xc->blackout_activity = (unsigned char *)calloc(xc->num_blackouts, sizeof(unsigned char)); for(i=0;inum_blackouts;i++) { @@ -4547,7 +4547,7 @@ return(hdr_seen); void *fstReaderOpenForUtilitiesOnly(void) { -struct fstReaderContext *xc = calloc(1, sizeof(struct fstReaderContext)); +struct fstReaderContext *xc = (struct fstReaderContext *)calloc(1, sizeof(struct fstReaderContext)); return(xc); } @@ -4555,7 +4555,7 @@ return(xc); void *fstReaderOpen(const char *nam) { -struct fstReaderContext *xc = calloc(1, sizeof(struct fstReaderContext)); +struct fstReaderContext *xc = (struct fstReaderContext *)calloc(1, sizeof(struct fstReaderContext)); if((!nam)||(!(xc->f=fopen(nam, "rb")))) { @@ -4565,7 +4565,7 @@ if((!nam)||(!(xc->f=fopen(nam, "rb")))) else { int flen = strlen(nam); - char *hf = calloc(1, flen + 6); + char *hf = (char *)calloc(1, flen + 6); int rc; #if defined(__MINGW32__) || defined(FST_MACOSX) @@ -4704,9 +4704,9 @@ uint32_t mc_mem_len; /* corresponds to largest value encountered in chain_table_ if(!xc) return(0); -scatterptr = calloc(xc->maxhandle, sizeof(uint32_t)); -headptr = calloc(xc->maxhandle, sizeof(uint32_t)); -length_remaining = calloc(xc->maxhandle, sizeof(uint32_t)); +scatterptr = (uint32_t *)calloc(xc->maxhandle, sizeof(uint32_t)); +headptr = (uint32_t *)calloc(xc->maxhandle, sizeof(uint32_t)); +length_remaining = (uint32_t *)calloc(xc->maxhandle, sizeof(uint32_t)); if(fv) { @@ -4768,7 +4768,7 @@ for(;;) mem_required_for_traversal = fstReaderUint64(xc->f); - mem_for_traversal = malloc(mem_required_for_traversal + 66); /* add in potential fastlz overhead */ + mem_for_traversal = (unsigned char *)malloc(mem_required_for_traversal + 66); /* add in potential fastlz overhead */ #ifdef FST_DEBUG fprintf(stderr, FST_APIMESS"sec: %u seclen: %d begtim: %d endtim: %d\n", secnum, (int)seclen, (int)beg_tim, (int)end_tim); @@ -4794,7 +4794,7 @@ for(;;) (int)tsec_uclen, (int)tsec_clen, (int)tsec_nitems); #endif if(tsec_clen > seclen) break; /* corrupted tsec_clen: by definition it can't be larger than size of section */ - ucdata = malloc(tsec_uclen); + ucdata = (unsigned char *)malloc(tsec_uclen); if(!ucdata) break; /* malloc fail as tsec_uclen out of range from corrupted file */ destlen = tsec_uclen; sourcelen = tsec_clen; @@ -4803,7 +4803,7 @@ for(;;) if(tsec_uclen != tsec_clen) { - cdata = malloc(tsec_clen); + cdata = (unsigned char *)malloc(tsec_clen); fstFread(cdata, tsec_clen, 1, xc->f); rc = uncompress(ucdata, &destlen, cdata, sourcelen); @@ -4822,7 +4822,7 @@ for(;;) } free(time_table); - time_table = calloc(tsec_nitems, sizeof(uint64_t)); + time_table = (uint64_t *)calloc(tsec_nitems, sizeof(uint64_t)); tpnt = ucdata; tpval = 0; for(ti=0;tinum_blackouts)&&(cur_blackout != xc->num_blackouts)) @@ -4876,7 +4876,7 @@ for(;;) } else { - unsigned char *mc = malloc(frame_clen); + unsigned char *mc = (unsigned char *)malloc(frame_clen); int rc; unsigned long destlen = frame_uclen; @@ -5061,7 +5061,7 @@ for(;;) #ifdef FST_DEBUG fprintf(stderr, FST_APIMESS"indx_pos: %d (%d bytes)\n", (int)indx_pos, (int)chain_clen); #endif - chain_cmem = malloc(chain_clen); + chain_cmem = (unsigned char *)malloc(chain_clen); if(!chain_cmem) goto block_err; fstReaderFseeko(xc, xc->f, indx_pos, SEEK_SET); fstFread(chain_cmem, chain_clen, 1, xc->f); @@ -5072,8 +5072,8 @@ for(;;) free(chain_table_lengths); vc_maxhandle_largest = vc_maxhandle; - chain_table = calloc((vc_maxhandle+1), sizeof(off_t)); - chain_table_lengths = calloc((vc_maxhandle+1), sizeof(uint32_t)); + chain_table = (off_t *)calloc((vc_maxhandle+1), sizeof(off_t)); + chain_table_lengths = (uint32_t *)calloc((vc_maxhandle+1), sizeof(uint32_t)); } if(!chain_table || !chain_table_lengths) goto block_err; @@ -5178,11 +5178,11 @@ for(;;) } #ifdef FST_DEBUG - fprintf(stderr, FST_APIMESS"decompressed chain idx len: %"PRIu32"\n", idx); + fprintf(stderr, FST_APIMESS"decompressed chain idx len: %" PRIu32 "\n", idx); #endif mc_mem_len = 16384; - mc_mem = malloc(mc_mem_len); /* buffer for compressed reads */ + mc_mem = (unsigned char *)malloc(mc_mem_len); /* buffer for compressed reads */ /* check compressed VC data */ if(idx > xc->maxhandle) idx = xc->maxhandle; @@ -5212,7 +5212,7 @@ for(;;) if(mc_mem_len < chain_table_lengths[i]) { free(mc_mem); - mc_mem = malloc(mc_mem_len = chain_table_lengths[i]); + mc_mem = (unsigned char *)malloc(mc_mem_len = chain_table_lengths[i]); } mc = mc_mem; @@ -5291,7 +5291,7 @@ for(;;) } } - wx_len = sprintf(wx_buf, "#%"PRIu64"\n", time_table[i]); + wx_len = sprintf(wx_buf, "#%" PRIu64 "\n", time_table[i]); fstWritex(xc, wx_buf, wx_len); if((xc->num_blackouts)&&(cur_blackout != xc->num_blackouts)) @@ -5391,7 +5391,7 @@ for(;;) vcdid_len = fstVcdIDForFwrite(vcd_id+1, idx+1); { - unsigned char *vesc = malloc(len*4 + 1); + unsigned char *vesc = (unsigned char *)malloc(len*4 + 1); int vlen = fstUtilityBinToEsc(vesc, vdata, len); fstWritex(xc, vesc, vlen); free(vesc); @@ -5718,7 +5718,7 @@ if(!xc->rvat_sig_offs) { uint32_t cur_offs = 0; - xc->rvat_sig_offs = calloc(xc->maxhandle, sizeof(uint32_t)); + xc->rvat_sig_offs = (uint32_t *)calloc(xc->maxhandle, sizeof(uint32_t)); for(i=0;imaxhandle;i++) { xc->rvat_sig_offs[i] = cur_offs; @@ -5822,14 +5822,14 @@ tsec_nitems = fstReaderUint64(xc->f); fprintf(stderr, FST_APIMESS"time section unc: %d, com: %d (%d items)\n", (int)tsec_uclen, (int)tsec_clen, (int)tsec_nitems); #endif -ucdata = malloc(tsec_uclen); +ucdata = (unsigned char *)malloc(tsec_uclen); destlen = tsec_uclen; sourcelen = tsec_clen; fstReaderFseeko(xc, xc->f, -24 - ((off_t)tsec_clen), SEEK_CUR); if(tsec_uclen != tsec_clen) { - cdata = malloc(tsec_clen); + cdata = (unsigned char *)malloc(tsec_clen); fstFread(cdata, tsec_clen, 1, xc->f); rc = uncompress(ucdata, &destlen, cdata, sourcelen); @@ -5847,7 +5847,7 @@ if(tsec_uclen != tsec_clen) fstFread(ucdata, tsec_uclen, 1, xc->f); } -xc->rvat_time_table = calloc(tsec_nitems, sizeof(uint64_t)); +xc->rvat_time_table = (uint64_t *)calloc(tsec_nitems, sizeof(uint64_t)); tpnt = ucdata; tpval = 0; for(ti=0;tif, blkpos+32, SEEK_SET); frame_uclen = fstReaderVarint64(xc->f); frame_clen = fstReaderVarint64(xc->f); xc->rvat_frame_maxhandle = fstReaderVarint64(xc->f); -xc->rvat_frame_data = malloc(frame_uclen); +xc->rvat_frame_data = (unsigned char *)malloc(frame_uclen); if(frame_uclen == frame_clen) { @@ -5874,7 +5874,7 @@ if(frame_uclen == frame_clen) } else { - unsigned char *mc = malloc(frame_clen); + unsigned char *mc = (unsigned char *)malloc(frame_clen); int rc; unsigned long destlen = frame_uclen; @@ -5907,12 +5907,12 @@ indx_pos = indx_pntr - chain_clen; #ifdef FST_DEBUG fprintf(stderr, FST_APIMESS"indx_pos: %d (%d bytes)\n", (int)indx_pos, (int)chain_clen); #endif -chain_cmem = malloc(chain_clen); +chain_cmem = (unsigned char *)malloc(chain_clen); fstReaderFseeko(xc, xc->f, indx_pos, SEEK_SET); fstFread(chain_cmem, chain_clen, 1, xc->f); -xc->rvat_chain_table = calloc((xc->rvat_vc_maxhandle+1), sizeof(off_t)); -xc->rvat_chain_table_lengths = calloc((xc->rvat_vc_maxhandle+1), sizeof(uint32_t)); +xc->rvat_chain_table = (off_t *)calloc((xc->rvat_vc_maxhandle+1), sizeof(off_t)); +xc->rvat_chain_table_lengths = (uint32_t *)calloc((xc->rvat_vc_maxhandle+1), sizeof(uint32_t)); pnt = chain_cmem; idx = 0; @@ -5921,10 +5921,10 @@ pval = 0; if(sectype == FST_BL_VCDATA_DYN_ALIAS2) { uint32_t prev_alias = 0; - + do { int skiplen; - + if(*pnt & 0x01) { int64_t shval = fstGetSVarint64(pnt, &skiplen) >> 1; @@ -5939,7 +5939,7 @@ if(sectype == FST_BL_VCDATA_DYN_ALIAS2) xc->rvat_chain_table[idx] = 0; /* need to explicitly zero as calloc above might not run */ xc->rvat_chain_table_lengths[idx] = prev_alias = shval; /* because during this loop iter would give stale data! */ idx++; - } + } else { xc->rvat_chain_table[idx] = 0; /* need to explicitly zero as calloc above might not run */ @@ -5950,14 +5950,14 @@ if(sectype == FST_BL_VCDATA_DYN_ALIAS2) else { uint64_t val = fstGetVarint32(pnt, &skiplen); - + fstHandle loopcnt = val >> 1; for(i=0;irvat_chain_table[idx++] = 0; } } - + pnt += skiplen; } while (pnt != (chain_cmem + chain_clen)); } @@ -5967,7 +5967,7 @@ if(sectype == FST_BL_VCDATA_DYN_ALIAS2) { int skiplen; uint64_t val = fstGetVarint32(pnt, &skiplen); - + if(!val) { pnt += skiplen; @@ -5991,7 +5991,7 @@ if(sectype == FST_BL_VCDATA_DYN_ALIAS2) xc->rvat_chain_table[idx++] = 0; } } - + pnt += skiplen; } while (pnt != (chain_cmem + chain_clen)); } @@ -6016,7 +6016,7 @@ for(i=0;irvat_data_valid = 1; @@ -6054,8 +6054,8 @@ if(!xc->rvat_chain_mem) xc->rvat_chain_len = fstReaderVarint32WithSkip(xc->f, &skiplen); if(xc->rvat_chain_len) { - unsigned char *mu = malloc(xc->rvat_chain_len); - unsigned char *mc = malloc(xc->rvat_chain_table_lengths[facidx]); + unsigned char *mu = (unsigned char *)malloc(xc->rvat_chain_len); + unsigned char *mc = (unsigned char *)malloc(xc->rvat_chain_table_lengths[facidx]); unsigned long destlen = xc->rvat_chain_len; unsigned long sourcelen = xc->rvat_chain_table_lengths[facidx]; int rc = Z_OK; @@ -6086,7 +6086,7 @@ if(!xc->rvat_chain_mem) else { int destlen = xc->rvat_chain_table_lengths[facidx] - skiplen; - unsigned char *mu = malloc(xc->rvat_chain_len = destlen); + unsigned char *mu = (unsigned char *)malloc(xc->rvat_chain_len = destlen); fstFread(mu, destlen, 1, xc->f); /* data to process is for(j=0;jrvat_chain_mem = mu; @@ -6387,17 +6387,17 @@ static uint32_t j_hash(const uint8_t *k, uint32_t length, uint32_t initval) c += length; switch(len) /* all the case statements fall through */ { - case 11: c+=((uint32_t)k[10]<<24); - case 10: c+=((uint32_t)k[9]<<16); - case 9 : c+=((uint32_t)k[8]<<8); + case 11: c+=((uint32_t)k[10]<<24); /* fallthrough */ + case 10: c+=((uint32_t)k[9]<<16); /* fallthrough */ + case 9 : c+=((uint32_t)k[8]<<8); /* fallthrough */ /* the first byte of c is reserved for the length */ - case 8 : b+=((uint32_t)k[7]<<24); - case 7 : b+=((uint32_t)k[6]<<16); - case 6 : b+=((uint32_t)k[5]<<8); - case 5 : b+=k[4]; - case 4 : a+=((uint32_t)k[3]<<24); - case 3 : a+=((uint32_t)k[2]<<16); - case 2 : a+=((uint32_t)k[1]<<8); + case 8 : b+=((uint32_t)k[7]<<24); /* fallthrough */ + case 7 : b+=((uint32_t)k[6]<<16); /* fallthrough */ + case 6 : b+=((uint32_t)k[5]<<8); /* fallthrough */ + case 5 : b+=k[4]; /* fallthrough */ + case 4 : a+=((uint32_t)k[3]<<24); /* fallthrough */ + case 3 : a+=((uint32_t)k[2]<<16); /* fallthrough */ + case 2 : a+=((uint32_t)k[1]<<8); /* fallthrough */ case 1 : a+=k[0]; /* case 0: nothing left to add */ } @@ -6432,7 +6432,7 @@ struct collchain_t *chain, *pchain; if(!*base) { - *base = calloc(1, (hashmask + 1) * sizeof(void *)); + *base = (struct collchain_t **)calloc(1, (hashmask + 1) * sizeof(void *)); } ar = *base; @@ -6455,7 +6455,7 @@ while(chain) chain = chain->next; } -chain = calloc(1, sizeof(struct collchain_t) + length - 1); +chain = (struct collchain_t *)calloc(1, sizeof(struct collchain_t) + length - 1); memcpy(chain->mem, mem, length); chain->fullhash = hf; chain->length = length; diff --git a/vpi/lxt2_write.c b/vpi/lxt2_write.c index 1ebf3e179..d51ad73a2 100644 --- a/vpi/lxt2_write.c +++ b/vpi/lxt2_write.c @@ -97,7 +97,7 @@ if (lonumfacs)) { struct lxt2_wr_symbol *s = lt->symchain; - struct lxt2_wr_symbol **aliascache = calloc(lt->numalias ? lt->numalias : 1, sizeof(struct lxt2_wr_symbol *)); + struct lxt2_wr_symbol **aliascache = (struct lxt2_wr_symbol**)calloc(lt->numalias ? lt->numalias : 1, sizeof(struct lxt2_wr_symbol *)); unsigned int aliases_encountered, facs_encountered; lt->sorted_facs = (struct lxt2_wr_symbol **)calloc(lt->numfacs, sizeof(struct lxt2_wr_symbol *)); @@ -920,7 +920,7 @@ if(flags&LXT2_WR_SYM_F_DOUBLE) s->len = 32; } - s->value = malloc(s->len + 1); + s->value = (char*)malloc(s->len + 1); memset(s->value, lt->initial_value, s->len); s->value[s->len]=0; @@ -1017,7 +1017,7 @@ static void lxt2_wr_emit_do_breakfile(struct lxt2_wr_trace *lt) { unsigned int len = strlen(lt->lxtname); int i; -char *tname = malloc(len + 30); +char *tname = (char*)malloc(len + 30); FILE *f2, *clone; off_t cnt, seg; char buf[32768]; @@ -1810,13 +1810,13 @@ while(s->aliased_to) /* find root alias if exists */ valuelen = strlen(value); /* ensure string is proper length */ if(valuelen == s->len) { - vfix = wave_alloca(s->len+1); + vfix = (char*)wave_alloca(s->len+1); strcpy(vfix, value); value = vfix; } else { - vfix = wave_alloca(s->len+1); + vfix = (char*)wave_alloca(s->len+1); if(valuelen < s->len) { @@ -2088,7 +2088,7 @@ if((lt)&&(lt->blackout)) else { free(s->value); - s->value = calloc(1, 1*sizeof(char)); + s->value = (char*)calloc(1, 1*sizeof(char)); } } } @@ -2101,9 +2101,11 @@ if((lt)&&(lt->blackout)) { if((!(s->flags&LXT2_WR_SYM_F_ALIAS))&&(s->rows<2)) { + char tmp[16]; /* To get rid of the warning */ if(!(s->flags&(LXT2_WR_SYM_F_DOUBLE|LXT2_WR_SYM_F_STRING))) { - lxt2_wr_emit_value_bit_string(lt, s, 0, "x"); + strcpy(tmp, "x"); + lxt2_wr_emit_value_bit_string(lt, s, 0, tmp); } else if (s->flags&LXT2_WR_SYM_F_DOUBLE) { @@ -2113,7 +2115,8 @@ if((lt)&&(lt->blackout)) } else if (s->flags&LXT2_WR_SYM_F_STRING) { - lxt2_wr_emit_value_string(lt, s, 0, "UNDEF"); + strcpy(tmp, "UNDEF"); + lxt2_wr_emit_value_string(lt, s, 0, tmp); } } s=s->symchain; @@ -2202,4 +2205,3 @@ if(lt) lt->timezero = timeval; } } - diff --git a/vpi/lxt2_write.h b/vpi/lxt2_write.h index 7f2c6d134..1a8a1adbb 100644 --- a/vpi/lxt2_write.h +++ b/vpi/lxt2_write.h @@ -43,7 +43,7 @@ extern "C" { #define ftello ftell #endif -#include +#include "wavealloca.h" #define LXT2_WR_HDRID (0x1380) #define LXT2_WR_VERSION (0x0001) @@ -314,4 +314,3 @@ int lxt2_wr_emit_value_bit_string(struct lxt2_wr_trace *lt, struct lxt2_wr_sy #endif #endif - diff --git a/vpi/lz4.c b/vpi/lz4.c index c050cf1e0..5ee034eea 100644 --- a/vpi/lz4.c +++ b/vpi/lz4.c @@ -228,6 +228,9 @@ static const int LZ4_minLength = (MFLIMIT+1); #define GB *(1U<<30) #define MAXD_LOG 16 +#ifdef MAX_DISTANCE +#undef MAX_DISTANCE +#endif #define MAX_DISTANCE ((1 << MAXD_LOG) - 1) #define ML_BITS 4 diff --git a/vpi/wavealloca.h b/vpi/wavealloca.h index 4be2e4937..86276648f 100644 --- a/vpi/wavealloca.h +++ b/vpi/wavealloca.h @@ -1,10 +1,23 @@ /* - * Copyright (c) Tony Bybell 1999. + * Copyright (c) 1999 Tony Bybell. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. */ #ifndef WAVE_ALLOCA_H From c5df4cfcad9e3f9fd34eb2ac5d5962fc8c3deccd Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 29 Sep 2018 23:25:04 +0100 Subject: [PATCH 06/27] Cleanly terminate vvp on SIGHUP or SIGTERM (GitHub issue #203). (cherry picked from commit 603ff303f5795c5cd1a548b32b438dae539536c7) --- vvp/schedule.cc | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/vvp/schedule.cc b/vvp/schedule.cc index 4556f5f9d..0b0567a1e 100644 --- a/vvp/schedule.cc +++ b/vvp/schedule.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2016 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -527,27 +527,36 @@ bool schedule_stopped(void) /* * These are the signal handling infrastructure. The SIGINT signal - * leads to an implicit $stop. + * leads to an implicit $stop. The SIGHUP and SIGTERM signals lead + * to an implicit $finish. */ -extern "C" void signals_handler(int) +extern bool stop_is_finish; + +extern "C" void signals_handler(int signum) { #ifdef __MINGW32__ // Windows implements the original UNIX semantics for signal, // so we have to re-establish the signal handler each time a // signal is caught. - signal(SIGINT, &signals_handler); + signal(signum, &signals_handler); #endif + if (signum != SIGINT) + stop_is_finish = true; schedule_stopped_flag = true; } static void signals_capture(void) { - signal(SIGINT, &signals_handler); + signal(SIGHUP, &signals_handler); + signal(SIGINT, &signals_handler); + signal(SIGTERM, &signals_handler); } static void signals_revert(void) { - signal(SIGINT, SIG_DFL); + signal(SIGHUP, SIG_DFL); + signal(SIGINT, SIG_DFL); + signal(SIGTERM, SIG_DFL); } /* From 10fc8048acfc5b85dd34b9d64719fa63fcdd33bd Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 6 Oct 2018 17:15:31 +0100 Subject: [PATCH 07/27] Fix auto_ptr deprecated warnings when building with recent GCC. (cherry picked from commit 78317a2799260c9a5baa227ff1768a12a47f181b) --- net_func_eval.cc | 8 ++++++-- pform_types.h | 22 +++++++++++++--------- vhdlpp/expression.h | 12 ++++++++---- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/net_func_eval.cc b/net_func_eval.cc index 00790d692..f310af488 100644 --- a/net_func_eval.cc +++ b/net_func_eval.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 Stephen Williams (steve@icarus.com) + * Copyright (c) 2012-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -23,6 +23,10 @@ # include # include "ivl_assert.h" +#if __cplusplus < 201103L +#define unique_ptr auto_ptr +#endif + using namespace std; /* @@ -1018,7 +1022,7 @@ NetExpr* NetESignal::evaluate_function(const LineInfo&loc, NetExpr* NetETernary::evaluate_function(const LineInfo&loc, map&context_map) const { - auto_ptr cval (cond_->evaluate_function(loc, context_map)); + unique_ptr cval (cond_->evaluate_function(loc, context_map)); switch (const_logical(cval.get())) { diff --git a/pform_types.h b/pform_types.h index 22dab4b46..0bd87d817 100644 --- a/pform_types.h +++ b/pform_types.h @@ -1,7 +1,7 @@ #ifndef IVL_pform_types_H #define IVL_pform_types_H /* - * Copyright (c) 2007-2016 Stephen Williams (steve@icarus.com) + * Copyright (c) 2007-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -33,6 +33,10 @@ # include # include +#if __cplusplus < 201103L +#define unique_ptr auto_ptr +#endif + /* * parse-form types. */ @@ -117,7 +121,7 @@ struct name_component_t { struct decl_assignment_t { perm_string name; std::listindex; - std::auto_ptr expr; + std::unique_ptr expr; }; struct pform_tf_port_t { @@ -170,14 +174,14 @@ struct enum_type_t : public data_type_t { ivl_variable_type_t base_type; bool signed_flag; bool integer_flag; // True if "integer" was used - std::auto_ptr< list > range; - std::auto_ptr< list > names; + std::unique_ptr< list > range; + std::unique_ptr< list > names; LineInfo li; }; struct struct_member_t : public LineInfo { - std::auto_ptr type; - std::auto_ptr< list > names; + std::unique_ptr type; + std::unique_ptr< list > names; void pform_dump(std::ostream&out, unsigned indent) const; }; @@ -188,7 +192,7 @@ struct struct_type_t : public data_type_t { bool packed_flag; bool union_flag; - std::auto_ptr< list > members; + std::unique_ptr< list > members; }; struct atom2_type_t : public data_type_t { @@ -234,7 +238,7 @@ struct vector_type_t : public data_type_t { bool reg_flag; // True if "reg" was used bool integer_flag; // True if "integer" was used bool implicit_flag; // True if this type is implicitly logic/reg - std::auto_ptr< list > pdims; + std::unique_ptr< list > pdims; }; struct array_base_t : public data_type_t { @@ -243,7 +247,7 @@ struct array_base_t : public data_type_t { : base_type(btype), dims(pd) { } data_type_t*base_type; - std::auto_ptr< list > dims; + std::unique_ptr< list > dims; }; /* diff --git a/vhdlpp/expression.h b/vhdlpp/expression.h index 553c6b9c4..303cdc063 100644 --- a/vhdlpp/expression.h +++ b/vhdlpp/expression.h @@ -1,7 +1,7 @@ #ifndef IVL_expression_H #define IVL_expression_H /* - * Copyright (c) 2011-2014 Stephen Williams (steve@icarus.com) + * Copyright (c) 2011-2018 Stephen Williams (steve@icarus.com) * Copyright CERN 2015 / Stephen Williams (steve@icarus.com), * @author Maciej Suminski (maciej.suminski@cern.ch) * @@ -38,6 +38,10 @@ class VTypeArray; class VTypePrimitive; class ExpName; +#if __cplusplus < 201103L +#define unique_ptr auto_ptr +#endif + struct ExprVisitor { virtual ~ExprVisitor() {}; virtual void operator() (Expression*s) = 0; @@ -255,8 +259,8 @@ class ExpAggregate : public Expression { void dump(ostream&out, int indent) const; private: - std::auto_ptrexpr_; - std::auto_ptr range_; + std::unique_ptrexpr_; + std::unique_ptr range_; private: // not implemented choice_t& operator= (const choice_t&); }; @@ -718,7 +722,7 @@ class ExpName : public Expression { const list&indices, int field_size); private: - std::auto_ptr prefix_; + std::unique_ptr prefix_; perm_string name_; Expression*index_; Expression*lsb_; From de63c0cedb9cf6719b4f6a55a32c655a871020cb Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 6 Oct 2018 20:13:31 +0100 Subject: [PATCH 08/27] Fix implicit fallthrough warnings when building with recent GCC. (cherry picked from commit f1608e163f664cf5900e09959609395a58f4ca97) --- elab_expr.cc | 1 + eval_tree.cc | 5 +++++ expr_synth.cc | 4 +++- main.cc | 6 ++++++ t-dll-api.cc | 3 ++- t-dll.cc | 3 ++- tgt-vhdl/stmt.cc | 4 +++- tgt-vlog95/expr.c | 4 +++- tgt-vlog95/logic_lpm.c | 10 +++++----- vpi/sys_countdrivers.c | 3 ++- vpi/sys_display.c | 2 +- vpi/sys_fileio.c | 4 ++-- vpi/sys_lxt.c | 3 ++- vpi/sys_lxt2.c | 3 ++- vpi/sys_queue.c | 3 ++- vpi/sys_readmem.c | 4 +++- vpi/sys_scanf.c | 3 ++- vpi/v2009_enum.c | 1 + vvp/stop.cc | 3 ++- vvp/vpi_callback.cc | 2 +- vvp/vpi_const.cc | 4 ++-- vvp/vpi_priv.cc | 9 +++++---- vvp/vpi_signal.cc | 3 ++- vvp/vpi_tasks.cc | 1 + vvp/vpi_time.cc | 3 ++- vvp/vpi_vthr_vector.cc | 3 +++ vvp/vpip_bin.cc | 1 + vvp/vpip_hex.cc | 3 ++- vvp/vpip_oct.cc | 2 +- 29 files changed, 69 insertions(+), 31 deletions(-) diff --git a/elab_expr.cc b/elab_expr.cc index 14038e0f3..55f11058c 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -2753,6 +2753,7 @@ NetExpr* PEConcat::elaborate_expr(Design*, NetScope*, tmp->set_line(*this); return tmp; } + // fallthrough default: cerr << get_fileline() << ": internal error: " << "I don't know how to elaborate(ivl_type_t)" diff --git a/eval_tree.cc b/eval_tree.cc index f3391c828..f98aa1ad4 100644 --- a/eval_tree.cc +++ b/eval_tree.cc @@ -1102,6 +1102,7 @@ NetEConst* NetEBShift::eval_arguments_(const NetExpr*l, const NetExpr*r) const break; case 'r': lv.has_sign(false); + // fallthrough case 'R': val = cast_to_width(lv >> shift, wid); break; @@ -1553,6 +1554,7 @@ NetEConst* NetEUReduce::eval_arguments_(const NetExpr*ex) const case 'A': invert = true; + // fallthrough case '&': { res = verinum::V1; for (unsigned idx = 0 ; idx < val.len() ; idx += 1) @@ -1562,6 +1564,7 @@ NetEConst* NetEUReduce::eval_arguments_(const NetExpr*ex) const case 'N': invert = true; + // fallthrough case '|': { res = verinum::V0; for (unsigned idx = 0 ; idx < val.len() ; idx += 1) @@ -1571,6 +1574,7 @@ NetEConst* NetEUReduce::eval_arguments_(const NetExpr*ex) const case 'X': invert = true; + // fallthrough case '^': { /* Reduction XOR. */ unsigned ones = 0, unknown = 0; @@ -1622,6 +1626,7 @@ NetExpr* NetECast::eval_arguments_(const NetExpr*ex) const res_val = cast_to_width(res_val, expr_width()); res = new NetEConst(res_val); } + // fallthrough case 'v': if (const NetECReal*val = dynamic_cast(ex)) { verinum res_val(val->value().as_double(), false); diff --git a/expr_synth.cc b/expr_synth.cc index b1a2a8165..6458eeddd 100644 --- a/expr_synth.cc +++ b/expr_synth.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2015 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -335,6 +335,7 @@ NetNet* NetEBComp::synthesize(Design*des, NetScope*scope, NetExpr*root) des->errors += 1; return 0; } + // fallthrough case 'e': // == connect(dev->pin_AEB(), osig->pin(0)); break; @@ -353,6 +354,7 @@ NetNet* NetEBComp::synthesize(Design*des, NetScope*scope, NetExpr*root) des->errors += 1; return 0; } + // fallthrough case 'n': // != connect(dev->pin_ANEB(), osig->pin(0)); break; diff --git a/main.cc b/main.cc index 30da7bacd..fb63d939d 100644 --- a/main.cc +++ b/main.cc @@ -933,16 +933,22 @@ int main(int argc, char*argv[]) switch (generation_flag) { case GN_VER2012: lexor_keyword_mask |= GN_KEYWORDS_1800_2012; + // fallthrough case GN_VER2009: lexor_keyword_mask |= GN_KEYWORDS_1800_2009; + // fallthrough case GN_VER2005_SV: lexor_keyword_mask |= GN_KEYWORDS_1800_2005; + // fallthrough case GN_VER2005: lexor_keyword_mask |= GN_KEYWORDS_1364_2005; + // fallthrough case GN_VER2001: lexor_keyword_mask |= GN_KEYWORDS_1364_2001_CONFIG; + // fallthrough case GN_VER2001_NOCONFIG: lexor_keyword_mask |= GN_KEYWORDS_1364_2001; + // fallthrough case GN_VER1995: lexor_keyword_mask |= GN_KEYWORDS_1364_1995; } diff --git a/t-dll-api.cc b/t-dll-api.cc index 79bc73a2b..dba4f468d 100644 --- a/t-dll-api.cc +++ b/t-dll-api.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2015 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2018 Stephen Williams (steve@icarus.com) * Copyright CERN 2013 / Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it @@ -1457,6 +1457,7 @@ extern "C" unsigned ivl_lpm_selects(ivl_lpm_t net) case IVL_LPM_CONCATZ: cerr << "error: ivl_lpm_selects() is no longer supported for " "IVL_LPM_CONCAT, use ivl_lpm_size() instead." << endl; + // fallthrough default: assert(0); return 0; diff --git a/t-dll.cc b/t-dll.cc index 47ed90aaa..6245e69f7 100644 --- a/t-dll.cc +++ b/t-dll.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2015 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2018 Stephen Williams (steve@icarus.com) * Copyright CERN 2013 / Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it @@ -2489,6 +2489,7 @@ void dll_target::scope(const NetScope*net) case NetScope::PACKAGE: cerr << "?:?" << ": internal error: " << "Package scopes should not have parents." << endl; + // fallthrough case NetScope::MODULE: scop->type_ = IVL_SCT_MODULE; scop->tname_ = net->module_name(); diff --git a/tgt-vhdl/stmt.cc b/tgt-vhdl/stmt.cc index 0da0d5e0b..6de800dec 100644 --- a/tgt-vhdl/stmt.cc +++ b/tgt-vhdl/stmt.cc @@ -1,7 +1,7 @@ /* * VHDL code generation for statements. * - * Copyright (C) 2008-2013 Nick Gasson (nick@nickg.me.uk) + * Copyright (C) 2008-2018 Nick Gasson (nick@nickg.me.uk) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -683,8 +683,10 @@ static void get_nexuses_from_expr(ivl_expr_t expr, set &out) break; case IVL_EX_TERNARY: get_nexuses_from_expr(ivl_expr_oper3(expr), out); + // fallthrough case IVL_EX_BINARY: get_nexuses_from_expr(ivl_expr_oper2(expr), out); + // fallthrough case IVL_EX_UNARY: get_nexuses_from_expr(ivl_expr_oper1(expr), out); break; diff --git a/tgt-vlog95/expr.c b/tgt-vlog95/expr.c index f516a7a9e..cf76e6071 100644 --- a/tgt-vlog95/expr.c +++ b/tgt-vlog95/expr.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2014 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2011-2018 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -447,6 +447,7 @@ static void emit_expr_binary(ivl_scope_t scope, ivl_expr_t expr, unsigned wid, ivl_expr_file(expr), ivl_expr_lineno(expr)); vlog_errors += 1; } + //fallthrough case '+': case '-': case '*': @@ -492,6 +493,7 @@ static void emit_expr_binary(ivl_scope_t scope, ivl_expr_t expr, unsigned wid, ivl_expr_file(expr), ivl_expr_lineno(expr)); vlog_errors += 1; } + // fallthrough case 'l': case 'r': emit_expr(scope, oper1, wid, 0, 0, 0); diff --git a/tgt-vlog95/logic_lpm.c b/tgt-vlog95/logic_lpm.c index 07f46780e..a7359feb0 100644 --- a/tgt-vlog95/logic_lpm.c +++ b/tgt-vlog95/logic_lpm.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2015 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2011-2018 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1055,6 +1055,7 @@ static void emit_lpm_as_ca(ivl_scope_t scope, ivl_lpm_t lpm, "should not be generated.\n", ivl_lpm_file(lpm), ivl_lpm_lineno(lpm)); vlog_errors += 1; + // fallthrough case IVL_LPM_CONCAT: emit_lpm_concat(scope, lpm); break; @@ -2167,10 +2168,9 @@ void dump_nexus_information(ivl_scope_t scope, ivl_nexus_t nex) case IVL_VT_BOOL: fprintf(stderr, " bool"); break; case IVL_VT_LOGIC: fprintf(stderr, " logic"); break; case IVL_VT_STRING: fprintf(stderr, " string"); break; - case IVL_VT_DARRAY: fprintf(stderr, " dynamic array"); - case IVL_VT_CLASS: fprintf(stderr, " class"); - case IVL_VT_QUEUE: fprintf(stderr, " queue"); - break; + case IVL_VT_DARRAY: fprintf(stderr, " dynamic array"); break; + case IVL_VT_CLASS: fprintf(stderr, " class"); break; + case IVL_VT_QUEUE: fprintf(stderr, " queue"); break; } if (ivl_signal_signed(sig)) fprintf(stderr, " "); } else fprintf(stderr, "Error: No/missing information!"); diff --git a/vpi/sys_countdrivers.c b/vpi/sys_countdrivers.c index 3eedc431e..d4fbb8ea4 100644 --- a/vpi/sys_countdrivers.c +++ b/vpi/sys_countdrivers.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2014 Martin Whitaker. (icarus@martin-whitaker.me.uk) + * Copyright (C) 2012-2018 Martin Whitaker. (icarus@martin-whitaker.me.uk) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,6 +33,7 @@ static void check_net_arg(vpiHandle arg, vpiHandle callh, const char *name) case vpiPartSelect: if (vpi_get(vpiType, vpi_handle(vpiParent, arg)) != vpiNet) break; + // fallthrough case vpiNet: if (vpi_get(vpiSize, arg) != 1) break; diff --git a/vpi/sys_display.c b/vpi/sys_display.c index 6c2db71b0..55733b9f5 100644 --- a/vpi/sys_display.c +++ b/vpi/sys_display.c @@ -1138,7 +1138,7 @@ static int sys_check_args(vpiHandle callh, vpiHandle argv, const PLI_BYTE8*name, name, vpi_get_str(vpiType, arg)); ret = 1; } - + // fallthrough case vpiConstant: case vpiParameter: case vpiNet: diff --git a/vpi/sys_fileio.c b/vpi/sys_fileio.c index f63fd64e0..dbdecf5dc 100644 --- a/vpi/sys_fileio.c +++ b/vpi/sys_fileio.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013 Stephen Williams (steve@icarus.com) + * Copyright (c) 2003-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -132,7 +132,7 @@ static PLI_INT32 sys_fopen_calltf(ICARUS_VPI_CONST PLI_BYTE8*name) } } if (! fail) break; - + // fallthrough default: vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh), diff --git a/vpi/sys_lxt.c b/vpi/sys_lxt.c index a0f16fbfc..046d8fa37 100644 --- a/vpi/sys_lxt.c +++ b/vpi/sys_lxt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2015 Stephen Williams (steve@icarus.com) + * Copyright (c) 2002-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -549,6 +549,7 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) PLI_INT32 idx = vpi_get(vpiIndex, item); item = vpi_handle_by_index(array, idx); } + // fallthrough case vpiIntegerVar: case vpiBitVar: case vpiByteVar: diff --git a/vpi/sys_lxt2.c b/vpi/sys_lxt2.c index bf211019a..44528e87e 100644 --- a/vpi/sys_lxt2.c +++ b/vpi/sys_lxt2.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2015 Stephen Williams (steve@icarus.com) + * Copyright (c) 2003-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -612,6 +612,7 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) PLI_INT32 idx = vpi_get(vpiIndex, item); item = vpi_handle_by_index(array, idx); } + // fallthrough case vpiIntegerVar: case vpiBitVar: case vpiByteVar: diff --git a/vpi/sys_queue.c b/vpi/sys_queue.c index 3d34c7b4a..7eb7525c2 100644 --- a/vpi/sys_queue.c +++ b/vpi/sys_queue.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2014 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2011-2018 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -781,6 +781,7 @@ static PLI_INT32 fill_variable_with_scaled_time(vpiHandle var, uint64_t c_time) switch (words) { default: val_ptr[1].aval = (c_time >> 32) & 0xffffffff; + // fallthrough case 1: val_ptr[0].aval = c_time & 0xffffffff; } diff --git a/vpi/sys_readmem.c b/vpi/sys_readmem.c index a670a6317..0922214cf 100644 --- a/vpi/sys_readmem.c +++ b/vpi/sys_readmem.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2014 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -49,6 +49,7 @@ static void get_mem_params(vpiHandle argv, vpiHandle callh, const char *name, case vpiConstant: case vpiParameter: if (vpi_get(vpiConstType, *start_item) != vpiRealConst) break; + // fallthrough case vpiRealVar: vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); @@ -67,6 +68,7 @@ static void get_mem_params(vpiHandle argv, vpiHandle callh, const char *name, if (vpi_get(vpiConstType, *stop_item) != vpiRealConst) { break; } + // fallthrough case vpiRealVar: vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh), diff --git a/vpi/sys_scanf.c b/vpi/sys_scanf.c index de567eba6..4768a72e8 100644 --- a/vpi/sys_scanf.c +++ b/vpi/sys_scanf.c @@ -1258,6 +1258,7 @@ static int is_assignable_obj(vpiHandle obj) break; case vpiPartSelect: if (! is_assignable_obj(vpi_handle(vpiParent, obj))) break; + // fallthrough case vpiIntegerVar: case vpiBitVar: case vpiByteVar: @@ -1403,7 +1404,7 @@ static PLI_INT32 sys_sscanf_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name) case vpiConstant: case vpiParameter: if (vpi_get(vpiConstType, reg) == vpiStringConst) break; - + // fallthrough default: vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh), (int)vpi_get(vpiLineNo, callh)); diff --git a/vpi/v2009_enum.c b/vpi/v2009_enum.c index a8983e28a..8c638ff22 100644 --- a/vpi/v2009_enum.c +++ b/vpi/v2009_enum.c @@ -108,6 +108,7 @@ static PLI_INT32 ivl_enum_method_next_prev_compiletf(ICARUS_VPI_CONST PLI_BYTE8* case vpiConstant: case vpiParameter: if (vpi_get(vpiConstType, arg_count) != vpiStringConst) break; + // fallthrough default: vpi_printf("%s:%d: compiler error: ", vpi_get_str(vpiFile, sys), diff --git a/vvp/stop.cc b/vvp/stop.cc index c76c89d39..e07730508 100644 --- a/vvp/stop.cc +++ b/vvp/stop.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2013 Stephen Williams (steve@icarus.com) + * Copyright (c) 2003-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -373,6 +373,7 @@ static void cmd_trace(unsigned argc, char*argv[]) break; default: printf("Only using the first argument to trace.\n"); + // fallthrough case 2: if ((strcmp(argv[1], "on") == 0) || (strcmp(argv[1], "1") == 0)) { show_file_line = true; diff --git a/vvp/vpi_callback.cc b/vvp/vpi_callback.cc index 77d7bc4ae..762095318 100644 --- a/vvp/vpi_callback.cc +++ b/vvp/vpi_callback.cc @@ -796,7 +796,7 @@ static void real_signal_value(struct t_vpi_value*vp, double rval) switch (vp->format) { case vpiObjTypeVal: vp->format = vpiRealVal; - + // fallthrough case vpiRealVal: vp->value.real = rval; break; diff --git a/vvp/vpi_const.cc b/vvp/vpi_const.cc index 6cff523cc..82a70572b 100644 --- a/vvp/vpi_const.cc +++ b/vvp/vpi_const.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2014 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -129,7 +129,7 @@ void __vpiStringConst::vpi_get_value(p_vpi_value vp) case vpiObjTypeVal: /* String parameters by default have vpiStringVal values. */ vp->format = vpiStringVal; - + // fallthrough case vpiStringVal: rbuf = (char *) need_result_buf(size + 1, RBUF_VAL); strcpy(rbuf, value_); diff --git a/vvp/vpi_priv.cc b/vvp/vpi_priv.cc index ddb69acd4..5384d0efb 100644 --- a/vvp/vpi_priv.cc +++ b/vvp/vpi_priv.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008-2017 Stephen Williams (steve@icarus.com) + * Copyright (c) 2008-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -724,7 +724,7 @@ void vpip_vec4_get_value(const vvp_vector4_t&word_val, unsigned width, case vpiObjTypeVal: // Use the following case to actually set the value! vp->format = vpiVectorVal; - + // fallthrough case vpiVectorVal: { unsigned hwid = (width + 31)/32; @@ -784,6 +784,7 @@ void vpip_vec2_get_value(const vvp_vector2_t&word_val, unsigned width, case vpiObjTypeVal: vp->format = vpiIntVal; + // fallthrough case vpiIntVal: vector2_to_value(word_val, vp->value.integer, signed_flag); break; @@ -862,7 +863,7 @@ void vpip_real_get_value(double real, s_vpi_value*vp) case vpiObjTypeVal: // Use the following case to actually set the value! vp->format = vpiRealVal; - + // fallthrough case vpiRealVal: vp->value.real = real; break; @@ -944,7 +945,7 @@ void vpip_string_get_value(const string&val, s_vpi_value*vp) case vpiObjTypeVal: // Use the following case to actually set the value! vp->format = vpiStringVal; - + // fallthrough case vpiStringVal: rbuf = (char *) need_result_buf(val.size() + 1, RBUF_VAL); strcpy(rbuf, val.c_str()); diff --git a/vvp/vpi_signal.cc b/vvp/vpi_signal.cc index 27965db4d..976b4b7bc 100644 --- a/vvp/vpi_signal.cc +++ b/vvp/vpi_signal.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2016 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -1200,6 +1200,7 @@ static int PV_get(int code, vpiHandle ref) case vpiLeftRange: rval += rfp->width - 1; + // fallthrough case vpiRightRange: rval += vpi_get(vpiRightRange, rfp->parent) + PV_get_base(rfp); return rval; diff --git a/vvp/vpi_tasks.cc b/vvp/vpi_tasks.cc index fad8f07d3..0a37be788 100644 --- a/vvp/vpi_tasks.cc +++ b/vvp/vpi_tasks.cc @@ -475,6 +475,7 @@ vpiHandle sysfunc_4net::vpi_put_value(p_vpi_value vp, int) (int)vp->value.scalar); assert(0); } + break; } case vpiIntVal: { diff --git a/vvp/vpi_time.cc b/vvp/vpi_time.cc index 215838773..f2ab4f810 100644 --- a/vvp/vpi_time.cc +++ b/vvp/vpi_time.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2014 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -131,6 +131,7 @@ static void timevar_get_value(vpiHandle ref, s_vpi_value*vp, bool is_int_func, case vpiObjTypeVal: /* The default format is vpiTimeVal. */ vp->format = vpiTimeVal; + // fallthrough case vpiTimeVal: vp->value.time = &time_value; vp->value.time->type = vpiSimTime; diff --git a/vvp/vpi_vthr_vector.cc b/vvp/vpi_vthr_vector.cc index 4b4c580de..ad426af9a 100644 --- a/vvp/vpi_vthr_vector.cc +++ b/vvp/vpi_vthr_vector.cc @@ -108,6 +108,7 @@ static void vthr_real_get_value(vpiHandle ref, s_vpi_value*vp) case vpiObjTypeVal: vp->format = vpiRealVal; + // fallthrough case vpiRealVal: vp->value.real = val; break; @@ -258,6 +259,7 @@ void __vpiVThrStrStack::vpi_get_value(p_vpi_value vp) case vpiObjTypeVal: vp->format = vpiStringVal; + // fallthrough case vpiStringVal: rbuf = (char *) need_result_buf(val.size()+1, RBUF_VAL); strcpy(rbuf, val.c_str()); @@ -376,6 +378,7 @@ void __vpiVThrVec4Stack::vpi_get_value(p_vpi_value vp) break; case vpiObjTypeVal: vp->format = vpiVectorVal; + // fallthrough case vpiVectorVal: vpi_get_value_vector_(vp, val); break; diff --git a/vvp/vpip_bin.cc b/vvp/vpip_bin.cc index 991d00982..7ecf07dca 100644 --- a/vvp/vpip_bin.cc +++ b/vvp/vpip_bin.cc @@ -100,6 +100,7 @@ void vpip_bin_str_to_vec4(vvp_vector4_t&vec4, const char*buf) pad = BIT4_1; break; } + // fallthrough default: // Everything else gets '0' padded/ pad = BIT4_0; break; diff --git a/vvp/vpip_hex.cc b/vvp/vpip_hex.cc index e49468fab..fc0bf79fa 100644 --- a/vvp/vpip_hex.cc +++ b/vvp/vpip_hex.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2013 Stephen Williams (steve@icarus.com) + * Copyright (c) 2002-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -126,6 +126,7 @@ void vpip_hex_str_to_vec4(vvp_vector4_t&val, const char*str) pad = BIT4_1; break; } + // fallthrough default: // Everything else gets '0' padded. pad = BIT4_0; break; diff --git a/vvp/vpip_oct.cc b/vvp/vpip_oct.cc index a362a79d6..b60b0a85b 100644 --- a/vvp/vpip_oct.cc +++ b/vvp/vpip_oct.cc @@ -106,6 +106,7 @@ void vpip_oct_str_to_vec4(vvp_vector4_t&val, const char*str) pad = BIT4_1; break; } + // fallthrough default: // Everything else gets '0' padded. pad = BIT4_0; break; @@ -116,7 +117,6 @@ void vpip_oct_str_to_vec4(vvp_vector4_t&val, const char*str) if (idx < tval.size()) val.set_bit(idx, tval.value(idx)); else val.set_bit(idx, pad); } - } void vpip_vec4_to_oct_str(const vvp_vector4_t&bits, char*buf, unsigned nbuf) From 400428a2b60f85b10c0fd164de8579d8e8a89ea0 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 6 Oct 2018 20:40:54 +0100 Subject: [PATCH 09/27] Fix signed/unsigned comparison warning. (cherry picked from commit e71a76a1e288b07a3933e80a9e3b42620dc40bec) --- elab_expr.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elab_expr.cc b/elab_expr.cc index 55f11058c..699c4f5d5 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -2589,7 +2589,7 @@ NetExpr* PECastType::elaborate_expr(Design*des, NetScope*scope, // Find rounded up length that can fit the whole casted array of vectors int len = base->expr_width() + vector->packed_width() - 1; - if(base->expr_width() > vector->packed_width()) { + if(base->expr_width() > (unsigned)vector->packed_width()) { len /= vector->packed_width(); } else { len /= base->expr_width(); From 8e77900b9caf616fcb9596a112ee4409d3ddc036 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 6 Oct 2018 21:02:41 +0100 Subject: [PATCH 10/27] Fix deprecated dynamic exception specification warnings. (cherry picked from commit 4ea18196c855e0e18fbcdf280989ac4062fa2256) --- tgt-vhdl/vhdl_element.cc | 3 +-- tgt-vhdl/vhdl_element.hh | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tgt-vhdl/vhdl_element.cc b/tgt-vhdl/vhdl_element.cc index e7e0957b6..1b5c45191 100644 --- a/tgt-vhdl/vhdl_element.cc +++ b/tgt-vhdl/vhdl_element.cc @@ -108,7 +108,7 @@ void vhdl_element::print() const // Trap allocations of vhdl_element subclasses. // This records the pointer allocated in a static field of vhdl_element // so we can delete it just before the code generator exits. -void* vhdl_element::operator new(size_t size) throw (bad_alloc) +void* vhdl_element::operator new(size_t size) { // Let the default new handle the allocation void* ptr = ::operator new(size); @@ -171,4 +171,3 @@ int vhdl_element::free_all_objects() return freed; } - diff --git a/tgt-vhdl/vhdl_element.hh b/tgt-vhdl/vhdl_element.hh index a324e227d..8cf11d4cf 100644 --- a/tgt-vhdl/vhdl_element.hh +++ b/tgt-vhdl/vhdl_element.hh @@ -46,7 +46,7 @@ class vhdl_element { public: virtual ~vhdl_element() {} - void* operator new(size_t size) throw (std::bad_alloc); + void* operator new(size_t size); void operator delete(void* ptr); virtual void emit(std::ostream &of, int level=0) const = 0; @@ -74,4 +74,3 @@ std::string nl_string(int level); void blank_line(std::ostream &of, int level); #endif - From 4cb9ae0aa2a095dff60862256236100f9ed30766 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 6 Oct 2018 21:07:13 +0100 Subject: [PATCH 11/27] SIGHUP is not available in Windows. (cherry picked from commit 3e25b0468534a78345581b2d9a3f5aa380d276db) --- vvp/schedule.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vvp/schedule.cc b/vvp/schedule.cc index 0b0567a1e..b47d0b142 100644 --- a/vvp/schedule.cc +++ b/vvp/schedule.cc @@ -547,14 +547,18 @@ extern "C" void signals_handler(int signum) static void signals_capture(void) { +#ifndef __MINGW32__ signal(SIGHUP, &signals_handler); +#endif signal(SIGINT, &signals_handler); signal(SIGTERM, &signals_handler); } static void signals_revert(void) { +#ifndef __MINGW32__ signal(SIGHUP, SIG_DFL); +#endif signal(SIGINT, SIG_DFL); signal(SIGTERM, SIG_DFL); } From ac2f5f07407c65d7de452d21d3f9667210bf5b1c Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 6 Oct 2018 22:56:04 +0100 Subject: [PATCH 12/27] Fix invalid cast of TF sizetf callback. (cherry picked from commit 6415d84ed5bb6190d1a414b429756fd561a123ff) --- libveriuser/veriusertfs.c | 29 ++++++++++++++++++++++++++++- veriuser.h | 3 ++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/libveriuser/veriusertfs.c b/libveriuser/veriusertfs.c index 3c455b800..8807f6649 100644 --- a/libveriuser/veriusertfs.c +++ b/libveriuser/veriusertfs.c @@ -44,6 +44,7 @@ typedef struct t_pli_data { static PLI_INT32 compiletf(ICARUS_VPI_CONST PLI_BYTE8 *); static PLI_INT32 calltf(ICARUS_VPI_CONST PLI_BYTE8 *); +static PLI_INT32 sizetf(ICARUS_VPI_CONST PLI_BYTE8 *); static PLI_INT32 callback(p_cb_data); /* @@ -150,7 +151,7 @@ void veriusertfs_register_table(p_tfcell vtable) tf_data.tfname = tf->tfname; tf_data.compiletf = compiletf; tf_data.calltf = calltf; - tf_data.sizetf = (PLI_INT32 (*)(ICARUS_VPI_CONST PLI_BYTE8 *))tf->sizetf; + tf_data.sizetf = sizetf; tf_data.user_data = (char *)data; if (pli_trace) { @@ -283,6 +284,32 @@ static PLI_INT32 calltf(ICARUS_VPI_CONST PLI_BYTE8*data) return rc; } +/* + * This function is the wrapper for the veriusertfs sizetf routine. + */ +static PLI_INT32 sizetf(ICARUS_VPI_CONST PLI_BYTE8*data) +{ + int rc = 32; + p_pli_data pli; + p_tfcell tf; + + /* cast back from opaque */ + pli = (p_pli_data)data; + tf = pli->tf; + + /* execute sizetf */ + if (tf->sizetf) { + if (pli_trace) { + fprintf(pli_trace, "Call %s->sizetf(%d, %d)\n", + tf->tfname, tf->data, reason_sizetf); + } + + rc = tf->sizetf(tf->data, reason_sizetf); + } + + return rc; +} + /* * This function is the wrapper for all the misctf callbacks */ diff --git a/veriuser.h b/veriuser.h index 7e061c16f..7614673db 100644 --- a/veriuser.h +++ b/veriuser.h @@ -1,7 +1,7 @@ #ifndef VERIUSER_H #define VERIUSER_H /* - * Copyright (c) 2002-2014 Stephen Williams (steve@icarus.com) + * Copyright (c) 2002-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -159,6 +159,7 @@ extern void veriusertfs_register_table(p_tfcell vtable); /* callback reasons */ #define reason_checktf 1 +#define reason_sizetf 2 #define reason_calltf 3 #define reason_paramvc 7 #define reason_synch 8 From 869513a1ec3406c16ab245929103f535f4c8160e Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 6 Oct 2018 23:25:13 +0100 Subject: [PATCH 13/27] Fix alloc size warning when building with recent GCC. (cherry picked from commit 5cd0ba08b1c8dbc3174ee7b0e86654da721e1dd1) --- tgt-vvp/vvp_scope.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index 80534c429..1e27aa0f2 100644 --- a/tgt-vvp/vvp_scope.c +++ b/tgt-vvp/vvp_scope.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2016 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -823,6 +823,7 @@ static void draw_udp_in_scope(ivl_net_logic_t lptr) * (.resolv, etc.) can be built before we build the .udp call. * This matches what is done for the other primitives. */ + assert(ivl_logic_pins(lptr) > 0); ninp = ivl_logic_pins(lptr) - 1; input_strings = calloc(ninp, sizeof(char*)); for (pdx = 0 ; pdx < ninp ; pdx += 1) { @@ -885,7 +886,7 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr) ivl_drive_t str1 = ivl_logic_drive1(lptr); int level; - int ninp; + unsigned ninp; const char **input_strings; switch (ivl_logic_type(lptr)) { @@ -1018,8 +1019,8 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr) /* Get all the input label that I will use for parameters to the functor that I create later. */ + assert(ivl_logic_pins(lptr) > 0); ninp = ivl_logic_pins(lptr) - 1; - assert(ninp >= 0); input_strings = calloc(ninp, sizeof(char*)); for (pdx = 0 ; pdx < (unsigned)ninp ; pdx += 1) input_strings[pdx] = draw_net_input(ivl_logic_pin(lptr, pdx+1)); From 062fc43fab13f26f4c57eb60d1c2059e4e8037f0 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sun, 7 Oct 2018 11:23:40 +0100 Subject: [PATCH 14/27] Fix another implicit fallthrough warning. (cherry picked from commit a03995b4da43f4347e23f6b85a139052b2b8ee9d) --- tgt-vhdl/stmt.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/tgt-vhdl/stmt.cc b/tgt-vhdl/stmt.cc index 6de800dec..51ac8bb20 100644 --- a/tgt-vhdl/stmt.cc +++ b/tgt-vhdl/stmt.cc @@ -1250,6 +1250,7 @@ static void process_number(vhdl_binop_expr *all, vhdl_var_ref *test, switch (bits[i]) { case 'x': if (is_casez) break; + // fallthrough case '?': case 'z': continue; // Ignore these. From 10e7eb55ce13d3140ff478906a9e331a313e168c Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sun, 7 Oct 2018 17:17:33 +0100 Subject: [PATCH 15/27] Fix bit width when converting real value to binary/hex string in VPI. (cherry picked from commit 5aae9ea770181eea116195497c9d591261cb5e4a) --- vvp/vpi_callback.cc | 6 +++--- vvp/vpi_vthr_vector.cc | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/vvp/vpi_callback.cc b/vvp/vpi_callback.cc index 762095318..7f7164d48 100644 --- a/vvp/vpi_callback.cc +++ b/vvp/vpi_callback.cc @@ -820,12 +820,12 @@ static void real_signal_value(struct t_vpi_value*vp, double rval) break; case vpiHexStrVal: - sprintf(rbuf, "%lx", (long)vlg_round(rval)); + sprintf(rbuf, "%" PRIx64, (uint64_t)vlg_round(rval)); vp->value.str = rbuf; break; case vpiBinStrVal: { - unsigned long val = (unsigned long)vlg_round(rval); + uint64_t val = (uint64_t)vlg_round(rval); unsigned len = 0; while (val > 0) { @@ -833,7 +833,7 @@ static void real_signal_value(struct t_vpi_value*vp, double rval) val /= 2; } - val = (unsigned long)vlg_round(rval); + val = (uint64_t)vlg_round(rval); for (unsigned idx = 0 ; idx < len ; idx += 1) { rbuf[len-idx-1] = (val & 1)? '1' : '0'; val /= 2; diff --git a/vvp/vpi_vthr_vector.cc b/vvp/vpi_vthr_vector.cc index ad426af9a..5e48afb24 100644 --- a/vvp/vpi_vthr_vector.cc +++ b/vvp/vpi_vthr_vector.cc @@ -132,17 +132,17 @@ static void vthr_real_get_value(vpiHandle ref, s_vpi_value*vp) break; case vpiOctStrVal: - sprintf(rbuf, "%lo", (long)vlg_round(val)); + sprintf(rbuf, "%" PRIo64, (uint64_t)vlg_round(val)); vp->value.str = rbuf; break; case vpiHexStrVal: - sprintf(rbuf, "%lx", (long)vlg_round(val)); + sprintf(rbuf, "%" PRIx64, (uint64_t)vlg_round(val)); vp->value.str = rbuf; break; case vpiBinStrVal: { - unsigned long vali = (unsigned long)vlg_round(val); + uint64_t vali = (uint64_t)vlg_round(val); unsigned len = 0; while (vali > 0) { @@ -150,7 +150,7 @@ static void vthr_real_get_value(vpiHandle ref, s_vpi_value*vp) vali /= 2; } - vali = (unsigned long)vlg_round(val); + vali = (uint64_t)vlg_round(val); for (unsigned idx = 0 ; idx < len ; idx += 1) { rbuf[len-idx-1] = (vali & 1)? '1' : '0'; vali /= 2; From 10448bf94b940f684542096e603727f787bcd67b Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sun, 7 Oct 2018 18:59:53 +0100 Subject: [PATCH 16/27] Fix bug in output of null character with %c format. (cherry picked from commit 9d0d1938dc66b715b1ac6693913a9e79d3cb401c) --- vpi/sys_display.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vpi/sys_display.c b/vpi/sys_display.c index 55733b9f5..998b9393e 100644 --- a/vpi/sys_display.c +++ b/vpi/sys_display.c @@ -406,13 +406,13 @@ static unsigned int get_format_char(char **rtn, int ljust, int plus, vpi_printf("WARNING: %s:%d: missing argument for %s%s.\n", info->filename, info->lineno, info->name, fmtb); } else { - value.format = vpiStringVal; + value.format = vpiIntVal; vpi_get_value(info->items[*idx], &value); if (value.format == vpiSuppressVal) { vpi_printf("WARNING: %s:%d: incompatible value for %s%s.\n", info->filename, info->lineno, info->name, fmtb); } else { - char ch = value.value.str[strlen(value.value.str)-1]; + char ch = value.value.integer; /* If the width is less than one then use a width of one. */ if (width < 1) width = 1; From 3581da23e363f9328b27282ca8a3d6a335f3e7cd Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sun, 7 Oct 2018 23:49:19 +0100 Subject: [PATCH 17/27] Don't use MinGW strtod workaround when building for MinGW-w64. The host triplet for MinGW-w64 has changed to more closely match that for MinGW, so we need to update the pattern in the test. (cherry picked from commit fdf353af29be4f79198370978d12525c95c6ce87) --- aclocal.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aclocal.m4 b/aclocal.m4 index f44632fe2..7a113bf44 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -225,7 +225,7 @@ AC_DEFUN([AX_C99_STRTOD], [# On MinGW we need to jump through hoops to get a C99 compliant strtod(). # mingw-w64 doesn't need this, and the 64-bit version doesn't support it. case "${host}" in - *-*-mingw32) + *-pc-mingw32) LDFLAGS+=" -Wl,--undefined=___strtod,--wrap,strtod,--defsym,___wrap_strtod=___strtod" ;; esac From 95444b474dadf86ec185f59bc82a987e2415b49c Mon Sep 17 00:00:00 2001 From: Cary R Date: Fri, 12 Oct 2018 21:29:29 -0700 Subject: [PATCH 18/27] Update fstapi files to the latest from GTKWave --- vpi/fstapi.c | 229 +++++++++++++++++++++++++++++++++++++++++++++++++-- vpi/fstapi.h | 32 +++++-- 2 files changed, 249 insertions(+), 12 deletions(-) diff --git a/vpi/fstapi.c b/vpi/fstapi.c index 13342fa7d..35f601191 100644 --- a/vpi/fstapi.c +++ b/vpi/fstapi.c @@ -283,7 +283,7 @@ static char *fstRealpath(const char *path, char *resolved_path) #if (defined(__MACH__) && defined(__APPLE__)) if(!resolved_path) { - resolved_path = (unsigned char *)malloc(PATH_MAX+1); /* fixes bug on Leopard when resolved_path == NULL */ + resolved_path = (char *)malloc(PATH_MAX+1); /* fixes bug on Leopard when resolved_path == NULL */ } #endif @@ -293,7 +293,7 @@ return(realpath(path, resolved_path)); #ifdef __MINGW32__ if(!resolved_path) { - resolved_path = (unsigned char *)malloc(PATH_MAX+1); + resolved_path = (char *)malloc(PATH_MAX+1); } return(_fullpath(resolved_path, path, PATH_MAX)); #else @@ -793,6 +793,8 @@ char *geom_handle_nam; char *valpos_handle_nam; char *curval_handle_nam; char *tchn_handle_nam; + +fstEnumHandle max_enumhandle; }; @@ -2160,7 +2162,7 @@ if(xc && !xc->already_in_close && !xc->already_in_flush) #ifdef __MINGW32__ { int flen = strlen(xc->filename); - char *hf = calloc(1, flen + 6); + char *hf = (char *)calloc(1, flen + 6); strcpy(hf, xc->filename); if(xc->compress_hier) @@ -2303,7 +2305,7 @@ if(xc && path && path[0]) const unsigned char *path2 = (const unsigned char *)path; PPvoid_t pv; #else - char *path2 = alloca(slen + 1); /* judy lacks const qualifier in its JudyHSIns definition */ + char *path2 = (char *)alloca(slen + 1); /* judy lacks const qualifier in its JudyHSIns definition */ PPvoid_t pv; strcpy(path2, path); #endif @@ -2724,6 +2726,111 @@ if(xc) } +fstEnumHandle fstWriterCreateEnumTable(void *ctx, const char *name, uint32_t elem_count, unsigned int min_valbits, const char **literal_arr, const char **val_arr) +{ +fstEnumHandle handle = 0; +unsigned int *literal_lens = NULL; +unsigned int *val_lens = NULL; +int lit_len_tot = 0; +int val_len_tot = 0; +int name_len; +char elem_count_buf[16]; +int elem_count_len; +int total_len; +int pos = 0; +char *attr_str = NULL; + +if(ctx && name && literal_arr && val_arr && (elem_count != 0)) + { + struct fstWriterContext *xc = (struct fstWriterContext *)ctx; + + uint32_t i; + + name_len = strlen(name); + elem_count_len = sprintf(elem_count_buf, "%" PRIu32, elem_count); + + literal_lens = (unsigned int *)calloc(elem_count, sizeof(unsigned int)); + val_lens = (unsigned int *)calloc(elem_count, sizeof(unsigned int)); + + for(i=0;i 0) + { + if(val_lens[i] < min_valbits) + { + val_len_tot += (min_valbits - val_lens[i]); /* additional converted len is same for '0' character */ + } + } + } + + total_len = name_len + 1 + elem_count_len + 1 + lit_len_tot + elem_count + val_len_tot + elem_count; + + attr_str = (char*)malloc(total_len); + pos = 0; + + memcpy(attr_str+pos, name, name_len); + pos += name_len; + attr_str[pos++] = ' '; + + memcpy(attr_str+pos, elem_count_buf, elem_count_len); + pos += elem_count_len; + attr_str[pos++] = ' '; + + for(i=0;i 0) + { + if(val_lens[i] < min_valbits) + { + memset(attr_str+pos, '0', min_valbits - val_lens[i]); + pos += (min_valbits - val_lens[i]); + } + } + + pos += fstUtilityBinToEsc((unsigned char*)attr_str+pos, (unsigned char*)val_arr[i], val_lens[i]); + attr_str[pos++] = ' '; + } + + attr_str[pos-1] = 0; + +#ifdef FST_DEBUG + fprintf(stderr, FST_APIMESS"fstWriterCreateEnumTable() total_len: %d, pos: %d\n", total_len, pos); + fprintf(stderr, FST_APIMESS"*%s*\n", attr_str); +#endif + + fstWriterSetAttrBegin(xc, FST_AT_MISC, FST_MT_ENUMTABLE, attr_str, handle = ++xc->max_enumhandle); + + free(attr_str); + free(val_lens); + free(literal_lens); + } + +return(handle); +} + + +void fstWriterEmitEnumTableRef(void *ctx, fstEnumHandle handle) +{ +struct fstWriterContext *xc = (struct fstWriterContext *)ctx; +if(xc && handle) + { + fstWriterSetAttrBegin(xc, FST_AT_MISC, FST_MT_ENUMTABLE, NULL, handle); + } +} + + /* * value and time change emission */ @@ -6501,9 +6608,46 @@ if(base && *base) /*** ***/ /************************/ -int fstUtilityBinToEsc(unsigned char *d, unsigned char *s, int len) +int fstUtilityBinToEscConvertedLen(const unsigned char *s, int len) { -unsigned char *src = s; +const unsigned char *src = s; +int dlen = 0; +int i; + +for(i=0;i ' ') && (src[i] <= '~')) /* no white spaces in output */ + { + dlen++; + } + else + { + dlen += 4; + } + break; + } + } + +return(dlen); +} + + +int fstUtilityBinToEsc(unsigned char *d, const unsigned char *s, int len) +{ +const unsigned char *src = s; unsigned char *dst = d; unsigned char val; int i; @@ -6602,3 +6746,76 @@ for(i=0;ielem_count = cnt; + et->name = strdup(s); + et->literal_arr = (char**)calloc(cnt, sizeof(char *)); + et->val_arr = (char**)calloc(cnt, sizeof(char *)); + + sp = strchr(et->name, ' '); + *sp = 0; + + sp = strchr(sp+1, ' '); + + for(i=0;iliteral_arr[i] = sp+1; + sp = sp2; + + newlen = fstUtilityEscToBin(NULL, (unsigned char*)et->literal_arr[i], strlen(et->literal_arr[i])); + et->literal_arr[i][newlen] = 0; + } + + for(i=0;ival_arr[i] = sp+1; + sp = sp2; + + newlen = fstUtilityEscToBin(NULL, (unsigned char*)et->val_arr[i], strlen(et->val_arr[i])); + et->val_arr[i][newlen] = 0; + } + } + } + +return(et); +} + + +void fstUtilityFreeEnumTable(struct fstETab *etab) +{ +if(etab) + { + free(etab->literal_arr); + free(etab->val_arr); + free(etab->name); + free(etab); + } +} diff --git a/vpi/fstapi.h b/vpi/fstapi.h index e66c20467..aef6de23b 100644 --- a/vpi/fstapi.h +++ b/vpi/fstapi.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2017 Tony Bybell. + * Copyright (c) 2009-2018 Tony Bybell. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -39,6 +39,7 @@ extern "C" { #define FST_RDLOAD "FSTLOAD | " typedef uint32_t fstHandle; +typedef uint32_t fstEnumHandle; enum fstWriterPackType { FST_WR_PT_ZLIB = 0, @@ -196,9 +197,10 @@ enum fstMiscType { FST_MT_SOURCESTEM = 4, /* use fstWriterSetSourceStem() to emit */ FST_MT_SOURCEISTEM = 5, /* use fstWriterSetSourceInstantiationStem() to emit */ FST_MT_VALUELIST = 6, /* use fstWriterSetValueList() to emit, followed by fstWriterCreateVar*() */ - FST_MT_UNKNOWN = 7, + FST_MT_ENUMTABLE = 7, /* use fstWriterCreateEnumTable() and fstWriterEmitEnumTableRef() to emit */ + FST_MT_UNKNOWN = 8, - FST_MT_MAX = 7 + FST_MT_MAX = 8 }; enum fstArrayType { @@ -228,7 +230,10 @@ enum fstEnumValueType { FST_EV_SV_UNSIGNED_LONGINT = 12, FST_EV_SV_UNSIGNED_BYTE = 13, - FST_EV_MAX = 13 + FST_EV_REG = 14, + FST_EV_TIME = 15, + + FST_EV_MAX = 15 }; enum fstPackType { @@ -324,11 +329,21 @@ union { }; +struct fstETab +{ +char *name; +uint32_t elem_count; +char **literal_arr; +char **val_arr; +}; + + /* * writer functions */ void fstWriterClose(void *ctx); void * fstWriterCreate(const char *nam, int use_compressed_hier); +fstEnumHandle fstWriterCreateEnumTable(void *ctx, const char *name, uint32_t elem_count, unsigned int min_valbits, const char **literal_arr, const char **val_arr); /* used for Verilog/SV */ fstHandle fstWriterCreateVar(void *ctx, enum fstVarType vt, enum fstVarDir vd, uint32_t len, const char *nam, fstHandle aliasHandle); @@ -337,9 +352,10 @@ fstHandle fstWriterCreateVar(void *ctx, enum fstVarType vt, enum fstVarDir fstHandle fstWriterCreateVar2(void *ctx, enum fstVarType vt, enum fstVarDir vd, uint32_t len, const char *nam, fstHandle aliasHandle, const char *type, enum fstSupplementalVarType svt, enum fstSupplementalDataType sdt); +void fstWriterEmitDumpActive(void *ctx, int enable); +void fstWriterEmitEnumTableRef(void *ctx, fstEnumHandle handle); void fstWriterEmitValueChange(void *ctx, fstHandle handle, const void *val); void fstWriterEmitVariableLengthValueChange(void *ctx, fstHandle handle, const void *val, uint32_t len); -void fstWriterEmitDumpActive(void *ctx, int enable); void fstWriterEmitTimeChange(void *ctx, uint64_t tim); void fstWriterFlushContext(void *ctx); int fstWriterGetDumpSizeLimitReached(void *ctx); @@ -422,8 +438,12 @@ void fstReaderSetVcdExtensions(void *ctx, int enable); /* * utility functions */ -int fstUtilityBinToEsc(unsigned char *d, unsigned char *s, int len); +int fstUtilityBinToEscConvertedLen(const unsigned char *s, int len); /* used for mallocs for fstUtilityBinToEsc() */ +int fstUtilityBinToEsc(unsigned char *d, const unsigned char *s, int len); int fstUtilityEscToBin(unsigned char *d, unsigned char *s, int len); +struct fstETab *fstUtilityExtractEnumTableFromString(const char *s); +void fstUtilityFreeEnumTable(struct fstETab *etab); /* must use to free fstETab properly */ + #ifdef __cplusplus } From acae85d1a4659b45405c926235735489d57beabe Mon Sep 17 00:00:00 2001 From: Cary R Date: Tue, 13 Nov 2018 21:58:22 -0800 Subject: [PATCH 19/27] Fix a space issue --- tgt-vhdl/stmt.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tgt-vhdl/stmt.cc b/tgt-vhdl/stmt.cc index 51ac8bb20..6d9c7f437 100644 --- a/tgt-vhdl/stmt.cc +++ b/tgt-vhdl/stmt.cc @@ -1250,7 +1250,7 @@ static void process_number(vhdl_binop_expr *all, vhdl_var_ref *test, switch (bits[i]) { case 'x': if (is_casez) break; - // fallthrough + // fallthrough case '?': case 'z': continue; // Ignore these. From edfe398e26e186dcadc81f83ad864c2af1e1eb4d Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Fri, 2 Nov 2018 21:22:10 +0000 Subject: [PATCH 20/27] Undo redefinition of unique_ptr at end of header files. It seems that clang both defines __cplusplus < 201103L and provides unique_ptr (GitHub issue #215). (cherry picked from commit 36120769432577e3abd12a182b97d605bd4572a6) --- pform_types.h | 4 ++++ vhdlpp/expression.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/pform_types.h b/pform_types.h index 0bd87d817..92061527e 100644 --- a/pform_types.h +++ b/pform_types.h @@ -380,4 +380,8 @@ extern std::ostream& operator<< (std::ostream&out, const pform_name_t&); extern std::ostream& operator<< (std::ostream&out, const name_component_t&that); extern std::ostream& operator<< (std::ostream&out, const index_component_t&that); +#if __cplusplus < 201103L +#undef unique_ptr +#endif + #endif /* IVL_pform_types_H */ diff --git a/vhdlpp/expression.h b/vhdlpp/expression.h index 303cdc063..f67de08b1 100644 --- a/vhdlpp/expression.h +++ b/vhdlpp/expression.h @@ -903,4 +903,8 @@ class ExpTime : public Expression { timeunit_t unit_; }; +#if __cplusplus < 201103L +#undef unique_ptr +#endif + #endif /* IVL_expression_H */ From bd4d73d9ae02b89b31ffa3b648fbac2dad1eb39f Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 15 Dec 2018 11:11:35 +0000 Subject: [PATCH 21/27] Fix GitHub issue #219 and #220 - incorrect results from SV size cast. (cherry picked from commit 230f0bc13c1adc695a68c0345340ac32ae3c495d) --- elab_expr.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/elab_expr.cc b/elab_expr.cc index 699c4f5d5..3901b5723 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -2535,7 +2535,13 @@ NetExpr* PECastSize::elaborate_expr(Design*des, NetScope*scope, ivl_assert(*this, size_); ivl_assert(*this, base_); - NetExpr*sub = base_->elaborate_expr(des, scope, base_->expr_width(), flags); + // When changing size, a cast behaves exactly like an assignment, + // so the result size affects the final expression width. + unsigned cast_width = base_->expr_width(); + if (cast_width < expr_width_) + cast_width = expr_width_; + + NetExpr*sub = base_->elaborate_expr(des, scope, cast_width, flags); // Perform the cast. The extension method (zero/sign), if needed, // depends on the type of the base expression. From 19444dd2fac0a44c96c24673d99d687fa03890a3 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 15 Dec 2018 12:26:33 +0000 Subject: [PATCH 22/27] Restrict cast type to what's allowed by the IEEE standard. (cherry picked from commit 7cd078e7ab184069b3b458fe6df7e83962254816) --- parse.y | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/parse.y b/parse.y index cfaa6617a..aa985085b 100644 --- a/parse.y +++ b/parse.y @@ -627,6 +627,7 @@ static void current_function_set_statement(const YYLTYPE&loc, vector %type list_of_variable_decl_assignments %type data_type data_type_or_implicit data_type_or_implicit_or_void +%type simple_type_or_string %type class_identifier %type struct_union_member %type struct_union_member_list @@ -1881,6 +1882,60 @@ signing /* IEEE1800-2005: A.2.2.1 */ | K_unsigned { $$ = false; } ; +simple_type_or_string /* IEEE1800-2005: A.2.2.1 */ + : integer_vector_type + { ivl_variable_type_t use_vtype = $1; + bool reg_flag = false; + if (use_vtype == IVL_VT_NO_TYPE) { + use_vtype = IVL_VT_LOGIC; + reg_flag = true; + } + vector_type_t*tmp = new vector_type_t(use_vtype, false, 0); + tmp->reg_flag = reg_flag; + FILE_NAME(tmp, @1); + $$ = tmp; + } + | non_integer_type + { real_type_t*tmp = new real_type_t($1); + FILE_NAME(tmp, @1); + $$ = tmp; + } + | atom2_type + { atom2_type_t*tmp = new atom2_type_t($1, true); + FILE_NAME(tmp, @1); + $$ = tmp; + } + | K_integer + { list*pd = make_range_from_width(integer_width); + vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, true, pd); + tmp->reg_flag = true; + tmp->integer_flag = true; + $$ = tmp; + } + | K_time + { list*pd = make_range_from_width(64); + vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd); + tmp->reg_flag = !gn_system_verilog(); + $$ = tmp; + } + | TYPE_IDENTIFIER + { $$ = $1.type; + delete[]$1.text; + } + | PACKAGE_IDENTIFIER K_SCOPE_RES + { lex_in_package_scope($1); } + TYPE_IDENTIFIER + { lex_in_package_scope(0); + $$ = $4.type; + delete[]$4.text; + } + | K_string + { string_type_t*tmp = new string_type_t; + FILE_NAME(tmp, @1); + $$ = tmp; + } + ; + statement /* IEEE1800-2005: A.6.4 */ : attribute_list_opt statement_item { pform_bind_attributes($2->attributes, $1); @@ -3773,7 +3828,7 @@ expr_primary } } - | data_type '\'' '(' expression ')' + | simple_type_or_string '\'' '(' expression ')' { PExpr*base = $4; if (gn_system_verilog()) { PECastType*tmp = new PECastType($1, base); From f62d7388131d92cb77b4ebd4fb285705f9369ddc Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Tue, 15 Jan 2019 19:58:37 +0000 Subject: [PATCH 23/27] Fix for GitHub issue #224 - import * does not import enum members. (cherry picked from commit e745304cc4256ad881e8dd41e0ec61623e965368) --- pform_package.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pform_package.cc b/pform_package.cc index 4c4b38440..6014acb7f 100644 --- a/pform_package.cc +++ b/pform_package.cc @@ -153,6 +153,11 @@ void pform_package_import(const struct vlltype&, PPackage*pkg, const char*ident) scope->imports[cur->first] = pkg; } + + for (set::const_iterator cur = pkg->enum_sets.begin() + ; cur != pkg->enum_sets.end() ; ++ cur) { + scope->enum_sets.insert(*cur); + } } } From 37b98bbe67cfdc26bbb62d6bb9229c429d21ea55 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 26 Jan 2019 16:47:28 +0000 Subject: [PATCH 24/27] Use LLONG_MIN instead of LONG_LONG_MIN. GCC 8 no longer defines LONG_LONG_MIN. We already assume a C99 compliant compiler in other places. (cherry picked from commit 2ff6af254be1b644f1e002b5f9e3300667b167c3) --- vvp/vthread.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vvp/vthread.cc b/vvp/vthread.cc index f2b1760cb..5f047e706 100644 --- a/vvp/vthread.cc +++ b/vvp/vthread.cc @@ -3771,7 +3771,7 @@ bool of_MOD_S(vthread_t thr, vvp_code_t) if (rv == 0) goto x_out; - if ((lv == LONG_LONG_MIN) && (rv == -1)) + if ((lv == LLONG_MIN) && (rv == -1)) goto zero_out; /* Sign extend the signed operands when needed. */ From 41c6a0e0fe4cf4daf7460c0412bd6de12727453c Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 26 Jan 2019 17:36:19 +0000 Subject: [PATCH 25/27] Fix assertion failure on assignment to part of variable member (GitHub issue #226) For now, output a "sorry" message, as the compiler doesn't support this. (cherry picked from commit dc5429e5e7186ec998a1dbe2dc19fac31f16e129) --- elab_lval.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/elab_lval.cc b/elab_lval.cc index eec2aabd1..84f6f2aae 100644 --- a/elab_lval.cc +++ b/elab_lval.cc @@ -1201,7 +1201,12 @@ bool PEIdent::elaborate_lval_net_packed_member_(Design*des, NetScope*scope, if (!name_tail.index.empty()) use_sel = name_tail.index.back().sel; - ivl_assert(*this, use_sel == index_component_t::SEL_NONE || use_sel == index_component_t::SEL_BIT); + if (use_sel != index_component_t::SEL_NONE && use_sel != index_component_t::SEL_BIT) { + cerr << get_fileline() << ": sorry: Assignments to part selects of " + "a struct member are not yet supported." << endl; + des->errors += 1; + return false; + } if (! name_tail.index.empty()) { From bd721c14838efd92e34e7f82b471aed80444ca81 Mon Sep 17 00:00:00 2001 From: Konst Mayer Date: Wed, 13 Mar 2019 00:14:58 +0700 Subject: [PATCH 26/27] Fix a typo in the man page (cherry picked from commit f95ae911d0c5f288af029f0d0c641059f8883865) --- driver/iverilog.man.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driver/iverilog.man.in b/driver/iverilog.man.in index fbbaa14a5..d08612b5b 100644 --- a/driver/iverilog.man.in +++ b/driver/iverilog.man.in @@ -264,7 +264,7 @@ that contain Verilog source files. During elaboration, the compiler notices the instantiation of undefined module types. If the user specifies library search directories, the compiler will search the directory for files with the name of the missing module type. If it -finds such a file, it loads it as a Verilog source file, they tries +finds such a file, it loads it as a Verilog source file, then tries again to elaborate the module. Library module files should contain only a single module, but this is From bda6e0ae3f4f292b92a87cf10bdb28d7fc2b0548 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 16 Mar 2019 12:40:08 +0000 Subject: [PATCH 27/27] Update README to say "or later" for build tool versions. (cherry picked from commit 9369d6db57fb32fe9a9f37d4960df7fae4858adb) --- README.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.txt b/README.txt index f47d03f5f..ae4d62dbc 100644 --- a/README.txt +++ b/README.txt @@ -1,5 +1,5 @@ THE ICARUS VERILOG COMPILATION SYSTEM - Copyright 2000-2004 Stephen Williams + Copyright 2000-2019 Stephen Williams 1.0 What is ICARUS Verilog? @@ -47,7 +47,7 @@ on a UNIX-like system: - bison and flex - - gperf 2.7 + - gperf 2.7 or later The lexical analyzer doesn't recognize keywords directly, but instead matches symbols and looks them up in a hash table in order to get the proper lexical code. The gperf @@ -56,7 +56,7 @@ on a UNIX-like system: A version problem with this program is the most common cause of difficulty. See the Icarus Verilog FAQ. - - readline 4.2 + - readline 4.2 or later On Linux systems, this usually means the readline-devel rpm. In any case, it is the development headers of readline that are needed. @@ -67,7 +67,7 @@ on a UNIX-like system: If you are building from git, you will also need software to generate the configure scripts. - - autoconf 2.53 + - autoconf 2.53 or later This generates configure scripts from configure.in. The 2.53 or later versions are known to work, autoconf 2.13 is reported to *not* work.