Commit Graph

78 Commits

Author SHA1 Message Date
Martin Whitaker 5aae9ea770 Fix bit width when converting real value to binary/hex string in VPI. 2018-10-07 17:17:33 +01:00
Martin Whitaker f1608e163f Fix implicit fallthrough warnings when building with recent GCC. 2018-10-06 20:15:42 +01:00
Martin Whitaker 11c826216a Fix for GitHub issue #198 - support octal display for thread variables. 2018-06-12 22:58:07 +01:00
Martin Whitaker 6e49ab10ec 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.
2018-05-14 22:14:51 +01:00
Cary R e44010c2a3 Remove redundant class keyword 2015-12-29 13:02:58 -08:00
Christian Taedcke 6d5aabd4f0 Make a few constructors explicit.
This removes cppcheck warnings.
2015-10-22 12:33:33 +02:00
Frederick C. Kurz afd225a44d Changes to vvp/vpi_vthr_vector.cc
Changed for "Microsoft Visual Studio Express 2015 RC Web" so gold files would match.
2015-07-22 18:00:59 -07:00
Martin Whitaker a1630e1d30 Fix for br968.
__vpiVThrVec4Stack::vpi_get_value_int_ was always treating the thread variable
as unsigned, rather than observing the value of __vpiVThrVec4Stack::signed_flag_.
Not sure why this was done - none of the regression tests broke when I changed
this.
2015-01-10 17:24:50 +00:00
Stephen Williams 96d181efed Support vpiStrengthVal for vec4 stack objects. 2014-12-23 14:42:45 -08:00
Cary R 3ccc59eaa3 Fix compile with valgrind hooks after vec4-stack changes 2014-12-12 14:28:07 -08:00
Stephen Williams 8ac06fb63f Support vpiObjTypeVal for vec4Stack values.
Also allow vpi_get_value outside of scope. (Return 'x)
2014-10-25 20:38:39 -07:00
Stephen Williams a98f21aa65 Merge branch 'master' into vec4-stack
Conflicts:
	elab_lval.cc
	netmisc.cc
	tgt-vvp/eval_object.c
	tgt-vvp/vvp_process.c
	vvp/codes.h
	vvp/compile.cc
	vvp/opcodes.txt
	vvp/vpi_tasks.cc
	vvp/vpi_vthr_vector.cc
	vvp/vthread.cc
2014-10-21 09:12:02 -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 e932c7a637 Support get of vpiIntVal from vec4 stack. 2014-03-04 19:02:21 -08:00
Stephen Williams ae1f8be277 Wrap up vpi access to vec4 stack items. 2014-01-14 17:10:03 -08:00
Stephen Williams ec6009dd8f Compile out the T<...> format in vvp.
This ifdef's the code out. Leave it in place for a little longer
for reference.
2014-01-06 20:36:26 -08:00
Stephen Williams 4820d46353 Implement some vpi_get_value formats for vec4 stack values. 2014-01-06 20:27:14 -08:00
Stephen Williams aee540d8bb Fix sort of %event command in vvp compile list.
The sort is important, the names must be sorted because the table is
searched using binary search.
2014-01-06 09:12:42 -08:00
Stephen Williams 19402aeef2 get vpiStringVal from vec4 stack positions. 2014-01-06 08:35:49 -08:00
Stephen Williams 2fc8ce8a16 Implement vec4 basec %assign delay and event / vpiTimeVal for functions. 2014-01-05 12:04:16 -08:00
Stephen Williams e708a5b59d Handle vec4 part selects / vec4 cassign / repeat statements
These features need to be adapted to the vec4 stack.
2014-01-04 22:11:07 +00:00
Cary R 40840368bb Fix two compile warnings under RHEL-5 with gcc 4.1.2-54 2013-12-04 16:45:43 -08:00
Cary R 8f0687adb7 Fix white space issue. 2013-10-11 11:27:46 -07:00
Cary R 281556e93d Fix another real to vpiIntVal conversion in the run time 2013-10-11 11:26:17 -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
Cary R 3fa7b3f05a Remove some valgrind warnings and a few errors
Cleanup a few more of the new constructs and fix free/delete mismatches.
2012-12-18 11:10:16 -08:00
Stephen Williams a5fd5363b3 Rewire real value expressions to use a stack instead of register space.
This will hopefully improve performance slightly, but also this
intended as a model for what to do when I get around to doing the
same thing to other data types.
2012-10-22 17:20:43 -07:00
Arun Persaud f5aafc32f9 updated FSF-address 2012-08-29 10:12:10 -07:00
Cary R 1749d10966 Fix some clang/bison compile warnings. 2012-08-06 15:49:11 -07:00
Stephen Williams f77bdf7e38 Handle concatenation of SystemVerilog strings. 2012-07-22 10:52:06 -07: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 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 225ca1e205 Change iterators to use prefix ++ since it is more efficient.
This patch changes all the iterator code to use a prefix ++ instead
of postfix since it is more efficient (no need for a temporary). It
is likely that the compiler could optimize this away, but lets make
it efficient from the start.
2010-11-02 10:43:16 -07:00
Cary R b0269fa926 Add -Wextra for C++ compiling in the vpi and vvp directory.
This patch adds -Wextra to the compilation flags for C++ files in
the vvp and vpi subdirectories. It also fixes all the problems
found while adding -Wextra. This mostly entailed removing some of
the unused arguments, removing the name for others and using the
correct number of initializers.
2010-10-14 19:18:18 -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
Stephen Williams ec49f10e2d Revert bad merge from vhdl branch 2010-10-02 11:02:27 -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
Cary R bc7a5a9725 vpi_get_value should return an appropriate value during compiletf.
The vpi_get_value() function should not crash when called during
the compiletf phase. This patch fixes this by returning 'bx for
any vectors in thread space. It also fixes some other minor things
that my test code uncovered. Most of the other objects work as
expected.
2010-03-23 16:34:38 -07:00
Cary R d6246cf041 Add some casts in vvp to remove warnings.
The Cygwin compiler is a bit picky. This patch adds some casts
to remove compilation warnings. In the past I have had warnings
off because of problems with the STL, but for this directory we
may as well squash as many warings as we can. It also does not
recognize that an assert(0) or assert(false) ends a routine so
it complains about no return at end of function or variables
not being defined.
2009-12-11 21:43:42 -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
Larry Doolittle 66949122cf Non-controversial whitespace cleanup
Nothing to do with tab width!  Eliminates useless
trailing spaces and tabs, and nearly all <space><tab>
pairings.  No change to derived files (e.g., .vvp),
non-master files (e.g., lxt2_write.c) or the new tgt-vhdl
directory.

Low priority, simple entropy reduction.  Please apply
unless it deletes some steganographic content you want
to keep.
2008-09-04 21:31:30 -07:00
Cary R 2fab3159dd Add smart part select for system functions &PV<>.
This patch adds a smart part select that allows system functions
to have full access to the real bits of the part select.
2008-05-29 09:40:12 -07:00
Cary R 2934ceb548 A constant thread vector is binary.
Thread vectors can be treated as constants the problem
was that they did not set a constant type. They now
return vpiBinaryConst.
2008-05-14 11:56:50 -07:00
Cary R ffbf37b06b Add vpiScalarVal to signal_put_value().
This patch adds functionality for vpiScalarVal to signal_put_value().
It also factors out the scalar to bit4 code from vpiVectorVal.
2008-04-27 21:11:12 -07:00
Stephen Williams 10ea9904f1 Clean up more vvp_bit4_t encoding dependencies. 2008-04-23 11:16:24 -07:00
Stephen Williams 6d2ef15951 Remove dead code related to bit arrays/vectors
In previous incarnations of the vvp runtime, bit vectors were passed
around as arrays of unsigned char that charried bit4 vectors. That
is no longer used. Remove the last vestiges of that dead code.
2008-04-20 20:43:53 -07:00
Stephen Williams 40fd07d46e Remove most dependencies on vvp_bit4_t encoding.
Remove dependencies on vvp_bit4_encoding outside of the vvp_net
core types. The table_functor_s class was the worst offfender and
was barely used, so it is now removed completely. There are a few
opcodes in vhtread.cc that also make vvvp_bit4_t encoding
assumptions (and used casts) and those have been fixed. There
were also various VPI interface functions that are fixed.
2008-04-20 19:21:41 -07:00