Commit Graph

7964 Commits

Author SHA1 Message Date
Cary R 15379f1750 Remove some compile warnings 2013-04-17 17:13:22 -07:00
Cary R 0a4d8acefb vlog95: Add support for translating a package as a module with a special name
This patch finishes the code needed to translate a SystemVerilog package to a
module with a special name. It also adds code to report that class scopes are
not supported and treats both a class and package as a top level scope.
2013-04-17 10:43:04 -07:00
Stephen Williams 632fd006c5 Merge branch 'master' of github.com:steveicarus/iverilog 2013-04-16 16:56:14 -07:00
Stephen Williams 256c0986bb Merge branch 'work13b' 2013-04-16 16:47:37 -07:00
Cary R db7fbba08e Update fstapi.c to latest from SVN. 2013-04-16 15:00:25 -07:00
Cary R f536a43e92 Add support for timeunit <time_val> / <time_val> 2013-04-16 14:40:35 -07:00
Cary R 283ae6e538 Fix some cppcheck warnings in vvp. 2013-04-15 12:28:35 -07:00
Cary R fbafb915d2 Fix some cppcheck warnings 2013-04-15 11:54:15 -07:00
Martin Whitaker 4c52f66f5d Fix VHDL code generator crash when a ternary operator has a real operand. 2013-04-12 23:46:06 +01:00
Martin Whitaker 46f63db746 Fix VHDL code generator crash when code contains a real-valued parameter. 2013-04-12 23:41:52 +01:00
Stephen Williams 4ad556d464 Update some copyright notices. 2013-04-08 18:35:37 -07:00
Stephen Williams 4dffd97d28 Handle tasks in packages. 2013-04-08 18:20:39 -07:00
Stephen Williams b1d853bf9b Fix handling of struct members for variables imported from packages. 2013-04-08 18:20:39 -07:00
Stephen Williams eba3d407ca packages can contain variables. 2013-04-08 18:20:39 -07:00
Stephen Williams 44cd9158e8 Elaborate parameters, tasks and functions in packages.
Get the elaboration to happen all the way to the ivl_target
interface.
2013-04-08 18:20:39 -07:00
Stephen Williams b122ec2a1a parameter table in ivl_scope_s uses vector instead of C arrays. 2013-04-08 18:20:39 -07:00
Stephen Williams bae0f1d3a7 Parse more package items
Rework lexical support for PACKAGE_IDENTIFIER so that the lexor
can help with package scoped identifiers.

Pform package types and package functions up to elaboration.
2013-04-08 18:20:39 -07:00
Martin Whitaker 23dbfabb1e Further support for constant functions.
Add support for case, forever, and repeat statements in constant
functions. Also fix a bug in the constant function implementation
of NetESelect when used for zero/sign extension.
2013-04-07 19:13:30 +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
Cary R bdfd5b9b55 Add -g2012 flag and keywords for IEEE 1800-2012. 2013-04-02 14:41:44 -07:00
Stephen Williams 64dffa5745 Support member functions with arguments. 2013-03-24 15:12:35 -07:00
Stephen Williams b9011d89ae Allow objects to work in automatic functions. 2013-03-24 15:12:35 -07:00
Stephen Williams 3b3a4d3ddc vvp code generation for class methods in class scope. 2013-03-24 15:12:35 -07:00
Stephen Williams b1613e99e6 Elaborate function methods' this argument. 2013-03-24 15:12:35 -07:00
Stephen Williams d0f2a9e961 Elaborate task methods as tasks with this arguments.
Generate the code to treat "this" as a hidden argument and have
elaborate assign to that argument.
2013-03-24 15:12:35 -07:00
Stephen Williams fb23493a98 Class methods down to the code generator
Emit the elaborated class methods. Also generate root scopes to
represent the classes in order to hold the methods. These scopes
can also in the future be used to implement static properties.
2013-03-24 15:12:35 -07:00
Stephen Williams 17330a3073 Elaborate class task and function methods.
The parse of class methods already works, this patch forms
the methods into their own scopes, and elaborates those scopes.
The "this"
2013-03-24 15:12:35 -07:00
Stephen Williams fac5cbca43 Handle this as special identifier strings. / Organize pform class member binding 2013-03-24 15:03:52 -07:00
Stephen Williams 670601bc2a Mark class method pforms with their pform class. 2013-03-24 15:03:52 -07:00
Stephen Williams 25b48fa790 Remove svector template from port handling. 2013-03-24 15:03:52 -07:00
Stephen Williams dd5fb47c6c pform dump class methods. 2013-03-24 15:03:52 -07:00
Martin Whitaker b80401e1ee Improved error reporting for constant user functions. 2013-03-24 14:43:10 -07:00
Martin Whitaker 1bcd3a97ad Support disable statements and system task calls in constant functions.
This patch implements the evaluate_function method for the NetDisable
and NetSTask classes. It also makes the checks for a function being
constant work when the function contains nested scopes (named blocks).
2013-03-24 14:42:59 -07:00
Martin Whitaker 09f90ab4e1 Add control to enable function evaluation at compile time.
Pure functions with constant operands can be evaluated at compile
time rather than at run time. This patch provides a global control
to enable this optimisation. Until constant function support is
complete, by default it is disabled.
2013-03-24 14:42:05 -07:00
Martin Whitaker 5929a00845 Handle uninitialised variables in constant user functions. 2013-03-24 14:40:44 -07:00
Martin Whitaker 5d7558b5e0 Fix assigned vector size in constant user functions.
When assigning to a bit/logic variable, the RHS expression value
must be trimmed to match the size of the variable.
2013-03-24 14:40:10 -07:00
Martin Whitaker ee71ade720 Handle implicit cast when short-circuiting ternary expression.
If a ternary expression with mixed logic and real operands is
short-circuited and the logic value is selected, that value
should be cast to a real value.
2013-03-24 14:24:42 -07: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 e8d4039175 Fix implicit casts in assignments (part 4).
This patch fixes a few issues/bugs that showed up when testing the
fixes for implicit casts:

1. Make the compile-time implementation of $abs, $min, and $max match
   the run-time behaviour (system functions can't be polymorphic).

2. Correctly set the type (signed/unsigned) of the result of an
   assignment inside a constant user function (the LHS should not
   inherit the type of the RHS).

3. Fix a bug in the verinum(double) constructor (insufficient bits
   were allocated in the case where the double value rounded up to
   the next power of two).
2013-03-24 13:50:59 -07:00
Martin Whitaker faece5816c Fix implicit casts in assignments (part 3).
This patch adds support for bool/bit vector types on the LHS of
a parameter declaration and ensures implicit casts in parameter
declarations are performed where necessary.
2013-03-24 13:50:53 -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 03ebd2f98d vlog95: Emit a package as a module with a special name. 2013-03-11 10:46:13 -07:00
Cary R b378dccbe9 Update parameter add code to correctly handle a non-Module scope
A package can have parameters, but it does not have specparams or
keep the order the parameters are defined. This patch skips these
items if the scope is not a Module.
2013-03-08 10:04:46 -08:00
Cary R 1f9489a65d vlog95: report that package scopes are not supported. 2013-03-07 10:38:48 -08:00
Cary R f436b5d18e Fix comparison vs assignment in new code. 2013-03-07 10:02:32 -08:00
Stephen Williams 64401ab815 Merge branch 'work13a' 2013-03-04 08:59:50 -08:00
Stephen Williams 952169ded9 Merge branch 'master' of github.com:steveicarus/iverilog 2013-02-24 08:36:23 -08:00
Cary R 1b36aa5560 vlog95: Add code to output specify block path delays.
There are limitations with this since the compiler does not pass all
the information that was present in the original source, but it is enough
to get a valid simulation result. It is not enough for timing analysis!
specparams are also incorrectly translated to parameters so they show up
in the wrong place.
2013-02-23 14:32:49 -08:00