Commit Graph

42 Commits

Author SHA1 Message Date
Cary R 860761f9c6 More cppcheck fixes - part 2 2025-10-20 23:54:15 -07:00
Cary R 08c8ee081a More cppcheck updates 2025-10-20 23:54:15 -07:00
Martin Whitaker 673b0d3066 vvp: Only support one path separator in IVERILOG_VPI_MODULE_PATH (issue #608)
Previously both ':' and ';' were recognised as path separators on all
platforms, but ':' can't be used in Windows. So now we only recognise
';' when running in Windows and ':' when running in any other OS.
2022-03-25 22:04:43 +00:00
Martin Whitaker 3c58ca908d vvp: Fix error message output when a VPI module can't be found. 2022-03-25 20:23:47 +00:00
Martin Whitaker 2bf753fd8f vvp: Accept either \ or / as path separators in the -m option (issue #606).
Windows system calls will accept either of these. This is already done in
the iverilog driver.
2022-03-25 20:14:20 +00:00
Martin Whitaker 159af4d4ba In Windows, export VPI functions from vvp.exe (GitHub issue #395)
This is to support cocotb, who don't use our vpi_user.h and libvpi.a,
instead building their own import library to directly link to vvp.
2020-11-24 20:01:12 +00:00
Martin Whitaker e69549034d Fix potential buffer overflows (GitHub issue #346). 2020-07-28 13:17:57 +01:00
Martin Whitaker cf44f05cd3 Fix GitHub issue #324 - replace __CYGWIN32__ with __CYGWIN__.
__CYGWIN32__ is not defined when building with the 64-bit Cygwin
toolchain. According to the Cygwin FAQ, __CYGWIN__ has been defined
since 1998, so this should still work for users on 32-bit systems.
2020-05-10 14:06:53 +01:00
Martin Whitaker d1d409fd88 Add version check for VPI routines callback. 2019-10-30 20:16:30 +00:00
Martin Whitaker 3f1253039a Only use VPI routine jump table in Windows. 2019-10-25 10:07:57 +01:00
Martin Whitaker 79d3a21b65 Minor code tidy-up. 2019-10-22 21:52:52 +01:00
Martin Whitaker a59b183bd1 Allow VPI modules to be loaded by multiple clients under Windows.
The old scheme of linking the VPI modules with the vvp exports meant they
did not work when loaded by the compiler. Instead, let each client create
a jump table for the VPI routines and pass that to each VPI module as it
is loaded.
2019-10-22 16:00:13 +01:00
Stephen Williams c3d5b23ac4 Fix some Windows build issues. 2019-03-22 08:08:29 -07:00
Martin Whitaker 6887c31d8c Refactor vpi module path code.
Also restore the original behaviour of the '-M -' option, although it's
probably not needed now we add the default path last.
2018-10-29 20:33:52 +00:00
Alex Forencich a638d1eed0 Check for too many paths specified and fix path priority so paths specified on command line supersede built-in paths 2018-10-28 12:43:40 -07:00
Arun Persaud f5aafc32f9 updated FSF-address 2012-08-29 10:12:10 -07:00
Cary R a4a7b0a09d Make ivl_alloc.h the last include so it doesn't effect any system includes.
In ivl_alloc.h we redefine malloc(), realloc() and calloc() to have
standard error checking. We don't want to do this for anything that
comes from the standard headers. This specifically doesn't work if
a C++ header files does std::malloc, etc.

Also change to -W instead of -Wextra since that is more portable. I
plan to add a check from -Wextra and use it when available since it
is more descriptive.
2010-11-02 10:51:57 -07:00
Cary R cb86fb15bf Add error checking definitions for malloc(), realloc() and calloc()
This patch adds defines that translate all malloc(), realloc() and calloc()
calls into ones with error checking when ivl_alloc.h is included.
2010-10-14 17:39:23 -07:00
Cary R 1993bf6f69 Remove malloc.h support and for C++ files use <c...> include files.
The functions (malloc, free, etc.) that used to be provided in
malloc.h are now provided in cstdlib for C++ files and stdlib.h for
C files. Since we require a C99 compliant compiler it makes sense
that malloc.h is no longer needed.

This patch also modifies all the C++ files to use the <c...>
version of the standard C header files (e.g. <cstdlib> vs
<stdlib.h>). Some of the files used the C++ version and others did
not. There are still a few other header changes that could be done,
but this takes care of much of it.
2010-06-01 08:56:30 -07:00
Martin Whitaker 4818db887e Fix for LXT/LXT2 output using MinGW.
When using MinGW, routines registered via atexit() inside a
DLL are only called when the DLL is detached. If not detached
manually, DLLs are automatically detached *after* all remaining
open files are closed. This meant that by the time the LXT or
LXT2 close_dumpfile routine was called, the dump file handle
was no longer valid, so any remaining output was lost. This
patch fixes the problem by manually detaching the VPI modules.
2010-02-08 21:07:45 -08:00
Cary R 7b1905b997 Add memory freeing and pool management for valgrind.
This patch adds code to free most of the memory when vvp
finishes. It also adds valgrind hooks to manage the various
memory pools. The functionality is enabled by passing
--with-valgrind to configure. It requires that the
valgrind/memcheck.h header from a recent version of
valgrind be available. It check for the existence of this
file, but not that it is new enough (version 3.1.3 is known
to not work and version 3.4.0 is known to work).

You can still use valgrind when this option is not given,
but you will have memory that is not released and the
memory pools show as a single block.

With this vvp is 100% clean for many of the tests in the
test suite. There are still a few things that need to be
cleaned up, but it should be much easier to find any real
leaks now.

Enabling this causes a negligible increase in run time and
memory. The memory could be a problem for very large
simulations. The increase in run time is only noticeable on
very short simulations where it should not matter.
2009-02-01 06:55:28 -08:00
Cary R c419e77710 More end of simulation memory cleanup.
This patch adds some more memory freeing routines to vvp and
the vpi library. Much more to do before this is finished.
2009-01-25 07:40:28 -08:00
Cary R 3bce8bb995 GetProcAddress expects no underscore (MinGW)
MinGW uses the GetProcAddress() function to find the address of
the vlog_startup_routines() procedure in a .vpi file. This routine
requires that the leading underscore be omitted from the name even
though the underlying routine really has one.
2008-09-30 21:51:28 -07:00
Larry Doolittle d9ac146b8f Spelling fixes
only comments and documentation
some punctuation and capitalization for good measure
Changelogs are purposefully untouched
2008-01-29 20:24:24 -08:00
steve e4ae832153 Clean up spurious trailing white space. 2004-10-04 01:10:51 +00:00
steve 9a232d545d Completely support vvp32 when enabled. 2003-10-08 23:09:09 +00:00
steve 52b756a6fa Configure control for the vpi subdirectory. 2003-10-02 21:30:40 +00:00
steve 66785b7997 Support .vpl files as loadable LIBRARIES. 2003-02-16 02:21:20 +00:00
steve b726395d1e Spelling fixes. 2003-02-09 23:33:26 +00:00
steve 301cbe31ad Remove vpithunk, and move libvpi to vvp directory. 2003-01-10 03:06:32 +00:00
steve 52bf4e613f conditional ident string using autoconfig. 2002-08-12 01:34:58 +00:00
steve b1c0f7306d Add vpi support for named events.
Add vpi_mode_flag to track the mode of the
 vpi engine. This is for error checking.
2002-05-18 02:34:11 +00:00
steve 01b9d5e023 Better linker error messages. 2002-03-05 05:31:52 +00:00
steve ad44b411fb Try appending .vpi to module names with directories. 2001-10-14 18:42:46 +00:00
steve 537757a7b9 Cleanup defines and types for mingw compile. 2001-07-30 02:44:05 +00:00
steve 140533db50 If module name has a /, skip the path search. 2001-07-28 03:29:42 +00:00
steve c5234e95cd Make the -M flag add module search paths. 2001-07-26 03:13:51 +00:00
steve b6e1d63cb0 Change the VPI call process so that loaded .vpi modules
use a function table instead of implicit binding.
2001-06-12 03:53:10 +00:00
steve 660fd7c1d4 Update the mingw build to not require cygwin files. 2001-05-22 02:14:47 +00:00
steve 2858c2f09b Add the :module header statement. 2001-03-23 02:40:22 +00:00
steve 715d140d85 Test print that interferes with output. 2001-03-22 05:39:34 +00:00
steve f2c1902984 Add structures for VPI support, and all the %vpi_call
instruction. Get linking of VPI modules to work.
2001-03-16 01:44:34 +00:00