Commit Graph

96 Commits

Author SHA1 Message Date
Stephen Williams 078a3fd409 Was a little too aggressive with the lossless elab_and_eval
The index expressions ARE self-sized context, we just need to
force the EXPAND flag to make this work.
2014-01-17 18:22:11 -08:00
Stephen Williams 1fc4093191 Fix possible overflow in calculation of canonical indices. 2014-01-15 14:26:53 -08:00
Martin Whitaker 4625e7e2b6 Improvements to strict-expr-width mode.
Enable error reporting when an unsized number is used in a concatenation
operand. Allow greater pruning of expressions containing unsized numbers.
2013-10-28 22:07:09 +00:00
Stephen Williams 18c338ad09 Handle array assignment patters through pform.
This gets us to elaboration. In the process also fix up ivl_type_t
type comparisons to do deep type comparison.
2013-10-19 15:34:14 -07:00
Stephen Williams 2355e1ed8e Clean up some NetNet variable type handling. 2013-10-19 15:34:14 -07:00
Stephen Williams 64b2345cf2 eval_as_long takes in const NetExpr arguments.
It is not the same as eval_tree, in particular it doesn't
rewrite the expression tree. So the NetExpr argument can
be constant.
2013-08-31 18:48:32 -07:00
Cary R a586bfd1ec When finding the canonical address use a signed expression if needed. 2013-06-26 21:27:49 -07:00
Martin Whitaker 26dc6d68cd Handle out-of range and undefined LHS word indices in assignments.
For constant word indices, issue a warning if the index is out of
range or an undefined value. In any case, the RHS value should be
discarded, and the actual assignment should be skipped.
2013-05-18 19:21:37 +01:00
Martin Whitaker 6da71fdf56 Fix type/width for case and case item expressions.
The compiler was treating case and case item expressions as
self-determined. They should be context-sensitive, just like
the operands of a comparison operation.
2013-04-07 12:30:25 +01:00
Martin Whitaker e437321ea7 Fix implicit casts in assignments (part 6).
IVL_VT_NO_TYPE is now used to signal an untyped LHS in a parameter
declaration. The parser function that handles specparam declarations
needs to do this too. Also, although it should never happen, make
sure we don't set the expression width in a NetECast object to a
negative number. Make constant evaluation of NetECast objects
observe the expression width.
2013-03-24 13:51:10 -07:00
Martin Whitaker 6da610fe1e Fix implicit casts in assignments (part 5).
This patch removes some code that has been made redundant by the
more general handling of implicit casts.
2013-03-24 13:51:02 -07:00
Martin Whitaker bc2a4c01c9 Fix implicit casts in assignments (part 2).
This patch adds support for implicit casts in module port connections
and in user task output assignments.
2013-03-24 10:17:17 -07:00
Martin Whitaker 22769afd20 Fix implicit casts in assignments (part 1).
This patch adds support for implicit casts to the elaborate_rval_expr()
function. This will handle the majority of cases where an implicit cast
can occur.
2013-03-24 10:14:07 -07:00
Cary R 8808cd9514 For a LPM constant pass the sign information and one other fix
For a LPM constant we need to pass the sign information so that the vlog95
code generator can create the correct constant. Also when using the
sub_net_from() routine the numeric constant should have the same sign as
the signal so that it can also be displayed correctly.
2013-02-15 11:59:25 -08:00
Cary R 28bc333cba vlog95: block generating a concat-Z LPM device in the compiler.
Since the vlog95 code generator needs the strength information we do
not want to hide it behind a concat-Z optimization. For now we abort
the optimization, but in the future we could add parts of this back
in (e.g. all the drivers have matching strength then replace with a
normal concat and a buf-Z if the strength are not both strong. The
original buf-Z should be removed to reduce the number of LPM devices).
2013-02-13 19:19:21 -08:00
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