Commit Graph

56 Commits

Author SHA1 Message Date
Martin Whitaker 3bdb50da29 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.
2019-08-09 21:00:10 +01:00
Martin Whitaker cfbc90812b Enable use of MinGW ANSI stdio routines.
Defining __USE_MINGW_ANSI_STDIO=1 provides C99 compatible printf
and scanf routines, which avoids the need for workarounds for the
various failings of the Microsoft C runtime library.
2015-05-10 11:45:42 +01:00
Martin Whitaker 6a3edc63d5 Fix printf format for size_t values when using 64-bit MinGW.
The Microsoft C runtime does not support the %zu and %zd formats.
Previously these were replaced with %u and %d, but for 64-bit we
need to use %llu and %lld.
2015-05-08 20:20:14 +01:00
Arun Persaud f5aafc32f9 updated FSF-address 2012-08-29 10:12:10 -07:00
Cary R 7a75f94eda Move UDP name to the UDP base class.
The name is not currently used, but when it is it makes sense for it to
be in the base class. Also the name cannot be deleted after compiling
since it may be used later.
2011-10-19 14:46:15 -07: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 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
Cary R 314714997f Add support for variable UDP delays.
This patch adds support for a UDP with variable delays. In the process the
intrinsic support for delays was removed from the UDP functor and replaced
with a call to the .delay functor. Both a normal gate and a UDP now use the
same code to generate the delay.
2010-07-30 18:59:29 -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
Stephen Williams 8cbff6def0 Cleanup various style issues.
This patch cleans up some style issues: no need to check that a value
is defined before freeing or deleting it, use C++ style casts, make
sure to NULL terminate strncpy(), empty() is faster than size() for
size == 0 or size >= 0 checks, re-scope some variables, etc.
2010-04-13 21:29:15 -07:00
Martin Whitaker 2bf704940b Fix for initial value propagation (part 2).
To ensure the initial propagation of 'x' values at time-0 does not
trigger any events, the propagation of these values needs to be
completed before any statements that wait on events are executed.
vvp has a pre-simulation event queue to handle this, but some
functors defeat this by postponing their output propagation using
the stratified event queue. This patch fixes this by using the
pre-simulation event queue to schedule functor output propagation
until initial value propagation is complete.
2010-04-13 19:22:29 -07:00
Martin Whitaker c9f0d7e28f Fix for initial value propagation (part 1).
To match the behaviour of other simulators, delayed bit-based signals
should have the value 'x' and delayed real valued signals should have
the value 0.0 until the true initial value has propagated. This patch
provides this behaviour.
2010-04-13 19:22:21 -07:00
Stephen Williams 6d34b41dce Hide the "out" member of the vvp_net_t object.
The out pointer of a vvp_net_t object is going to be a bit more
sophisticated when we redo the handling of net signals. Take a step
towards this rework by making the pointer private and implementing
methods needed to access it.
2009-04-03 20:40:26 -07: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
Cary R 2707a68d1b Fix more memory leaks in vvp and one in ivlpp.
This patch fixes some more memory leaks in vvp. Mostly related
to UDP compilation and one in find_scope() that was found when
testing the VPI code. The leak in ivlpp was that the define
temporary buffer not being freed when the lexor was finished.
2009-01-14 18:40:54 -08:00
Cary R b26bdd3c19 MinGW fixes (development)
The MinGW system() implementation appears to return the straight
return value instead of the waitpid() like result that more
normal systems return. Because of this just return the system()
result without processing for MinGW compilations.

Older version of the MinGW runtime (pre 3.14) just used the
underlying vsnprintf(). Which has some problems. The 3.14 version
has some nice improvements, but it has a sever bug when processing
"%*.*f", -1, -1, <some_real_value>.  Because of this we need to use
the underlying version without the enhancements for now.

snprintf prints %p differently than the other printf routines
so use _snprintf to get consistent results.

Only build the PDF files if both man and ps2pdf exist.

MinGW does not know about the z modifier for %d, %u, etc.

Add some missing Makefile check targets.
2008-05-22 20:24:21 -07:00
Larry Doolittle d9ac146b8f Spelling fixes
only comments and documentation
some punctuation and capitalization for good measure
Changelogs are purposefully untouched
2008-01-29 20:24:24 -08:00
Larry Doolittle bcc034f634 Compile time warnings
Fix compile time warnings detected by gccc 4.2.
2007-09-20 17:20:48 -07:00
Cary R 81a45cdc5f Make vpi_put_value to a real accept an integer value and add diagnostic code.
Modified the code that deals with real variables to accept an integer
value when using vpi_put_value(). Also added some type of diagnostic
message for all switch defaults that have an assert(0) to indicate an
error condition, removed CVS comments and removed a small section of
unreachable code.
2007-08-29 20:02:12 -07:00
Stephen Williams dd5e34dc90 Invalid assertion on udp port count
The port input count assertion was triggering incorrectly. It was
comparing the count with the bytes instead of bits in a word.

Signed-off-by: Stephen Williams <steve@icarus.com>
2007-07-20 19:31:27 -07:00
steve b68f17483e UDP schedules its output instead of pushing it. 2007-03-04 06:26:33 +00:00
steve 68e52ce6b7 Synchronous primitives only follow edges. 2006-05-18 05:13:45 +00:00
steve f465bca305 UD delays use delay node. 2005-06-11 16:21:08 +00:00
steve cb967c10fe Handle all edge types of a synchronous UDP. 2005-06-11 02:04:48 +00:00
steve 3607fb584d Support UDP initial values. 2005-06-09 05:04:45 +00:00
steve 77792dcc2f Support sequential UDP devices. 2005-06-09 04:12:30 +00:00
steve c5cf77dc7e Support row level wildcards. 2005-04-04 05:13:59 +00:00
steve 573e07225d Rework the vvp_delay_t class. 2005-04-03 05:45:51 +00:00
steve b7ef2fcb0a Reimplement combinational UDPs. 2005-04-01 06:02:45 +00:00
steve e4ae832153 Clean up spurious trailing white space. 2004-10-04 01:10:51 +00:00
steve 2231b830db Standard udp scheduling behavior. 2003-09-24 20:46:48 +00:00
steve ed792c5321 Internal documentation of UDP devices. 2003-09-17 03:39:55 +00:00
steve 537fe0547a Comments. 2003-09-13 00:59:02 +00:00
steve 2418ab9063 Reimpelement scheduler to divide nonblocking assign queue out. 2003-09-09 00:56:45 +00:00
steve 2321df4bfc Remove short int restrictions from vvp opcodes. (part 2) 2003-06-17 21:28:59 +00:00
steve e4ddf1e8c0 Propagate output of sequential udp like non-blocksing assign. 2003-04-01 05:32:56 +00:00
steve 6b71345142 Add the q edge flag. 2003-03-18 01:32:33 +00:00
steve b726395d1e Spelling fixes. 2003-02-09 23:33:26 +00:00
steve 52bf4e613f conditional ident string using autoconfig. 2002-08-12 01:34:58 +00:00
steve da8d59757e return calculated oval from UDP (Stephan Boettcher) 2002-01-20 23:27:51 +00:00
steve edba542c7a Feedback output, not propagated output. (Stephan Boettcher) 2002-01-06 17:35:01 +00:00
steve ec4f8c80d5 Support functor delays for gates and UDP devices.
(Stephan Boettcher)
2001-12-06 03:31:24 +00:00
steve fa23dafdae Use functor pointers where vvp_ipoint_t is unneeded. 2001-11-07 03:34:41 +00:00
steve a75326e2e0 Rewrite the functor type to have fewer functor modes,
and use objects to manage the different types.
 (Stephan Boettcher)
2001-10-31 04:27:46 +00:00
steve 21c844363a Change UDP output only if table matches. 2001-09-19 04:10:40 +00:00
steve b2b8b89cd8 Make configure detect malloc.h 2001-09-15 18:27:04 +00:00
steve 606c1d38bb Nets (wires) do not use their own functors.
Modifications to propagation of values.
 (Stephan Boettcher)
2001-08-09 19:38:23 +00:00
steve 7b79fd98e5 Fast UDP tables (Stephan Boettcher) 2001-07-24 01:44:50 +00:00
steve e4139f4819 Schedule instead of propagating UDP output. (Stephan Boettcher) 2001-07-16 19:08:32 +00:00