Commit Graph

81 Commits

Author SHA1 Message Date
Stephen Williams 751587e112 PV-to-concat belnding should use a strength-aware concat. 2013-02-02 10:44:16 -08:00
Stephen Williams 367d7bf94b Blend NetPartSelect(PV) objects into NetConcat
If a signal s driven by multiple non-overlapping NetPartSelect(PV)
objects, then combine them into a single NetConcat object. This
eliminates the need for resolvers in the target.
2012-12-19 19:01:22 -08:00
Cary R 15fb58f8e4 Remove some cppcheck warnings, etc. 2012-11-12 18:15:25 -08:00
Martin Whitaker 78128dd95d Fix for pr3582052.
The code that calculated the canonical index for a multi-dimensional
array access did not correctly estimate the index expression width
in the case that the first index value was a constant zero. This
patch fixes the problem, and, in passing, also makes the expression
calculation more efficient if any of the indices are constant zeroes.
2012-11-03 10:30:17 -07:00
Stephen Williams d6efece5dd Handle DARRAYs of real variables
This involves working out the code to get the base type of a select
expression of a darray. Also added the runtime support for darrays
with real value elements.
2012-10-14 17:16:47 -07:00
Stephen Williams 914ebeca4a Some rework to allow for nested packed types.
This also simplifies the NetNet set of contructors and generalizes
the types that are supported, especially packed types.
2012-10-14 17:16:47 -07:00
Stephen Williams 92313654ec Rework the way vectors are represented in NetNet objects. 2012-10-14 17:16:47 -07:00
Stephen Williams 174177d437 Rework symbol search to work incrementally.
This is necessary to handle paths that turn out to end with
member names instead of symbol names.
2012-09-03 16:00:10 -07:00
Stephen Williams 0bdabab4fb Rework packed dimensions handling
Make packed structs more obviously parts of a vector.
Handle arrays of structs in certain cases.
2012-09-03 16:00:10 -07:00
Stephen Williams b4cc9d14a5 Handle packed arrays of packed struct in l-value expressions. 2012-09-03 16:00:09 -07:00
Arun Persaud f5aafc32f9 updated FSF-address 2012-08-29 10:12:10 -07:00
Stephen Williams 14f229de30 Parse support for dynamic arrays.
This includes limited support for dynamic arrays down to the code
generator, and some stubs in the vvp code generator and vvp run time.
2012-07-22 10:52:06 -07:00
Stephen Williams 342646264e Merge branch 'pei1' 2012-05-25 16:32:12 -07:00
Stephen Williams 6e8aef8262 Get unpacked arrays working. 2012-05-25 15:58:29 -07:00
Stephen Williams 78b0b49a4e Support struct members that are packed arrays. 2012-05-22 17:31:25 -07:00
Martin Whitaker 44c5a37ab8 Allow specparam declarations outside specify blocks.
This patch extends the compiler to support all specparam declarations
allowed by the 1364-2005 standard. For compatibility with other
simulators, it allows specparam values to be used in any constant
expression, but outputs a warning message and disables run-time
annotation of a specparam if it is used in an expression that must
be evaluated at compile time.
2012-05-17 16:18:38 -07:00
Martin Whitaker 75b12151a4 Disable width minimisation of literal numbers passed to system tasks.
The final step of expression elaboration is to reduce the width of
lossless/unsized constant expressions to the minimum needed to hold
the resulting constant value. This leads to unexpected results if
the user supplies a literal number with redundant digits that gets
passed to a system task that is sensitive to the width (e.g. $display).
This patch prevents width reduction occurring in this case.
2012-04-30 16:39:30 -07:00
Stephen Williams 77f168cf28 Support non-constant indexed part select of packed arrays. 2012-02-12 14:52:47 -08:00
Stephen Williams c1b73c83f4 Respond better to some error/sorry situations. 2012-02-12 11:16:31 -08:00
Stephen Williams 6eeef8311f Handle indexed bit select of packed arrays.
This handles a few cases where the non-constant bit selects are
in the final index. This doesn't handle all the cases of packed
arrays, but it handles some common cases.
2012-02-12 10:13:20 -08:00
Stephen Williams 3e4f8b625f Get packed signals working through to simulation in some situations.
When dynamic indexing of early dimensions is not needed, we can get
pretty far with getting packed arrays to work.
2012-02-10 17:17:59 -08:00
Stephen Williams e5c49022b4 The NetNet class carries multiple packed dimensions. 2012-02-06 17:47:53 -08:00
Cary R aa2a063bc0 Remove the use of a freed variable.
If a constant is padded the original constant will be freed and replaced
with a new one. This results in the ce pointer pointing to freed memory.
In reality the second check only needs to be done if the first one is
false so avoid the whole issue by only performing the second check if
the first on is false.
2011-10-14 17:59:54 -07:00
Prasad Joshi fa589badd8 Add support for increment and decrement operators
This patch adds support for increment/decrement operators as an
expression. The operations on real and vector slices have been
disabled for now.

These operators can be used as in independent statements. However, the
corresponding support is not added in parser.

Changes since V2:
- Additional error checking in elaboration to deny operation on vector
slices and real (suggested by Martin)

Changes since V1:
- Use 'i' and 'I' for increment (suggested by Cary)
- Evaluate sub-expression once (suggested by Cary and Stev)
- Add necessary checks during elaboration to ensure that the
	expression is valid (suggested Stev)
- Proper width handling with vectors (suggested by Martin)

Signed-off-by: Prasad Joshi <prasad@canopusconsultancy.com>
2011-08-11 14:25:19 -07:00
Stephen Williams 4989555646 Fix unary convert of real to bool
Sometimes real values are converted to BOOL values, and the
NetECast needs to handle it properly.
2011-07-20 18:45:13 -07:00
Martin Whitaker 93067149f1 Rework of constant expression error reporting.
This patch changes the method used to signal that a constant expression
is being elaborated from flags stored in global variables to flags
passed down the call chain. It also generates more informative error
messages when variable references are found in a constant expression.
2011-04-06 18:50:53 -07:00
Stephen Williams d83728031d Over-zealous assertion checking PartSelect::PV widths. 2011-04-03 17:44:11 -07:00
Stephen Williams 098bbeea7c Support collapse of PartSelect::PV to concatenation
During elaboration, it is sometimes efficient to collapse a
collections of PV drivers to a net to a single concatenation.
This removes a bunch of resolutions and other nodes, and also
is the only way that 2-value logic should work.
2011-04-03 17:43:57 -07:00
Martin Whitaker 53429589b1 Fix for pr3197861.
This patch adds a check on the expression type before adjusting an
unsized expression width up to integer_width. This adjustment should
only be performed for vectorable expressions.

The patch also fixes a few compiler warnings that only show up on
32-bit builds.
2011-03-02 19:28:29 -08:00
Martin Whitaker 312b4da46f Expression width rework.
This patch is a major rework of expression elaboration and
evaluation in the compiler, aimed at better compliance with
the IEEE standard.
2011-03-01 18:13:26 -08:00
Cary R 629ee5b899 Fix a number of file/line issues in the compiler.
This patch fixes a bunch of objects to have the correct file/line
information. It also adds support for getting file/line information
for events (named events have a definition line).
2011-02-10 19:10:21 -08:00
Stephen Williams 16e1570737 Merge branch 'master' into work2
Conflicts:
	elab_scope.cc
	net_nex_input.cc
	t-dll-api.cc
	vvp/parse.y
2010-11-28 08:38:40 -08:00
Stephen Williams d37126bda5 Implement enum first/last/num methods. 2010-11-05 19:49:28 -07:00
Cary R bb5ca97f2d Fix some -Wextra warnings and some other bug fixes/enhancements.
This patch covers more than it should. It removes many of the -Wextra
warnings in the main ivl directory. It also makes some minor code
improvements, adds support for constant logicals in eval_tree (&&/||),
adds support for correctly sign extending === and !==, it starts to
standardize the eval_tree debug messages and fixes a strength bug
in the target interface (found with -Wextra). The rest of the warnings
and eval_tree() rework will need to come as a second patch.
2010-11-02 11:05:11 -07:00
Cary R 225ca1e205 Change iterators to use prefix ++ since it is more efficient.
This patch changes all the iterator code to use a prefix ++ instead
of postfix since it is more efficient (no need for a temporary). It
is likely that the compiler could optimize this away, but lets make
it efficient from the start.
2010-11-02 10:43:16 -07:00
Stephen Williams b081818a90 Cast expressions from logic to bool.
Handle assignments from logic to bool variables by inserting
the proper cast expression nodes.
2010-10-19 19:09:06 -07:00
Stephen Williams 9c634e1640 Add a net node for casting to IVL_VT_BOOL values.
BOOL values have a specific cast from LOGIC, this node takes care
of it. Also arrange for the elaboration to insert them in the right
planes and for the code generator to generate them.
2010-10-16 10:53:20 -07:00
Stephen Williams ec49f10e2d Revert bad merge from vhdl branch 2010-10-02 11:02:27 -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 c7afb4f51a Call probe_expr_width() before elab_and_eval() when evaluating a path.
You need to probe the expression width before trying to elaborate and
evaluate an expression. The eval_path_component() routine was missing
this and was causing an assert.
2010-06-08 11:07:17 -07:00
Cary R 81d4cbc4bd Add some casts in main directory 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
mas as well remove the warnings 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:41:46 -08:00
Cary R fe3dd3a559 Add support for initializing outputs declared as output reg.
The standard allows an output declared as "output reg" to be
given an initialization assignment in the output declaration.
this patch adds that functionality. Specifically:

  output reg out = 1'b0;

works as expected.
2009-05-18 17:43:54 -07:00
Cary R d143597996 Add better constant user functions are not supported messages.
This patch adds messages in various places to warn that constant
user functions are not supported. It uses a global variable to
indicate when we are in a constant context. This is a bit of a
kludge, but works well without needing to change a bunch of code.

It is interesting to note that ports are elaborated late enough
that if we had the constant function evaluation code they would
evaluate correctly. This also applies to the function return
range, the concatenation repeat, specparams and initial values.

Signal definitions are early enough that elaboration is what is
failing because the function body is not available (has not been
elaborated). The same thing applies to both parameters and
localparms.
2009-02-27 21:29:54 -08:00
Cary R 93ad8ff95f Add logical support for real values and error for invalid real arguments.
This patch adds logical support for real values (!, && and ||). It
also prints an appropriate error message when a real value is
incorrectly given to an operator that does not allow real arguments
(bit-wise, reduction, shift and repeat/concatenation).
2009-02-16 12:12:15 -08:00
Stephen Williams d7a67d6d17 Better error message about part selects on invalid objects.
Not all identifier types may have a part select, even when a bit
select is OK. Better handle that case.
2009-01-28 20:12:10 -08:00
Stephen Williams adbaaa9352 Add some more human readable strings for operand codes. 2008-12-19 17:17:39 -08:00
Stephen Williams d1ce6d2535 Fix the signed-ness calculations of +- in parameter expressions.
This fixes up the elaboration of binary expressions found in
parameter expressions. Parameter expressions are special because
they elaborate early, before all the other parameters are necessarily
completed.
2008-12-18 21:33:31 -08:00
Stephen Williams 82143edf2c Rework shift and power PExpr nodes for their special needs.
The power (**) and shift operators are different from other binary
operators because their expression width calculations rely only on
their left operand, with their right operand self-determined. Get
the handling of these operators out of the PEBinary base class to
prevent confusion.
2008-11-28 14:40:25 -08:00
Stephen Williams 90bfebd578 During test_width is not the time to assert on no_type
unary expressions that have problems should not assert in the
test_width method. Instead, let the error propagate back and be
handled during expression elaboration. This found a few places
where expression widths/types weren't probed before elaboration.
2008-11-26 15:37:38 -08:00
Cary R 6b62cce14a Produce a better message for ! and real values.
In the transition to the new expression code we forgot how to
handle the logical not (!) of a real value. This patch adds a
more appropriate error message until we get this reimplemented.
2008-09-30 21:53:25 -07:00