Commit Graph

1878 Commits

Author SHA1 Message Date
Cary R a151407ca4 Update the flag count from 256 to 512 2020-05-31 12:51:41 -07:00
Cary R 5fbb98bdbb Update find_scope and vpi_handle_by_name to work with escaped identifiers 2020-05-02 19:49:00 -07:00
Greg Steuck b7c9df2fd5 Fix bad bounds check in for loop
(cherry picked from commit 398d0cb82f)
2020-02-08 20:18:03 +00:00
Martin Whitaker 21ca8360fe Improve vvp handling of excessively large shift distances.
(cherry picked from commit 351a4e5f5e)
2019-11-16 12:28:45 +00:00
Martin Whitaker b13b608744 Fix vvp %shift instructions to treat right operand as unsigned.
1364-2005 section 5.1.12 says "The right operand is always treated
as an unsigned number".

This fixes GitHub issue #283.

(cherry picked from commit 0a4cae2644)
2019-11-16 12:28:37 +00:00
Martin Whitaker 4914f83ae3 Schedule UDP initial 0/1 assignments to occur during time 0.
This allows any always processes that are sensitive to the UDP output
to start first. This fixes a time 0 race that was found in a Lattice
Semiconductor simulation library (reported on iverilog-devel).

If the initial value is 'x', propagate the value to the UDP output
before the start of simulation, to avoid unwanted update events on
the z -> x transition on downstream nets.

(cherry picked from commit 3bdb50da29)
2019-08-09 21:09:44 +01:00
Martin Whitaker 2546631874 Fix for GitHub issue #256 - don't use V as Makefile variable name.
Some build systems override V on the make command line, wrongly assuming
it is the automake verbose option.

(cherry picked from commit 866cc46915)
2019-08-02 10:32:51 +01:00
Martin Whitaker 564c7404a6 Fix initialisation of vvp symbol table values.
In 64-bit Windows, an unsigned long is 32 bits, so initialising the num
member of the union did not properly initialise the ptr member. The num
member isn't actually needed, so eliminate it.

(cherry picked from commit c383d2048c)
2019-08-01 13:00:26 +01:00
Martin Whitaker e834302875 Fix VPI interface to APV objects.
- type is vpiPartSelect, not vpiMemoryWord
- left/right range is for part, not full word
- index is not valid for a part select

The user will now get a sensible error message if they pass part of an
array word to $dumpvars (GitHub issue #230).

(cherry picked from commit 8402696676)
2019-07-25 09:03:04 +01:00
Martin Whitaker 5b5c0f5c69 Fix GitHub issue #243 - support arbitrary width static bit arrays in vvp.
(cherry picked from commit 8cd8bed22e)
2019-07-24 09:17:08 +01:00
Martin Whitaker 5a9a4c4f94 Fix makefile rules for header files generated by bison.
bison 3.4.1 writes the header file before the c++ file. Our makefile
rules make the header files depend on the c++ files, so we need to
fix the timestamps accordingly.

(cherry picked from commit 5bb6c7f53a)
2019-06-02 19:56:42 +01:00
Martin Whitaker 7399f3744b Fix for GitHub issue 235: segfault when calling vpi_handle_by_name().
When vpi_handle_by_name() iterates over the VPI objects in a scope, handle
the case that vpi_get_str() returns a null value. This currently occurs if
the scope contains an enum type definition, as vpi_get_str() is not
implemented for __vpiEnumTypespec.

(cherry picked from commit 51a13e883a)
2019-03-23 17:31:07 +00:00
Martin Whitaker 37b98bbe67 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 2ff6af254b)
2019-01-26 17:49:49 +00:00
Martin Whitaker 10e7eb55ce Fix bit width when converting real value to binary/hex string in VPI.
(cherry picked from commit 5aae9ea770)
2018-10-08 22:11:16 +01:00
Martin Whitaker 4cb9ae0aa2 SIGHUP is not available in Windows.
(cherry picked from commit 3e25b04685)
2018-10-08 22:10:13 +01:00
Martin Whitaker de63c0cedb Fix implicit fallthrough warnings when building with recent GCC.
(cherry picked from commit f1608e163f)
2018-10-08 22:09:50 +01:00
Martin Whitaker c5df4cfcad Cleanly terminate vvp on SIGHUP or SIGTERM (GitHub issue #203).
(cherry picked from commit 603ff303f5)
2018-10-08 21:50:48 +01:00
Martin Whitaker dc6fc7ee77 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 542fe2cf77)
2018-10-06 11:56:35 +01:00
Martin Whitaker 52b136d8a8 Fix for GitHub issue #198 - support octal display for thread variables.
(cherry picked from commit 11c826216a)
2018-06-12 23:00:53 +01:00
Martin Whitaker 703363feaf Fix for GitHub issue #199: handle signed division overflow.
When performing a signed division or modulus operation using native
arithmetic, trap the special case that the numerator is the minimum
integer value and the denominator is -1, as this gives an undefined
result in C++.

(cherry picked from commit 7ad5b59a6f)
2018-06-12 23:00:34 +01:00
Martin Whitaker 7df0f0c659 Further fix for br1029.
The code in vpi_callback.cc is replicated in vpi_vthr_vector.cc,
so we have to replicate the fix. This should really be factored
out.

(cherry picked from commit 6e49ab10ec)
2018-05-14 22:23:46 +01:00
Martin Whitaker 24731227b4 Fix br1029 - correct rounding when vpi_get_value converts real to integer string.
(cherry picked from commit 5a4e99b0e8)
2018-05-12 23:57:42 +01:00
Yury Gribov 0f28b03dd3 Put start events to proper queue.
(cherry picked from commit 43cd693fe0)
2018-03-10 12:22:35 +00:00
Martin Whitaker 02e220097d Implement supply->strong strength reduction for non-resistive switches.
As specified in 1364-2005 section 7.11.

(cherry picked from commit 36eef5154f)
2018-02-23 22:32:52 +00:00
Cary R cc3e9d791a Update flex destroy to work for version 2.6 and greater 2017-11-16 19:17:50 -08:00
Martin Whitaker 03764a400d Fix assertion failure in vvp wide functor.
If the functor output is read before any values have propagated to
the functor inputs, the internal storage won't have been initialised.

(cherry picked from commit ad83a135e5)
2017-11-08 20:54:25 +00:00
Martin Whitaker 99f66e2781 Fix for GitHub issue #169: nets can get given wrong scope in VPI.
In vvp, the __vpiSignal object holds a pointer to the scope containing
the signal. This was getting set to the current scope when the net was
finally resolved, rather than to the scope where the net was declared.

(cherry picked from commit c622d372f9)
2017-11-07 19:25:02 +00:00
Martin Whitaker 1f7588d3a4 Add support for darray initialisation from another darray.
Fixes GitHub issue #164.

(cherry picked from commit 5ca058bfb5)
2017-10-08 17:53:53 +01:00
Martin Whitaker bccb7e7def Fix for GitHub issue #165 : assertion failure on thread join.
If a thread becomes detached due to a join_any statement, that
thread must not attempt to join its parent, even if the parent
is waiting on a subsequent join statement.

(cherry picked from commit e315cafa01)
2017-10-07 16:46:49 +01:00
Martin Whitaker a3a8669c6f Fix error in last commit.
(cherry picked from commit a1a7f5deff)
2017-09-17 21:24:50 +01:00
Martin Whitaker 885e25120a Fix use after free bug in vvp when a task or function is disabled.
Use test_joinable() and do_join() to ensure everything gets cleaned
up before the thread is reaped. This should fix br1016, br1017, and
br1018.

(cherry picked from commit 0bed890bc6)
(and subsequent fixup)
2017-09-17 20:01:14 +01:00
Martin Whitaker 8cd697fd24 Fix for br1019 - allow multiple array words to be attached to a vpi callback.
Normally there is at most one signal attached to a vvp functor, but
due to port collapsing, there can be more than one. If these signals
are array words, we need to trigger vpi callbacks on all the associated
arrays when the functor value changes.

(cherry picked from commit ac87138c44)
2017-08-12 12:31:14 +01:00
Cary R 306d2fb53b V10: Fix class versus struct warning in clang 2017-06-19 21:26:35 -07:00
Martin Whitaker ce7f28202a Ensure value passed to named event via vpi_put_value() is initialised.
The __vpiNamedEvent::vpi_put_value() function ignores the value, but
intermediate code looks at it.

(cherry picked from commit e2be64558b)
2017-06-15 09:15:31 +01:00
Martin Whitaker 49bea6a01a Implement vpi_put_value() for named events (GitHub issue #158).
(cherry picked from commit 3de7c234f7)
2017-06-15 08:52:15 +01:00
Maciej Suminski 6e460a6a3f Fixed warnings about shifting a negative value 2016-10-14 23:41:11 +01:00
Martin Whitaker 9b55a3d67f Support timescales in design units that aren't inside a module.
SystemVerilog allows tasks, functions, and classes to be defined at the
root level or inside packages, so we can't rely on an enclosing module
being present to provide the timescale.

(cherry picked from commit 7bed181f68)
2016-07-23 00:15:15 +01:00
Martin Whitaker 86968e3752 Fix for GitHub issue #106 - prevent VPI writes during read-only synch.
(cherry picked from commit 8234f1845d)
2016-06-09 21:29:32 +01:00
Martin Whitaker 06f6a72770 Fix for GitHub issue #103 - vvp assertion failure on part select propagation.
The implementation of vvp_fun_part_pv::recv_vec4_pv was incorrect, and
propagated the incoming widths rather than the stored widths.

(cherry picked from commit 0c66116f51)
2016-05-10 22:41:58 +01:00
Maciej Suminski 161cebb178 vvp: Corrected vvp_net_fun_t::recv_vec4_pv() (commit de968e18)
(cherry picked from commit 9cf1dcbae2)
2016-04-19 21:04:48 +01:00
Martin Whitaker 2689ebacfe Extended fix for GitHub issue #99.
Most vvp functors need to support recv_vec4_pv. Any that are strength-aware
also need to support recv_vec8_pv. Note the simplifying assumption that is
documented in the base class recv_vec4_pv_ implementation.

(cherry picked from commit 6e5ed73b09)
2016-04-19 20:46:55 +01:00
Martin Whitaker 72fc3d712d For SystemVerilog, run variable initialization before main simulation starts.
(cherry picked from commit 54feb89bf5)
2016-04-19 20:41:25 +01:00
Martin Whitaker 9be3fc3a56 Fix GitHub issue #99 - recv_vec4_pv not implemented for arithmetic functors.
Also initialise the stored operand values to 'bz instead of 'bx to get
the correct results when bits are not driven.

(cherry picked from commit b2f7d09f0d)
2016-04-04 22:41:10 +01:00
Larry Doolittle aa2260f4fa Capitalize Verilog in a few places
(cherry picked from commit 89edf62206)
2016-04-02 22:42:26 +01:00
Cary R ed7d6c1002 Fix memory leak found with valgrind 2015-12-13 14:56:49 -08:00
Cary R a4306dbac1 Fix the modpath delay to ignore bits that are not changing 2015-10-21 22:02:17 -07:00
Cary R 643e0a984e Fix some cppcheck warnings 2015-10-02 09:44:02 -07:00
Stephen Williams 4803f0d12b Rework vvp file version checking. 2015-08-17 15:38:27 -07:00
Martin Whitaker be44289fc0 Updated a few more copyright dates. 2015-08-17 22:23:43 +01:00
Larry Doolittle cb73accd84 Spelling fixes 2015-08-17 11:34:58 -07:00