Commit Graph

2028 Commits

Author SHA1 Message Date
Martin Whitaker 1f4e65ee08 vvp: Fix implementation of strndup for Windows (issue #608).
The maximum length to copy, n, does not include the terminating null
character.

(cherry picked from commit 4c36b2a8a7)
2022-03-25 21:07:52 +00:00
Martin Whitaker 5aef565b94 vvp: Fix error message output when a VPI module can't be found.
(cherry picked from commit 3c58ca908d)
2022-03-25 21:07:42 +00:00
Martin Whitaker 20b5377989 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.

(cherry picked from commit 2bf753fd8f)
2022-03-25 21:07:32 +00:00
Martin Whitaker 598363de84 vvp: ensure array ports are added to the correct context (issue #621)
Array ports are created via a resolve list. We need to detect and
record whether they need to be created in an automatic context at
the point they are declared, not at the time they are created.

(cherry picked from commit b3f7ce6020)
2022-03-21 20:10:43 +00:00
Stephen Williams 899a240311 Add more types to vvp-stop
Several scope types were not understood by the push command, and
a few types were not displayed reasonably. Flesh these out.

(cherry picked from commit de579f2650)
2022-02-26 12:19:16 -08:00
Miodrag Milanovic 687dc0c751 Fix for cross compile build
(cherry picked from commit 1341dee0e6)
2021-12-31 09:45:34 +00:00
Cary R 56d69f498b Fix valgrind compile to work with new using std reorg 2021-11-10 18:21:23 -08:00
Martin Whitaker 97b5ac91cb Remove "using namespace std" from vvp header files and fix the fallout.
(cherry picked from commit 9cc09b8513)
2021-11-04 19:32:09 +00:00
Martin Whitaker 9ac6154068 Handle run-time out-of-bounds access for wire real arrays (issue #556).
(cherry picked from commit 3dda39bce3)
2021-11-04 18:48:22 +00:00
Martin Whitaker b45a52a164 Fix .event/or connectivity when inputs have multiple fanout (issue #508).
The old implementation connected all inputs to the same vvp_net_t port,
on the basis that we don't care about the data values or what port they
arrived on. But if one or more of the inputs fans out to multiple nets,
the chains get tangled, which either results in connections being lost
or inappropriate connections being made, depending on the order that
the inputs are linked.

This could have been fixed by using a standard wide functor. But as we
don't care about the data values, that would be unnecessary overhead.
We just need separate vvp_net_t objects to handle the input connectivity
and can keep using a single shared functor.

(cherry picked from commit 1f8876be1c)
2021-05-18 10:08:01 +01:00
Martin Whitaker 69cf8d8901 Add support for vpiInstance as the type code in calls to vpi_iterate().
This is needed for the waveform dumpers now that vpi_iterate(vpiModule, NULL)
has been ficed to only return modules.

This includes recognising vpiProgram and vpiInterface, although the compiler
and vvp currently incorrectly classify them as modules.

(cherry picked from commit d2521878d7)
2021-04-21 11:41:51 +01:00
Martin Whitaker adb4be5c75 Don't return packages when iterating over root modules (issue #496)
The code assumed all handles stored in vpip_root_table were modules. This
is true for traditional Verilog, but not so for SystemVerilog.

Whilst here, also add support for iterating over packages.

(cherry picked from commit 3167b2ed24)
2021-04-18 10:53:34 +01:00
Martin Whitaker d56efebbfe Fix build with clang.
(cherry picked from commit aae3a570c2)
2021-01-03 19:50:05 +00:00
Martin Whitaker 48615fb8ac Fix warnings about implicit copy assignments.
(cherry picked from commit 51a171a399)
2021-01-03 19:49:06 +00:00
Martin Whitaker eec64de190 Fix vvp segfault on Windows when vvp_net_ptr_t values exceed 4GB.
Under Windows unsigned long is 32 bits, so we must use unsigned long long
values for 64-bit address masks.

(cherry picked from commit 0d6a2f95a8)
2020-12-05 21:08:30 +00:00
Martin Whitaker 580170d974 Fix segfault under mingw32 due to dynamic cast of invalid pointer value.
sync_cb::run_run() attempts to cast the obj field of the callback data to a
__vpiSysTaskCall pointer. But a sync_cb object is only used for simulation
time callbacks, where the obj field is (mostly) not used, so I can't see
that would ever succeed. As the obj field is not required to be set by the
user, the dynamic cast results in undefined behaviour, so mingw32 is not to
blame.

This code was introduced by Johann Klammer in commit c79df7c44, but the user
klammerj and all trace of that pull request have vanished from GitHub, and
there is no associated regression test, so I can't establish the rationale
for it.

(cherry picked from commit 8da8261fc3)
2020-12-05 21:02:27 +00:00
Martin Whitaker 4598341e85 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.

(cherry picked from commit 159af4d4ba)
2020-11-24 20:04:26 +00:00
Cary R ae0ee87363 Update some queue code since deques support random access 2020-11-14 20:31:27 -08:00
Stephen Williams fec003bd36 vvp: Remove a dead rule for the .port_info statement.
We left an old rule that matched a port_info statement without a
trailing semicolon. Remove that rule ahead of the release.
2020-09-22 14:18:24 -07:00
Martin Whitaker 10685ed89d Remove redundant test for whether a vvp thread is joinable.
Since commit 15cda5fe, forked threads are never embedded in the parent
thread, so we no longer need the special case code that ensured that
task/function calls were reaped before a join.

This also fixes GitHub issue #368.
2020-09-11 21:18:54 +01:00
Martin Whitaker bd0a1c75ed Add support for string values in event expressions (GitHub issue #365). 2020-08-23 11:06:15 +01:00
Martin Whitaker a69de8b94a Rework last value storage in vvp_fun_anyedge functors.
This prepares the way to support strings and object handle values.
2020-08-23 11:04:44 +01:00
Cary R 0a69303164 Refactor array store for string/real and skip saving when given an undefined index 2020-08-16 19:49:34 -07:00
Cary R 505ee1a96c Refactor store for real/string 2020-08-16 19:23:41 -07:00
Cary R aa013a0ef0 Refactor store prop 2020-08-16 19:08:34 -07:00
Cary R 4bf502741d Refactor store DAR 2020-08-16 18:37:28 -07:00
Cary R 8e3afebb7b Refactor set DAR object 2020-08-16 18:00:41 -07:00
Cary R 43441066eb More refactoring in vthread 2020-08-13 23:28:18 -07:00
Cary R f3e4287d0a Refactor prop routines to use common template 2020-08-13 22:30:21 -07:00
Cary R 52c3b901e0 When available print file/line information with thread error messages 2020-08-13 22:05:31 -07:00
Cary R 294005c5b2 Refactor load DAR routines 2020-08-13 21:48:52 -07:00
Cary R 3993241d04 Refactor more of the queue code 2020-08-11 19:46:36 -07:00
Cary R f6d8cfc80c Add file/line to Sorry queue message 2020-08-11 19:46:22 -07:00
Cary R 112ebb48d8 Add file/line information to procedural warnings and darray fixes
When -pfileline=1 is used the queue procedural warnings have file
and line information added to the messages. Also switch the trace
debugging to be off by default.

Also, Add some preliminary missing darray functionality.
2020-08-10 22:01:55 -07:00
Cary R bff115b9f7 Add initial support for assigning between queues and darrays 2020-08-07 00:23:43 -07:00
Cary R a0ef23605a Update some functions to use inline 2020-08-04 22:11:36 -07:00
Cary R 538a03ba8e Add templates for queue push 2020-08-04 22:07:02 -07:00
Cary R f638e9dd5d Add templates for queue pop 2020-08-04 21:48:47 -07:00
Cary R 84eb70660d Switch qinsert to use a template 2020-08-04 21:14:17 -07:00
Cary R d1d6c0f5d2 Start refactoring the queue routines 2020-08-03 23:45:56 -07:00
Cary R 199ed39abe Report when the array pattern is larger than the maximum queue size 2020-08-02 23:40:35 -07:00
Martin Whitaker 8e4cc8e887 Use GNU make pattern rules to handle multiple file output from bison.
With a pattern rule, the recipe will only be executed once, even when
the rule has multiple targets. Using this to handle the output from
bison is included as an example in the GNU make manual.

This fixes the makefiles so that bison-generated header files will be
regenerated if they are deleted.
2020-07-30 16:27:01 +01:00
martinwhitaker a4c9919e3a
Merge pull request #349 from hzeller/fix-bison-include
Bison includes its generated header in *.cc. Generate with correct name.
2020-07-30 15:53:21 +01:00
Cary R a2ba8a16b1 Add support for inserting into a queue 2020-07-29 23:00:19 -07:00
Henner Zeller 5b699c1be7 Bison includes its generated header in *.cc. Generate with correct name.
The current bison (3.7) generates a *.cc file that includes the header
it generated. For parse.cc this would be parse.hh. Right now, we rename
this header to have a common name used in other files, but this results
in a compile error for the parse.cc file:

parse.cc:462:10: fatal error: parse.hh: No such file or directory
  462 | #include "parse.hh"
      |          ^~~~~~~~~~

Fix this by telling bison to output the header file to the correct
filename in the first place so that we don't have to rename it.
(using the --defines instead of -d option).

This looks like a bison specific option not available in Posix yacc;
but looks like we're requiring bison anyway.

Signed-off-by: Henner Zeller <h.zeller@acm.org>
2020-07-29 15:29:08 -07:00
Martin Whitaker e69549034d Fix potential buffer overflows (GitHub issue #346). 2020-07-28 13:17:57 +01:00
Cary R fdd902e446 Remove some clang warnings 2020-07-27 21:56:29 -07:00
Cary R 14ade1a9f4 Pass the max size when storing to a queue 2020-07-27 21:24:22 -07:00
Cary R c969c324ed Add initial support for using a queue element as an L-value 2020-07-26 14:02:29 -07:00
Cary R d1b75d9407 Update some queue warning messages and optimize element erase 2020-07-25 15:32:28 -07:00