Commit Graph

207 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
Cary R db82380cec Minor cppcheck updates in vvp and switch vvp to use override for virtual functions 2025-07-21 23:32:34 -07:00
Cary R adb5731ace A package name must have more than three characters 2024-06-17 09:34:13 -07:00
Cary R b4b8006460 vpiFullname of a package should have a "::" after the name 2023-12-28 18:53:11 -08:00
Cary R dc8b7d0184 Cleanup some cppcheck warnings 2022-12-28 00:00:31 -08: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
Cary R 1fefa8eb1b Add support for vpi_put_value for vpiBit 2020-05-31 10:49:54 -07:00
Cary R 7eb0efd424 Add basic support for vpiBit 2020-05-31 00:27:15 -07:00
Cary R 19d63f0c96 A VPI by index will only work for a reg or a net 2020-05-18 22:57:18 -07:00
Martin Whitaker f1608e163f Fix implicit fallthrough warnings when building with recent GCC. 2018-10-06 20:15:42 +01:00
Martin Whitaker c622d372f9 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.
2017-11-07 18:48:48 +00:00
Martin Whitaker 7bed181f68 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.
2016-07-22 22:48:20 +01:00
Stephen Williams fff69390ac C++-ify the __vpiScope classes. 2015-12-20 20:26:57 -08:00
Christian Taedcke 6d5aabd4f0 Make a few constructors explicit.
This removes cppcheck warnings.
2015-10-22 12:33:33 +02:00
Cary R a65c007fdb Fix some cppcheck warnings 2015-10-02 09:43:54 -07:00
Frederick C. Kurz b36a0a2c54 Changes to vvp/vpi_signal.cc
Changed the #ifdef structure so "Microsoft Visual Studio Express 2015 RC Web" could compile it without error.
2015-07-22 17:56:58 -07:00
Martin Whitaker 97c6339241 Ensure VPI release on net connected to island returns correct value. 2015-07-01 09:00:43 +01:00
Martin Whitaker 8d2149f5aa Further fix for GitHub issue #73 - also handle part selects. 2015-06-30 23:59:00 +01:00
Martin Whitaker e8225bd39e Fix for GitHub issue #73 - allow for island ports in vpi_put_value.
In the special case that a net is attached to an island port, values
driven onto the net via the VPI must go to the functor, not the filter,
so that they propagate through the island.
2015-06-30 21:50:13 +01:00
Martin Whitaker 637fc40dd9 Fix various bugs in vpi_put_value.
When putting a value onto a wire, the value needs to be sent to the
filter, not the functor (the functor may be part of the expression
that drives the wire).

Force and release weren't implemented properly (or at all in the
case of real values). They need to behave the same as the force
and release operations in vthread.cc.
2015-06-26 08:49:41 +01:00
Larry Doolittle 2739f83702 Spelling fixes in C and C++ comments 2015-06-04 15:00:29 -07:00
Martin Whitaker 45dc13e496 Use uintptr_t/intptr_t when casting between pointer and integer.
The code was using (unsigned) long, but a long is 32-bits in the
Windows 64-bit ABI.
2015-05-05 23:00:09 +01:00
Martin Whitaker e006f9e132 Fix vvp crash when a part select of a wire is passed to $monitor.
When the PV expression is compiled, the parent net may not yet be
resolved, so we may not be able to get its VPI handle straight away.
2015-03-17 21:14:30 +00: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 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
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 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
Larry Doolittle 6a45a0d570 Don't lie to the c++ about some pointer alignment
Second try cleaning up cast-alignment problems surrounding need_result_buf().
Clang gave a bunch of warnings like
vvp/vpi_const.cc:196:34: warning: cast from 'char *' to 'p_vpi_vecval' (aka 't_vpi_vecval *') increases required alignment from 1 to 4 [-Wcast-align]

This version is verbose and changes the prototype for need_result_buf().
But it is semantically (c++) correct, and makes need_result_buf() feel like malloc().
2014-06-10 09:27:49 -07:00
Stephen Williams f752007e9c Add some minor VPI/ACC fixes and updates
These were submitted.
2014-04-06 15:54:05 -07:00
Cary R 92e4ca3a92 Report that vpi_handle_by_index() is not supported for a vpiNet 2013-12-12 17:10:26 -08:00
Martin Whitaker 34643d9628 Fix for br937.
When writing a string value, vpi_put_value cannot assume the target vector
is a multiple of 8 bits wide.
2013-09-28 17:17:38 +01:00
Cary R 1b1aa06dee Remove some more cppcheck warnings and a valgrind compile warning 2013-04-30 18:35:30 -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
Stephen Williams 222b683849 Clean up invokations of the vector4_to_value template. 2012-10-25 09:13:09 -07: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
Cary R a35ca1d70b Remove debug message in vvp/vpi_signal.cc 2012-07-09 10:30:36 -07:00
Cary R c222169608 Update vecval size calculation in vvp and vpi code.
The standard specifies that the size of a vecval should be calculated as
(size - 1)/32 + 1. When size is a PLI_INT32 this is needed to prevent an
overflow, but when the size is unsigned this can be simplified to
(size + 31)/32 since the size must fit into an integer, but we have an
extra significant bit in an unsigned so no overflow can happen.

This patch changes the code to use the correct version of the equation
depending on the context.

The previous patch does this in vvp/vpi_priv.cc
2012-04-02 08:18:46 -07:00
Stephen Williams c7a54891c4 Properly handle value change callbacks on part selects.
cbValueChange callbacks on part selects have to go through some extra
effort to make sure the value they are watching really is changing.
2012-01-30 19:12:20 -08:00
Stephen Williams d6dba0456c Fully remove the __vpirt structure
All the methods that this structure supported are now pulled
into the __vpiHandle class as virtual methods. This includes
the vpi_free_object_ method, which required some extra trickery.
2012-01-20 14:15:26 -08:00
Stephen Williams c07c4509e4 Move all vpirt functions to __vpiHandle virtual methods.
This takes care of all the functions accept the delete methood, which
will need special treatment.
2012-01-20 11:39:48 -08:00
Stephen Williams ac2b68fc1b Implement __vpiHandle::get_type_code pure virtual method. 2012-01-19 15:04:51 -08:00
Stephen Williams a48c9c3b4a Reword __vpiHandle objects to create a class structure.
Instead of C-like data structures where the __vpiHandle base is a
leading member, make the __vpiHandle a derived class. Give the base
class a virtual destructor so that dynamic_cast works reliably, and
now pretty much all of the junk for testing if an object really is
of the derived class goes away. Also, problems with casting up to
a vpiHandle become trivial non-issues.
2012-01-19 10:16:39 -08:00
Cary R d198a57d99 The _vpiNexusId property must return zero when undefined
This was created by a user contributed patch. It resulted in all objects
that cannot have aliases being aliased.
2011-12-14 18:39:16 -08:00
Cary R 670efb38d9 Document that vpiFullName is supported in the generic routine. 2011-12-06 11:35:37 -08:00
Cary R 15a3f8ef2a For now treat vpiFullName the same as vpiName for a signal.
This needs to be fixed, but for now this prevents a seg. fault in
the VCD dumpers, etc.
2011-12-06 10:17:41 -08:00
Cary R 95e25ad40f Apply a slightly modified user patch. 2011-12-05 19:54:50 -08:00
Cary R 9fb317a4e1 A vpiBitVar can have a non-zero LSB and can be unsigned.
The general bit variable can be either signed or unsigned and can
have a non-zero LSB.
2011-09-11 11:47:39 -07:00