Commit Graph

140 Commits

Author SHA1 Message Date
Cary R dc8b7d0184 Cleanup some cppcheck warnings 2022-12-28 00:00:31 -08:00
Lars-Peter Clausen 2346cc8b69 vvp: Implement partial writes to 2-state arrays
Writes to 2-state arrays currently only support full writes. If the write
is a partial write it will trigger an assert. E.g.

```
int a[3:0]
int i = -1;
a[i+:8] = 8'h0; // Triggers assert
```

Add support for partial writes by doing a read-modify-write in the same way
as for 4-state arrays.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-06-12 16:14:30 +02:00
Lars-Peter Clausen 2032e14f5a vvp: Remove `wid` parameter from `recv_vec{4,8}_pv()`
The `recv_vec{4,8}_pv()` functions are used to implement a partial write to
a vector. As parameters they take both the value and the width of the
value.

All callers of of these functions pass `val.size()` or a variation thereof
as the width of the value. And all implementations that do anything with
the data have an assert that `val.size() == wid`.

Remove the `wid` parameter from these functions and just use `val.size()`
directly where needed. This allows to simplify the interface and also
to remove the asserts.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-05-28 15:34:02 +02:00
Martin Whitaker b3f7ce6020 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.
2022-03-21 19:57:05 +00:00
Martin Whitaker 9cc09b8513 Remove "using namespace std" from vvp header files and fix the fallout. 2021-11-04 17:02:07 +00:00
Martin Whitaker 3dda39bce3 Handle run-time out-of-bounds access for wire real arrays (issue #556). 2021-11-03 17:50:45 +00:00
Cary R 7299625ab5 Cleanup vvp with suggestions from cppcheck 2021-01-02 13:53:18 -08:00
Cary R 0fca1bdab0 Add vpiIndex for array words 2020-05-31 14:27:19 -07:00
Martin Whitaker 8402696676 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).
2019-07-25 08:58:00 +01:00
Martin Whitaker 8cd8bed22e Fix GitHub issue #243 - support arbitrary width static bit arrays in vvp. 2019-07-24 09:15:44 +01:00
Stephen Williams f275dac7a8 Kill a bunch of __vpiScope struct vs class warnings. 2015-12-27 11:37:10 -08:00
Stephen Williams fff69390ac C++-ify the __vpiScope classes. 2015-12-20 20:26:57 -08:00
Stephen Williams b83144c552 The __vpiArray::set_word method should take a reference.
Seem to have missed a case where a vvp_vector4_t can be passed by
const reference instead of by value.
2014-12-02 13:02:46 -08:00
Stephen Williams 38f277d81b Merge branch 'master' into vec4-stack
Conflicts:
	vvp/array.cc
	vvp/vthread.cc
2014-12-02 11:21:58 -08:00
Maciej Suminski 1834d470cb vvp: Refactored __vpiArrayVthrA & __vpiArrayVthrAPV. 2014-11-28 14:14:42 +01:00
Maciej Suminski 9bc463aac0 vvp: Moved array_word_change(), array_attach_word(), array_alias_word() to __vpiArray. 2014-11-28 14:14:42 +01:00
Maciej Suminski 7c77097f71 vvp: array_[set/get]_word changed to __vpiArray::[set/get]_word. 2014-11-28 14:14:42 +01:00
Maciej Suminski cc4c5f4998 vvp: Changed get_array_word_size(vvp_array_t) to __vpiArray::get_word_size(). 2014-11-28 14:14:42 +01:00
Maciej Suminski 4ddef32631 vvp: __vpiArray::get_word_value handles StrVal variants. 2014-11-28 14:14:42 +01:00
Maciej Suminski a236c274f3 vvp: Minor changes. 2014-11-28 14:14:42 +01:00
Maciej Suminski ca2ef5c956 vvp: Cleaning. 2014-11-28 14:14:39 +01:00
Maciej Suminski 6015aceda2 vvp: vpiArrayIterator::vpi_index core moved to vpiArrayBase::get_iter_index. 2014-11-28 14:14:37 +01:00
Maciej Suminski 9538501b54 vvp: Moved __vpiArrayBase::vpi_iterate to __vpiArayBase::vpi_array_base_iterate. 2014-11-28 14:12:49 +01:00
Maciej Suminski ea7fa24f9e vvp: Further extraction of common code pieces from ArrayBase. 2014-11-28 14:12:46 +01:00
Maciej Suminski 48d3701c02 vvp: get_word_index() & get_word_parent() moved to __vpiArrayWord. 2014-11-28 14:12:43 +01:00
Maciej Suminski c1164dcc33 vvp: Initial work on support for dynamic arrays in VPI.
Added array_common.[ch] to store shared code.
2014-11-28 14:12:37 +01:00
Maciej Suminski 1166cd932a vpi: Handle new formats in vpi_get_value() for unpacked arrays.
It is possible to use vpiIntVal, vpiVectorVal, vpiRealVal,
vpiStringVal and vpiObjTypeVal to retrieve data from unpacked
array cells.
2014-11-27 17:36:23 +01:00
Stephen Williams 725ed869ba Remove dead %load/vp0 instructions and related infrastructure
Also remove some &A<> and &PV<> symbols that use this now dead
infrastructure.
2014-11-19 09:02:21 -08:00
Stephen Williams dec4cd5071 Handle arrays of class objects.
This goes all the way down to the vvp level, where we create support
for arrays of objects, generate the new code in the -tvvp code
generator, and elaborate the arrays in the first place.
2014-08-30 10:18:57 -07:00
Stephen Williams b991a991a7 Implement vpi_handle(vpiLeft/RightRange, ...) for signals.
This returns a constant object that can be treated like an
expression, so following the letter of the LRM.
2014-07-14 17:15:16 -07:00
Cary R 283ae6e538 Fix some cppcheck warnings in vvp. 2013-04-15 12:28:35 -07:00
Martin Whitaker e99d53b80b Stopgap fix for br916.
Currently, when a variable expression is passed to a system task,
the expression value is stored in thread memory. Values stored
in thread memory cannot safely be passed to $strobe or $monitor,
because the thread memory may get reused or deallocated before
the $strobe or $monitor task actually executes. As a temporary
measure, we just trap this case and terminate with a "sorry"
message. A proper fix would require the expression value to be
calculated at the time the $strobe or $monitor executes, not at
the time it is called.
2013-02-04 11:45:11 -08:00
Martin Whitaker cd239a9857 Fix display of net array words when data type is signed.
When VVP compiles a .array statement for a net array, it does not
know the data type, so initialises the array signed_flag to false.
We need to set the signed_flag to the correct value once we know
the data type, to allow the VPI routines to correctly format the
data.
2013-01-21 18:46:48 -08:00
Stephen Williams d04aa4b234 Merge branch 'master' of github.com:steveicarus/iverilog 2013-01-05 16:40:14 -08:00
Stephen Williams 074055bc58 Implement static arrays of strings.
This means extending the vvp to add .array/str objects and
include instructions to access the array. Also add the parser
and code generator support.
2013-01-05 15:57:58 -08:00
Cary R 1305d7659c Remoce space issues. 2013-01-03 16:21:24 -08:00
Cary R 502a0708ea Merge branch 'master' of github.com:steveicarus/iverilog 2013-01-03 16:19:18 -08:00
Cary R c64407f7cf Cleanup new darray in array structure
The valsr real array support was switched to a dynamic array vals. This
patch updates teh valgrind cleanup code to use the correct name.
2013-01-03 16:18:59 -08:00
Stephen Williams fbd2843cad Runtime support for arrays of atom2 types.
This handles all of the atom integer types in unpacked arrays.
2013-01-03 11:33:47 -08:00
Stephen Williams 1527b87595 Remove useless vvp_realarray_t
The vvp_darray_real class cal be used for static arrays as well
and this is a more general solution anyhow. Kill the now useless
vvp_realarray_t class.
2013-01-02 19:02:02 -08:00
Cary R 60b1ade52d Add support for valgrind cleanup of APV in task call. 2013-01-01 16:54:04 -08:00
Cary R f957deeca7 Get the vvp code to compile with the valgrind hooks again.
This patch updates the vvp code so it will compile with the valgrind hooks
again. There are still new constructs that need to be cleaned up correctly
and some old constructs were changed enough that the old code no longer
works, but the rest of this can be done as an incremental improvement.
2012-10-08 18:53:55 -07:00
Arun Persaud f5aafc32f9 updated FSF-address 2012-08-29 10:12:10 -07:00
Larry Doolittle 0aefcf9b48 Trivial fixes to grammar, spelling, whitespace 2012-02-17 16:18:22 -08:00
Cary R 391073a750 Update __vpiNamedEvent to remove struct and remove extra class statements
The clang compiler does not like using struct to reference a class object.
This patch removes all the struct keywords for __vpiNamedEvent objects
since they are now a class and can be called without a struct/class
qualifier.

This patch also removes all the extra class qualifiers from the rest of
the source code.
2012-02-12 13:22:32 -08:00
Stephen Williams 5677efdfe6 Filter callbacks of value changes to array words.
When looking for a value change on a part select of an array word,
the callback handle has to save the current value and test it with
the new value to see if there is an actual change. If not, then
suppress the callback.
2012-02-02 10:49:59 -08:00
Stephen Williams d3df962b2a Cleaner __vpiCallback construction. 2012-01-22 20:37:01 -08:00
Stephen Williams 2bba7ebbda Trivial fix of compiler warning. 2012-01-21 12:01:57 -08:00
Stephen Williams d6fca81058 More cleanup of __vpiHandle classes. 2012-01-21 11:59:49 -08:00
Stephen Williams 43e11574e1 General cleanup of the __vpiHandle class work. 2012-01-20 17:16:42 -08:00