Commit Graph

40 Commits

Author SHA1 Message Date
Martin Whitaker f1608e163f Fix implicit fallthrough warnings when building with recent GCC. 2018-10-06 20:15:42 +01:00
Stephen Williams f275dac7a8 Kill a bunch of __vpiScope struct vs class warnings. 2015-12-27 11:37:10 -08:00
Cary R a65c007fdb Fix some cppcheck warnings 2015-10-02 09:43:54 -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
Arun Persaud f5aafc32f9 updated FSF-address 2012-08-29 10:12:10 -07:00
Stephen Williams 43e11574e1 General cleanup of the __vpiHandle class work. 2012-01-20 17:16:42 -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 ff309fb04f Reduce the error when scaling a real time value.
When scaling a time value we would often use the power operator to
create constants 10**-N that were then multiplied with the original
value. The problem with this is that there is some errors in the
representation of the fractional number. It is better to create a
integer value 10**N and then divide the original value by this
exact constant. You still have the calculation error, but the scale
value is now an exactly real value.
2011-10-31 10:44:00 -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 21d15ceece Fix the compiler and modpath scaling of real delays.
A real delay must be scaled and rounded using the local precision
before it is finally scaled to the simulation time units. This
patch fixes the compiler to do this correctly or generate the
correct code for run time calculated delays. Delays in a CA
already worked correctly. The run time was also fixed to scale
modpath (SDF back annotation) delays correctly.
2010-06-18 16:11:54 -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 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 10f106f354 Make vvp use inttypes for the 64 bit printing info.
To get the correct print format for a 64 bit value it is much
better to use <inttypes.h> (when available) than building our
own value. This allows MinGW to use the non-standard I64.
(cherry picked from commit d237e35076)
2009-03-24 07:59:26 -07:00
Cary R cba8b42580 Make a plain $stime print in 10 digits (32 bits).
This patch makes $stime a unique call in display and returns
the lower 32 bits in a 10 digit field when it is called.
2009-01-09 16:58:13 -08:00
Martin Whitaker 04377151bc Checks for illegal use of automatically allocated variables.
This patch adds a number of compile and run-time checks for illegal
uses of variables declared in automatic tasks and functions. It
also adds a check for event expressions in automatic tasks that use
features not yet supported in VVP.
2008-11-11 20:45:19 -08:00
Cary R aeec93a322 $time, $stime and $simtime return an integer rounded value for %f
The $time, $stime, $simtime (integer time) system functions should
return a rounded integer value in a real context.
2008-08-01 20:37:41 -07:00
Cary R 77061faa5c Add vpiFile and vpiLineNo for system functions.
Add the vpiFile and vpiLineNo properties to system functions.
Most other objects have stubs that return "N/A"/0. Interactive
functions (called from the debugger) use <interactive> for the
file name.
2008-01-01 17:27:03 -08:00
Larry Doolittle 9772068bbc vpi_get_str improvements
Gets rid of a few warning: deprecated conversion from string
constant to 'char*', follows IEEE 1364-2001C 27.10 in more cases,
and fixes at least one real bug (look at the previous use of
strdup/strcat in real_var_get_str() and signal_get_str()).
2007-12-18 15:11:50 -08:00
Stephen Williams d7a0f48944 VPI put and get of delays to module path
Add support for access to delays via scaled real times.

Signed-off-by: Stephen Williams <steve@icarus.com>
2007-11-10 19:54:21 -08:00
Cary R 239523b3c7 Implement the swrite* and sformat system tasks plus a few other fixes.
This patch implements the swrite* and sformat system tasks. It also
makes $simtime distinguishable from the other integer time tasks.
This was needed to get the correct time units when $simtime was given
as an argument to $swrite*. The string constant code was also modified
to allow a string to be returned as a vector (0/1 bit pattern).

Here are some more specifics about the swrite* changes.
1. They do not share formatting code with the other display functions,
   so they may/will produce different results.
2. All %{alpha} codes allow a width and justification. Others have been
   enhanced (%t allows the default width and precision to be overridden,
   time functions print with time formatting, better error checking and
   messages, etc.).
3. %u and %z formatting codes have been added. It is important to note
   that these two formats can produce embedded NULLs, since these
   functions are returning a string anything after the first NULL will
   not be reachable! memcpy is used instead of regular string processing
   where needed so that the original string will contain the total
   result. The size returned when the string is created is the true
   length.  A warning will be printed if a string with embedded NULLs is
   produced (strlen() does not match the true length).
4. Real numbers are printed with %g instead of %f.

Once this new formatting code has been evaluated we should incorporate
the changes/fixes into the formatting code for the other functions or
the other functions could be modified to use this new code. The true
string length is available so we should be able to work around the
embedded NULL problem.
2007-08-13 20:07:12 -07:00
steve 0c73f209de Be more careful with double types. 2005-12-05 21:19:55 +00:00
steve e4ae832153 Clean up spurious trailing white space. 2004-10-04 01:10:51 +00:00
steve 857ec1079a Refix vpiRealVal scaling of time. 2003-03-14 18:01:00 +00:00
steve e6db4113a5 Warnings about long long time. 2003-03-13 20:31:40 +00:00
steve 9e9326cc6d Use rbufs instead of static buffers. 2003-03-13 04:59:21 +00:00
steve ce489d8d84 Allow $display of $simtime. 2003-02-03 01:09:20 +00:00
steve 27f7a00df0 Proper rounding of scaled integer time. 2003-02-02 02:14:14 +00:00
steve fec6a10771 Make $time and $realtime available to $display uniquely. 2003-02-01 05:50:04 +00:00
steve c2070777b2 The $time system task returns the integer time
scaled to the local units. Change the internal
 implementation of vpiSystemTime the $time functions
 to properly account for this. Also add $simtime
 to get the simulation time.
2002-12-21 00:55:57 +00:00
steve 52bf4e613f conditional ident string using autoconfig. 2002-08-12 01:34:58 +00:00
steve eb708c1540 Support specified times in cbReadOnlySync, and
add support for cbReadWriteSync.
 Keep simulation time in a 64bit number.
2002-04-20 04:33:23 +00:00
steve ec070ee65b Support vpiSize and vpiSigned for time objects. 2002-01-15 03:06:29 +00:00
steve 98d71de50f sign warning. 2001-10-15 02:55:03 +00:00
steve 820d8b9edc Support various other string formats for time. 2001-08-16 03:29:31 +00:00
steve ab7b353ace support fast programming by only writing the bits
that are listed in the input file.
2001-06-30 23:03:16 +00:00
steve 15398a8f58 VPI access time as a decimal string, and
stub vpi access to the scopes.
2001-04-03 03:46:14 +00:00
steve a4c722b195 Add VPI support for the simulation time. 2001-03-31 19:00:43 +00:00