Commit Graph

4975 Commits

Author SHA1 Message Date
Kevin Cameron 4ee9cc6247 Additions and changes for using VVP as DLL with an analog simulator. 2008-11-16 18:29:02 -08:00
Larry Doolittle e0a1b41b37 Correct and enhance some debug_elaborate messages
Make port number self-consistent, starting at 1.
Add messages marking the start and stop of recursive elaboration.
2008-11-16 18:01:23 -08:00
Larry Doolittle fe38f7a9a9 Quiet compiler warnings
Eliminate three "warning: suggest parentheses around assignment used as truth value"
Obviously not needed, but it's easier to add the superfluous parentheses
than remember that these warnings are benign.
2008-11-16 17:57:50 -08:00
Stephen Williams 4892e93a09 Fix special case that one of the arguments of a compare is a real expression.
If one of the arguments of a comparison expression has a real value, then
the expression with is 1 no matter the width of the other argument. This
means that the arguments may have different widths in this special case.
Patch is from pr2251119, suggested by Martin Whitaker.
2008-11-15 21:42:02 -08:00
Martin Whitaker a42eb5cf94 Improved automatic variable error reporting.
This patch moves the checks for automatic variables being passed to
the $monitor or $strobe system tasks from the calltf routine to a
new compiletf routine. It also adds the file name and line number
of an offending call to the error message.
2008-11-15 20:48:41 -08:00
Nick Gasson 1d4ade80b2 Fix select from non-variable-reference error (pr2281519)
VHDL can't select bits from arbitrary expression so sometimes
translating IVL_EX_SELECT would fail. This is easily fixed by
replacing the select with a shift in this instance (and the
resizing)
2008-11-15 20:39:00 -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 407ce5e152 Add support for the 1364-2001 generate of a named block.
This is obsolete in 1364-2005, but is supported 1364-2001.
Icarus already supported generate with unnamed block.
2008-11-15 08:08:29 -08:00
Larry Doolittle 1d41037009 Avoid crash with typo in varaible name
A simple typo in the rhs of an expression would crash the compiler.
Example:

module crash3;
reg clk;
integer cnt1=0;
always @(posedge clk) begin
        cnt1 <= (cnt==81) ? 0 : (cnt1+1);
end
endmodule
2008-11-14 22:29:09 -08:00
Stephen Williams 574c8a870d Merge branch 'master' of ssh://steve-icarus@icarus.com/~steve-icarus/git/verilog 2008-11-14 22:18:20 -08:00
Cary R c278b4e41f Add support for arrayed instances with inout ports.
A NetTran (TRAN_VP) can be used to connect arrayed instance inout
ports. This allows bi-directionality and conflict resolution.
2008-11-14 22:13:41 -08:00
Stephen Williams 91972cd9a1 Merge branch 'master' of ssh://steve-icarus@icarus.com/~steve-icarus/git/verilog 2008-11-14 21:53:01 -08:00
Cary R dc6a9e03c9 Shifting a signed constant should just return the L-value.
We already covered the case of shifting zero, but the case of
shifting a signed constant was missed.
2008-11-14 21:48:09 -08:00
Cary R 221b83b932 Rework $plusarg routines.
This patch addresses a number of issues:

Rewrote the $test$plusargs and $value$plusargs routines to have
better error/warning messages, to support runtime strings, to
correctly load bit based values (truncating, padding, negative
value), added support for the real formats using strtod() and
added "x/X" as an alias for "h/H" to match the other part of
Icarus.

Rewrite the vpip_{bin,oct,hex}_str_to_vec4 routines to ignore
embedded "_" characters. Add support for a negative value and
set the entire value to 'bx if an invalid digit is found. A
warning is printed for this case.

Rewrite vpip_dec_str_to_vec4 to ignore embedded "_" characters,
to support a single "x" or "z" constant and to return 'bx if an
invalid digit is found. A warning is printed for this case.

It simplifies the system task/functions error/warning messages.

It removes the signed flag for the bin and dec string conversions.
This was not being used (was always false) and the new negative
value support makes this obsolete.

Add support for a real variable to handle Bin, Oct, Dec and Hex
strings. They are converted into a vvp_vector4_t which is then
converted to a real value.

Add support for setting a bit based value using a real value.

Removed an unneeded rfp signal in vpip_make_reg()
2008-11-13 15:56:29 -08:00
Martin Whitaker 69428bb050 Fix for pr2271367.
This patch fixes a bug introduced by one of the checks for illegal
use of automatically allocated variables.
2008-11-13 15:52:17 -08:00
Nick Gasson 256454960c Add complete list of VHDL reserved words
make_safe_name now makes sure a VHDL signal is never given a
name that conflicts with any reserved words. If it does, we
just prepend VL_.

(This code was already present, but the full list of reserved
words wasn't.)
2008-11-13 15:45:41 -08:00
Stephen Williams d06092d7d7 Merge branch 'vhdl' 2008-11-13 15:45:37 -08:00
Martin Whitaker 416bd35f2e Fix for leak in thread vector allocation.
In the vvp code generator, when zero/sign extending a sub-expression,
the sub-expression is first evaluated and stored in one location in
the thread vector store, then is copied and extended into a second
location. The storage used for the initial sub-expression evaluation
is never deallocated.
2008-11-12 22:12:00 -08:00
Stephen Williams 87654f8661 Fix bug generating code for shift of constant zero.
The code generator detects this case, but instead of returning the
constant zero, it breaks out and writes partial code for the shift.
2008-11-12 21:46:23 -08:00
Stephen Williams 9f2b5cd9b7 Make the associative sum constant elimination more resilient to size details.
The NetEBAdd::eval_tree method is able to use the associative property
of addition to reduce some constants, but it is picky about widths.
Make it a little bit more resilient to expression widths.
2008-11-12 20:59:10 -08:00
Nick Gasson 5fd32937f2 Fix overly restrictive check for slices
Fixes some instances of "can only select from a variable reference"
2008-11-12 22:26:44 +00:00
Nick Gasson f1a2e71aab Merge branch 'master' of git://icarus.com/~steve-icarus/verilog into vhdl 2008-11-12 22:15:57 +00:00
Stephen Williams 7c50c9aedf Scan concat arguments with test_width.
Even though we cannot immediately give a width for a concatenation
that has a repeat expression (the expression must be evaluated first)
we still must scan the test_width of the arguments so that they can
resolve their types.
2008-11-11 21:09:19 -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 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
Cary R 1e06a2ddef ivlpp - clear lexor dynamic state information for flex >= 2.5.9
For flex version 2.5.9 and later there is a function
"yylex_destroy()" that clears any space dynamically
allocated by the scanner.
2008-11-04 16:01:47 -08:00
Cary R 049290d0fc Fix a memory leak and release all dynamically allocated memory (ivlpp)
This patch fixes a minor memory leak in ivlpp and releases all
dynamically allocated memory before the program exits. Other than
the dynamically allocated push state buffer in flex, ivlpp has no
valgrind memory errors or warnings.
2008-11-04 11:58:49 -08:00
Cary R 4c67bd0b35 Fix memory leak and free temp. file names to make valgrind happy.
There was a memory leak in the preprocess_only code (cmd was not
being freed when the command completed successfully.  Valgrind
was also marking the temporary file names as still reachable, so
they are not memory leaks, but freeing them makes valgrind happier.
2008-11-04 11:41:31 -08:00
Stephen Williams 4f7457fcec Merge branch 'verilog-ams' 2008-11-04 11:37:58 -08:00
Cary R 95ea159e75 Print `include comment after included text.
The inline comment text that appears after an `include directive
should appear after the included text not before.
2008-11-04 11:26:27 -08:00
Stephen Williams ddb2c60701 Remove svector class from Module.h
The goal is to completely remove the svector class because the standard
vector class works perfectly well. This removes the uses in the Module.h
header file.
2008-11-02 20:08:38 -08:00
Stephen Williams 77eb68d314 Minor documentation improvements. 2008-11-02 16:56:25 -08:00
Stephen Williams f4687757f1 Bring signal discipline all the way to the ivl_target API.
Signals may have VMA disciplines attached. Make the attached discipline
visible through the ivl_target.h API. Also, re-arrange the internal
handling of the discipline structure so that we can expose disciplines
through the ivl_target C API without creating new structures. The
t-dll-api implementations of the discipline access functions can look
at the elaborated discipline structure directly. This is possible since
the discipline parse and elaboration are very simple.
2008-11-02 08:10:41 -08:00
Stephen Williams b20019d8b6 Merge branch 'master' into verilog-ams 2008-11-01 21:09:29 -07: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
Larry Doolittle 520d9b9dd0 Touch up new developer quick start
Spelling and other minor touch-up for the new and
much-appreciated developer-quick-start.txt
2008-10-31 20:44:54 -07:00
Stephen Williams 403a1e9415 Add a dup_expr method to NetEUBits.
The NetEUBits needs to create a NetEUBits when the dup_expr method is
called, so it needs its own dup_expr method.
2008-10-30 22:11:05 -07:00
Larry Doolittle 9b640f3114 Shadow reduction part 4
Continue cleaning up shadowed variables, flagged by turning on -Wshadow.
No intended change in functionality.  This patch set covers the tgt-vhdl
directory, and was tested by Nick.
2008-10-30 21:46:44 -07:00
Cary R 7ac35e478b The scope of real values needs to be calculated.
Finding the scope of a real value is no longer simple, so it must
be calculated.
2008-10-30 21:41:36 -07:00
Cary R 2c7fe8aa2a Fixes for real VPI interface, etc.
This patch fixes some problems found when trying to dump words
from a real wire array. There are still a few more things that
look suspicious and need testing.
2008-10-30 21:41:28 -07:00
Stephen Williams 1ec09327e9 Elaborate divide expressions to the proper width.
If the operands of a divide expression are fixed width, pad them out
to the width of the expression so that the calculations come out right.
2008-10-30 21:19:56 -07:00
Nick Gasson ea9bbf804c Merge branch 'master' of git://icarus.com/~steve-icarus/verilog into vhdl 2008-10-30 20:00:53 +00:00
Stephen Williams 1922a0df9e Fix C++ compiler warning.
classes with virtual methods must have virtual destructors. Otherwise,
destruction may not work corectly.
2008-10-29 21:03:44 -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
Stephen Williams ea057a7574 Elaborate logical and/or to account for special properties.
The arguments of logical and/or are self determined, and the width is
fixed as 1 bit. Account for this special behavior by creating the
PEBLogic class.
2008-10-29 20:31:26 -07:00
Stephen Williams b7d3276e4d Enforce bit width of operands of comparisons operators.
The comparison operator operands are self determined, but are forced
to be the width of the wider operand. This means that the operands must
be evaluated with their widths truncated. In spite of all this, note
that comparisons expression results are 1 bit wide.
2008-10-29 19:34:44 -07:00
Cary R 22ddb26389 Add support for arrays of real nets.
This patch adds support for arrays of real values nets (wire real).
2008-10-27 21:45:02 -07:00
Stephen Williams 9b89ca49bb Merge branch 'master' of ssh://steve-icarus@icarus.com/~steve-icarus/git/verilog 2008-10-27 21:39:47 -07:00
Stephen Williams 94e7d71b97 Make sure divide expressions are evaluated using the expression width.
The operands of divide need to be at least the width of the expression
when calculating a constant divide. The only matters for the special
case where the result is x, because the verinum implementation of
divide will get the result width from the left expression width.
2008-10-27 21:39:07 -07:00
Stephen Williams 810686d88e Merge branch 'master' into verilog-ams 2008-10-27 09:23:13 -07:00