Commit Graph

7149 Commits

Author SHA1 Message Date
Cary R e2361fab29 vlog95: Better unsupported select warnings and variable parameter bit select
Since parameters are now passed by reference use that information to print
the parameter name in a select vs trying to figure it out by searching the
scope looking for a parameter with the same file, line and value information.

Only print the $signed() may need to be removed messages for a select
expression that will actually be cast to signed.

Use the actual parameter information to warn that -pallowsigned=1 is needed
for a parameter when the LSB > MSB.
2013-07-05 16:31:05 -07:00
Cary R f6b8d613ab Fix space issue. 2013-07-05 16:20:48 -07:00
Cary R 3a3cd8565d Add elaborate_expr_param_bit_ and pass param refs for variable selects
For variable parameter selects (indexed and bit) pass the value being
selected as a parameter reference instead of just a numeric constant
so it is easy to get the underlying parameter information.

Move the parameter bit select code into its own routine and cleanup
the remaining general code.

This should not effect the VVP code, but the ivl_expr_parameter(<expr>)
routine can be used to get at the actual parameter information in the
vlog95 target.
2013-07-05 16:16:54 -07:00
Cary R b9bcacd803 Update ivl.def file to include new routines and one missing routine
Add the new ivl_parameter routines (lsb, msb, signed) and add the
missing definition for ivl_parameter_scope.
2013-07-05 10:41:51 -07:00
Cary R cbd1b948a2 vlog95: emit an entire parameter reference by name instead of value. 2013-07-05 10:35:31 -07:00
Cary R d1c1997acf Add missing file/line information for a full parameter reference. 2013-07-04 16:50:26 -07:00
Cary R fcbb41c391 vlog95: Get sign info correct for procedural power to shift conversion 2013-07-04 14:33:39 -07:00
Cary R e736c022b1 Merge branch 'master' of github.com:steveicarus/iverilog 2013-07-04 11:30:02 -07:00
Cary R d08e0270e4 Add support for getting parameter MSB, LSB and sign from the ivl interface 2013-07-04 11:29:25 -07:00
Stephen Williams bb1d26f4f7 Fix warning/error finding static properties. 2013-07-03 20:07:58 -07:00
Stephen Williams 173577d5f7 Merge branch 'work14' 2013-07-03 20:00:22 -07:00
Stephen Williams 5326790932 Add support for class static properties.
Static properties are like variables in a named scope.
Detect these variables during elaboration so that the
code generator just sees them as variables.
2013-07-02 20:16:47 -07:00
Stephen Williams 4ef3ac5ca6 Implement const properties of classes.
This implementation works by detecting assignments
to constant properties in elaboration. Allow initializer
assignments to assign to the constant, error all other
assignments, and otherwise treat the constant like any
other property.
2013-07-02 20:16:47 -07:00
Stephen Williams cf47a759d1 Implement the "local" class member protection.
Test during elaboration that the member really is
accessible in the context where the elaboration
happens.
2013-07-02 20:16:47 -07:00
Stephen Williams 046535cfbb Blend implicit constructor with explicit constructor
Class types that have both implicit construction and
an explicit constructor can blend the implicit and
explicit construction into the "new" function defined
by the user. This doesn't change the behavior any, but
removes a function call and related scope.
2013-07-02 20:16:47 -07:00
Stephen Williams 637d43fb5a Add support for logic vector properties in classes.
This is similar to but not the same as bit(bool)
vector properties in classes.
2013-07-02 20:16:47 -07:00
Stephen Williams fbc5557a10 Handle properties that have arbitrary bit widths.
This fixes the run time handling of arbitrary width
bit vectors as class properties. The vvp code generator
already did the right things.
2013-07-02 20:16:47 -07:00
Stephen Williams 75b4b94061 Elaborate implicit initializers
Remaining pform fixup of property initializers, and
elaboration and code generation for implicit constructor.
2013-07-02 20:16:46 -07:00
Stephen Williams d346fb098f Collect initializer statements in the pform. 2013-07-02 20:16:46 -07:00
Cary R 633360a0f9 vlog95: More procedural $signed/$unsigned support/cleanup 2013-06-28 14:16:10 -07:00
Cary R 0e8a257ec2 vlog95: Fix the passing of the sign extend information in a CA 2013-06-27 19:44:17 -07:00
Cary R 7fa4cf5a34 vlog95: Fix a RS vs ARS in the CA code 2013-06-27 18:22:21 -07:00
Cary R eecc3312b7 vlog95: Add $signed/$unsigned support for signals
The actual signal code is trivial, but the emit expression code needed
to be enhanced to pass a flag that says if one of the arguments in a
binary (except the shifts) or ternary (excluding the condition) context
is unsigned. This information is used to prevent emitting an explicit
$unsigned() for a signal that is used in this context since it will be
implicitly cast to unsigned.
2013-06-27 13:31:40 -07:00
Cary R 11e5641089 A real task/function port is also signed. 2013-06-27 13:03:11 -07:00
Cary R f631cb6314 Add some support for procedural $signed/$unsigned.
This patch adds support for finding and adding $signed() and $unsigned()
to procedural expressions for the binary, unary and concatenation
operators. Selects have partial support. The select implementation
uncovered limitations in the compiler that need to be fixed before they
will work 100%. Most of the limitations currently generate a message
about the issue.
2013-06-26 21:46:02 -07:00
Cary R a586bfd1ec When finding the canonical address use a signed expression if needed. 2013-06-26 21:27:49 -07:00
Cary R 4dbd0442aa Add missing file/line information to a few expressions. 2013-06-26 21:25:27 -07:00
Cary R fa9a439bf1 Update fstap files to the latest from GTKWave 2013-06-14 16:35:22 -07:00
Cary R 11e394aacf Remove space error 2013-06-14 16:35:09 -07:00
Martin Whitaker 9af0811a1c Fix for br932 part 2 - make $fopen accept SV 'string' type.
The is_string_obj function in vpi/sys_priv.c needed to be updated to
recognise the vpiStringVar object type.
2013-06-14 21:00:39 +01:00
Martin Whitaker 503487e9ea Fix for br932 - support string types in task input ports. 2013-06-13 23:18:23 +01:00
Stephen Williams ca9616dc7b Better simple_expression parse rules. 2013-06-12 14:21:36 -07:00
Stephen Williams 24bd630cb2 Parse (to sorry messages) unbounded array definitions. 2013-06-12 14:21:36 -07:00
Stephen Williams 8487cb5616 Do a better job of figuring the vtype of an expression. 2013-06-12 14:21:36 -07:00
Stephen Williams d630e4dfe9 Elaborate VHDL entity port types/expressions.
We need to elaborate expressions so that function calls in
expressions (i.e. ranges) get bound to their proper scope.
This binding is in turn used to emit package scopes. This
is particularly interesting for ports of entities.
2013-06-12 14:21:35 -07:00
Stephen Williams 3d5765949e Some shorthand type marks in write_to_stream. 2013-06-12 14:21:35 -07:00
Stephen Williams 0fcd2d9db6 Handle rising_edge and falling_edge functions. 2013-06-12 14:21:35 -07:00
Stephen Williams 3446455055 Support compile-time evaluation of named blocks. 2013-06-12 14:21:35 -07:00
Stephen Williams af304fea65 Fix repeated use of disabled const functions.
If constant functions are exited by a return/disable, fix
the leaked "disable" flag that causes blocks in the next
try at the function to not work.

There are also a lot of debug messages added to help find
this and similar problems.
2013-06-12 14:09:08 -07:00
Stephen Williams bcaa6accec Fix evaluation wrong expression for const >= expressions. 2013-06-12 14:09:08 -07:00
Stephen Williams 5c00b96127 Handle constant functions from other scopes, i.e. packages. 2013-06-12 14:09:08 -07:00
Stephen Williams bfe3998eaa Lexor detects that excaped identifiers may be package names. 2013-06-12 14:09:08 -07:00
Stephen Williams 096e53dea4 Don't crash if function is not found. 2013-06-12 14:09:08 -07:00
Stephen Williams bc77a19059 Use $ivl_unsigned to implement VHDL to_unsigned function.
The VHDL to_unsigned function with to arguments is best handled
in the ivl elaborator, so have it generate an $ivlh_to_unsigned
function call in the vhdlpp code, and implement it in the ivl
core.

Also, implement the 'length attribute as a $bits() call for
similar reasons.
2013-06-12 14:09:08 -07:00
Stephen Williams 1b178d56b7 Add support for SystemVerilog return statements. 2013-06-12 14:09:07 -07:00
Stephen Williams dca6171f5f SV emit function ports in package subprograms. 2013-06-12 14:09:07 -07:00
Stephen Williams 164b5f9348 Fix SV emit of ForLoopStatement and ReturnStmt. 2013-06-12 14:09:07 -07:00
Stephen Williams e927960121 Implement subprogram bodies in package bodies. 2013-06-12 14:09:07 -07:00
Stephen Williams 6394a4d78d Rework scope types and constants so we can tell imported from local names.
The package emit of types and constants needs to know which names are
from the current type and which are imported from libraries. Rework
the scope handling of those names so that the information is preserved.
2013-06-12 14:09:07 -07:00
Stephen Williams 13be45bd73 Fix dump of primitive CHARACTER types. 2013-06-12 14:09:07 -07:00