Commit Graph

5049 Commits

Author SHA1 Message Date
Cary R 3c4b9692a6 Pads and local signal file/line should be related to creation location.
When padding a signal or when creating a local signal the file and
line information should be related to where the new object was
created not the signal value it is being created from.

This patch modifies the NetE* pad_to_width() routines to take a
LineInfo object to set the location to the correct value.

It fixes some set_line() calls to use the correct location.

It fixes ports to not set the file/line information if it is
already defined. Doing this was causing the definition of
signals to become the instantiation instead of the real
module declaration.
2008-11-18 20:24:19 -08:00
Stephen Williams 1630c41d5f Merge branch 'master' of ssh://steve-icarus@icarus.com/~steve-icarus/git/verilog 2008-11-18 20:10:43 -08:00
Stephen Williams 5e174f54ee Elaborate signals in generated named blocks.
Named blocks create scopes, and generated named blocks' scopes can
have signals declared in them. So the elaborate_sig for the generate
scheme needs to call the elaborate_sig for the processes as well as
the obvious gates and tasks/functions.
2008-11-18 20:10:10 -08:00
Stephen Williams 7ec86757c5 Elaborate concatenation expression put tested widths to use.
Concatenation expressions need to use the tested widths of its
argument expressions during elaboration.
2008-11-18 16:52:05 -08:00
Stephen Williams dafe61b0f9 Update for s20081118 snapshot 2008-11-18 15:37:42 -08:00
Nick Gasson 7529034c7a Fix incorrect temporary size with padding
Fix for pr2224949

The compiler generates a concatenation LPM to zero-pad ports when the
signal widths don't match up. However, when the VHDL generator generated
the input signals to this LPM it incorrectly sized them to be the width
of the result.
2008-11-18 15:00:00 -08:00
Cary R ec0e718151 VHDL: make casez support 'x' and handle a full don't care case.
The VHDL converter erroneously treated a casez and casex exactly
the same. In reality a casez compares a 'x' value (it is not a
don't care). It also adds support for a full don't care case by
just returning True for the condition.
2008-11-18 14:42:36 -08:00
Stephen Williams 35e0a98732 Improve error message about signal type conflict.
When the parser detects a signal type conflict, print a more useful
error message. In the process, be more careful with what line number
is actually attributed to the declaration.
2008-11-18 14:34:34 -08:00
Cary R 3190066013 Remove old real array word debug message.
This message appears to be left over from the original implementation
of real array words.
2008-11-18 13:28:08 -08:00
Cary R 95065819f1 Evaluate constant negated reductions.
This patch adds support for calculating the negated reductions
(~&, ~| and ~^) in the compiler when given a constant argument.
2008-11-17 19:55:41 -08:00
Cary R e191fcdd28 A non-negated reduction needs to change a 1'bz into a 1'bx.
In a procedural single bit non-negated reduction (&, | or ^)
we need to translate a 1'bz to a 1'bx. The easiest way to do
that is with two %inv opcodes. This patch modifies the code
generator to do this for this very special case.
2008-11-17 19:55:25 -08:00
Cary R a8a8d3ce5b Fix MinGW suffix configuration.
In the driver-vpi file we need to use g for the suffix replacement
so that both libraries get changed.

Also added an end line to the config.h.in file.
2008-11-17 19:45:21 -08:00
Stephen Williams 4bc90f7cfd Create support for the --enable-suffix configuration option.
This configure option causes the installed commands to have
a suffix string that makes them distinct from other versions
that also have a suffix string. This allows for multiple
installed versions of Icarus Verilog.

Also, move installed C/C++ header files into a subdirectory of
their own under the target include directory, to make clearer
the purpose and source of those files.
2008-11-17 07:22:46 -08:00
Stephen Williams e98f29e96f Merge branch 'master' into verilog-ams 2008-11-16 18:42:06 -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
Stephen Williams da85c4fe00 Give the branch access expression type some meat.
In the ivl_target API, the IVL_EX_BACCESS expression type gets some meat,
specifically references to the branch it accesses and the the nature to
be accessed on that branch.
2008-11-11 20:41:14 -08:00
Stephen Williams 35a8d42741 Merge implicit branches.
Implicit branches all really are the same branch, so be careful to not
create a new branch if it already exists.
2008-11-10 21:19:30 -08:00
Stephen Williams 00df651c5f Branch references all the way down to the stub generator.
This includes enough API to get the branch nexus bits and signals
and show them in the dump. This also includes creating the reference
ground for branch access functions that use the implicit ground.
2008-11-09 21:42:12 -08:00
Stephen Williams 25201954d3 Bring branches forward as far as the emit method and target_t. 2008-11-09 17:11:04 -08:00
Stephen Williams 0da27a2f45 Collect analog branches into islands.
Discipline islands all along were intended to carry collections of
analog branches, as well as the current switch modeling support.
2008-11-09 15:32:50 -08:00
Stephen Williams 988fc70368 Merge branch 'master' into verilog-ams 2008-11-07 20:14:43 -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 4879b98b3a Merge branch 'master' into verilog-ams 2008-11-07 19:49:52 -08:00
Stephen Williams 13aaaab783 Bring analog contribution statements to the ivl_target API.
Add support for analog processes with analog contributation statements
all the way down to the ivl_target code generator API.
2008-11-06 21:31:34 -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