Commit Graph

282 Commits

Author SHA1 Message Date
Stephen Williams 2638cd9f6e Fix build --with-valgrind broken by scope thread rework.
The scope thread rework broek --with-valgrind builds due to the
different handling of the list of threads. Rework valgrind enabled
handling of the thread set within a scope.
2010-01-09 10:38:24 -08:00
Stephen Williams dda197e39b Rework the scope thread list to use a std::set
The scope contains the threads running within. The rework of this
patch allows all threads to know their scope, and cleans up the
handling of threads listed in the scope.
2010-01-06 18:43:53 -08:00
Stephen Williams 3ddb421fbf Add some single-step debugging
Work out the basis for single-stepping events in the scheduler,
and fill in some basic single-step results.
2010-01-06 16:08:20 -08:00
Martin Whitaker b416176c4d Fix for pr2913404.
In combination with the patch to make all operations on thread words
operate on 64-bit values, this patch ensures casts between real values
and large vector values work correctly.
2009-12-21 09:59:12 -08:00
Martin Whitaker 13cad6f268 Make vvp thread word storage consistently 64 bits.
The vvp thread word storage had previously been changed to always store
64-bit values, but some instructions still only operate on native long
values. This patch ensures all instructions that modify thread words
support 64-bit values.
2009-12-21 09:56:22 -08:00
Martin Whitaker c7b0aef414 Reduce memory use for simulations that run in zero time.
The fix for pr1830834 causes vvp to only delete a completed thread
when the simulation time next advances. If a procedural model is
being simulated which makes many task or function calls within a
single time step, this can lead to excessive memory use. This patch
modifies the behaviour so that thread deletion is only delayed if
that thread has caused a sync event to be placed in the event queue.
This should catch all cases where the thread private data can be
accessed after a thread has terminated.
2009-12-08 21:13:19 -08:00
Stephen Williams 1ada697e45 Fix signed/unsigned errors in %shiftl/x0 and %shiftr/x0
Fix these warnings once and for all. Just use only signed integers
for all the variables and arithmetic.
2009-11-26 09:43:35 -08:00
Stephen Williams 971179d617 Performance optimizations
For the %mov instruction, implement a vvp_vector4_t::mov method to
manipulate the thread vector directly.

For the %load/v instruction, rework the vec4_value() methods to
avoid creating vvp_vector4_t temporaries, and therefore reduce the
copy overhead.
2009-11-20 17:54:48 -08:00
Stephen Williams 0a72df2025 Remove vvp_signal_value from the vvp_fun_signal hierarchy.
We no longer need to access values from the signal functor. Use
the filter (the wire part) everywhere to access signal values.
2009-09-13 18:30:13 -07:00
Stephen Williams a1295db6bf release_pv methods need t account for net_flag.
Whether and what to propagate after a release of a part needs to
match the behavior of the full-vector release. Nets need to restore
their driver, and regs need to hold their forced value.
2009-09-12 09:22:20 -07:00
Stephen Williams 0018cb38b0 Merge branch 'master' into vvp-net-out-rework
Conflicts:
	vvp/schedule.cc
	vvp/schedule.h
2009-09-05 10:19:20 -07:00
Stephen Williams 5be1b25726 Release filter accounts for net vs variable.
When releasing a net, the release needs to propagate the driven
value. When releasing a variable, the driven value must be set
to the previously forced value.
2009-09-04 21:37:31 -07:00
Stephen Williams 1ea0d40208 Remove "net" flag to release methods.
This flag is redundant. The behavior should be handled in other ways.
2009-09-03 21:15:35 -07:00
Cary R 9a4cd1af32 Add support for non-blocking assignment to real arrays.
This patch adds support for the various types of non-blocking
assignments to real arrays.
2009-09-03 17:07:17 -07:00
Cary R 9d765820bf Support negative index for %assign/av opcodes.
If the array index is negative these opcodes need to just return.
2009-09-03 17:05:17 -07:00
Cary R 8623f804f2 Add support for an undefined index for the %load/a* opcodes.
These opcodes need to return 'bx or 0.0 for the real opcode when
the array index is undefined.

The patch also documents the auto incrementing of the bit
index register done by the %load/avx.p opcode.
2009-08-31 11:19:45 -07:00
Stephen Williams aad5029ff3 Get rid of some lingering references to vvp_fun_signal_vec::vec4_value. 2009-08-28 22:08:40 -07:00
Cary R ecb00017cb Enhance %shiftr/i0 and $shiftl/i0 to work with negative shifts.
The %shiftr/i0 and %shiftl/i0 opcodes are used for some part
selects and if we have a negative shift we want the value to be
padded with 'bx. This patch enhances the two %shift/i0 opcodes
to work with negative shifts and for negative shifts pad with
'bx instead of 'b0.

It also fixes %ix/get/s to use a uint64_t instead of a unsigned
long to avoid problems with sign extension on 32 bit machines.
2009-08-27 13:39:06 -07:00
Stephen Williams 0705717efa reinterpret_cast is not the run-time-type safe way. Use dynamic_cast. 2009-08-26 21:30:38 -07:00
Stephen Williams 04490703f7 Fix IX_GETVS and LOAD_X1P operations to use filters instead of functors. 2009-08-25 20:07:17 -07:00
Stephen Williams bb447af143 Threads load from signals / force propagates without refiltering.
Two small fixes: Threads should load signal values from signal_value
objects, not signal functors, and the force method should not run
its value through the filter.
2009-08-02 17:04:00 -07:00
Stephen Williams 8bbb7ff7db Create the vvp_wire_base class to handle wires.
Take wires out of the signals/variables and move them into a filter
instead. This is a big shift, and finally starts us on the path to
divide wires out of signals.
2009-07-27 21:42:04 -07:00
Stephen Williams 6ef9243a10 vthread no longer accesses any signal methods.
We want the entire force/release subsystem to only reference the
vvp_net_t or vvp_net_fil_t objects in a net. This gives us the
latitude to take wire implementations out of the vvp_net_fun classes.
2009-07-05 16:27:14 -07:00
Stephen Williams 7df9d60761 Collapse vvp_filter_wire_base into vvp_net_fil_t.
The vvp_filter_wire_base class was not really used, and by
collapsing into vvp_net_fil_t some casts are eliminated.
2009-06-25 22:13:03 -07:00
Stephen Williams 42b503a24a Threads force to a net, not a signal.
This mostly gets the public force methods out of the signal functor
and into the vvp_net_t object.
2009-06-19 21:15:08 -07:00
Stephen Williams a3f16c9fba Indexed force of vector8 wire. 2009-06-11 21:18:08 -07:00
Stephen Williams 90941648bf Implemented %force/x0 instruction using force filter. 2009-06-08 17:58:59 -07:00
Stephen Williams bc6f3cc905 Re-implement force/link to use a vvp_fun_force node.
The vvp_fun_force node converts its input to a call to the
force method of the target node. This eliminates the need for
linking a net to a force input of a signal.
2009-06-06 11:01:12 -07:00
Stephen Williams 29a47efa81 Remove the signal functor force-2 input port hack.
The vvp_net_t port 2 was used to implement force behavior, but that
is no longer how we plan to implement force, so remove it from the
implementation of signal nodes. This currently breaks much of the
force/release functionality, but we'll get it back by other means.
2009-05-27 20:37:46 -07:00
Stephen Williams 6e1d7b6210 Merge branch 'master' into vvp-net-out-rework 2009-05-18 19:46:13 -07:00
Cary R 6c0e1480ff Fix the %assign/v0/x1 operators for width equal negative offset case.
This patch fixes the three %assign/v0/x1 operators to correctly
notice that the select has fallen off the start of the vector
for the case that the negative offset equaled the width.
2009-05-18 17:34:56 -07:00
Stephen Williams 682ab886d8 Implement release and deassign more directly.
There is no use implementing the release and deassign methods as
port commands. It's confusing and a waste of vvp_net_t functionality.
It also obscures what needs to be done to more force/release into
the filter object.
2009-05-15 20:49:07 -07:00
Stephen Williams 5529182f1f Spread the vvp_net.h contents out a bit.
the vvp_net.h header file is getting pretty huge. This divides
the obviously separable signal functor code out into its own
header and source files.

Also, fill out the use of the filter member of the vvp_net_t
object. Test the output of the vvp_net_t against the filter.
2009-04-15 19:08:37 -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
Stephen Williams 6715426833 fix the arithmetic of multi-word division.
The Multiword division was not handling some degenerate high
guesses for the intermediate division result guess. The end result
was an assertion. Recover from this case.

(Does the addinb back of bp need to be optimized better?)
2009-03-13 21:59:44 -07:00
Cary R 5ae86bd6b4 Add support for 64 bit delays in procedural non-blocking assignments.
This patch adds support for 64 bit non-blocking delays in procedural
code. We fixed the procedural delay operator (blocking delays) earlier.
This patch mostly mimics what was done there. The continuous assignment
delay operator still needs to be fixed.
2009-02-17 10:32:11 -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
Cary R 8cd50c163b Make the procedural shifts work with undefined shift values.
This patch adds code to check for an undefined shift value in
the procedural opcodes. When an undefined value is found 'bx
is returned.
2008-12-16 09:11:37 -08:00
Cary R 6b76f76a3a Add the procedural signed power function.
This patch adds the procedural power function %pow/s for signed
values. This has bit based inputs and outputs, but uses the double
pow() function to calculate the value.
2008-11-28 10:33:45 -08:00
Martin Whitaker fe199a7593 Fix for pr2276163.
The VVP %join function was incorrectly treating the return from a
non-automatic function as a return from an automatic function in
the case that the non-automatic function result was being used as
a parameter to an automatic function. This patch fixes this error.
2008-11-15 11:04:51 -08:00
Cary R bbdf622ea5 Fix numerous problems with the divide and modulus operators.
This patch fixes a number of problems related to the divide and
modulus operators.

The net version (CA) of modulus did not support a signed version.

Division or modulus of a value wider than the machine word did
not correctly check for division by zero and return 'bx.

Fixed a problem in procedural modulus. The sign of the result is
only dependent on the L-value.

Division or modulus of a signed value that was the same width as
the machine word was creating an incorrect sign mask.

Division of a signed value that would fit into a single machine
word was not checking for division by zero.

Division or modulus of a wide value was always being done as
unsigned.

Added a negative operator for vvp_vector2_t. This made
implementing the signed wide division and modulus easier.
2008-11-07 19:58:00 -08:00
Stephen Williams 6cac1d2cab Add support for real/realtime arrays.
Support arrays of realtime variable arrays and net arrays. This
involved a simple fix to the ivl core parser, proper support in
the code generator, and rework the runtime support in vvp.
2008-11-01 20:44:03 -07:00
Martin Whitaker 18edf2f15f Rework of automatic task/function support.
This patch splits any VVP net functor that needs to access both
statically and automatically allocated state into two sub-classes,
one for handling operations on statically allocated state, the
other for handling operations on automatically allocated state.
This undoes the increase in run-time memory use introduced when
automatic task/function support was first introduced.

This patch also fixes various issues with event handling in automatic
scopes. Event expressions in automatic scopes may now reference either
statically or automatically allocated variables or arrays, or part
selects or word selects thereof. More complex expressions (e.g.
containing arithmetic or logical operators, function calls, etc.) are
not currently supported.

This patch introduces some error checking for language constructs
that may not reference automatically allocated variables. Further
error checking will follow in a subsequent patch.
2008-10-29 20:43:00 -07:00
Larry Doolittle c010145eaf Shadow reduction part 1
Start cleaning up shadowed variables, flagged by turning on -Wshadow.
No intended change in functionality.  Patch looks right, and is tested
to compile and run on my machine.  YMMV.
2008-10-09 11:55:26 -07:00
Martin Whitaker 7ebcc6b357 Support for automatic tasks and functions.
This patch adds support for automatic tasks and functions.
Refer to the overview in vvp/README.txt for details.
2008-09-27 15:51:16 -07:00
Cary R f7d3c7c711 Add non-blocking EC for arrays and other fixes.
This patch adds non-blocking event control for array words.
It also fixes a problem where the word used to put the
calculated delay for a non-blocking array assignment was
not being released. It also fixes the non-blocking array
assignments to correctly handle off the end/beginning part
selects.
2008-09-19 21:08:03 -07:00
Cary R 626394d198 Some event control assigns can be skipped so add an event clear.
Since some event control assignments can be skipped we need an
event control clear so that future %evctl statements do not fail
their assert. This patch adds %evctl/c and uses it in the compiler
as appropriate to keep the event control information in sync.
2008-09-19 20:04:51 -07:00
Cary R 8ffec473ef Add event control for vectors and parts of a vectors.
This patch adds full event control for vectors and parts of a
vector. It also fixes the other non-blocking part select code
to correctly handle a negative offset ([1:-2] of a [4:0] will
have an offset of -2).
2008-09-19 19:46:33 -07:00
Cary R 1e60754ff0 Partial non-blocking event control implementation
This patch pushes the non-blocking event control information to
the code generator. It adds the %evctl statements that are used
to put the event control information into the special thread
event control registers. The signed version (%evctl/s) required
the implementation of %ix/getv/s to load a signed value into
an index register. It then adds %assign/wr/e event control based
non-blocking assignment for real values. It also fixes the other
non-blocking real assignments to use Transport instead of inertial
delays.
2008-09-12 20:00:28 -07:00
Cary R 088c7f3feb Add calculated delay, real valued, non-blocking assignments.
This patch add the ability to do a non-blocking assignment
for real values using a non-constant (calculated) delay.
2008-09-09 20:09:49 -07:00