Commit Graph

391 Commits

Author SHA1 Message Date
Martin Whitaker 027e060865 Fix for br992 - prevent assertion/crash on declarations outside a module.
parse.y has been updated to allow declarations outside a module (legal
in SystemVerilog), but not all types of declaration are supported yet.
Output a sorry or error message as appropriate.
2015-08-21 00:02:42 +01:00
Larry Doolittle 29478eba4c Squelch just a few trailing spaces in source code 2015-08-17 11:44:45 -07:00
Martin Whitaker 428f059c58 Fix shadow warning introduced by MVSE 2015 hacks. 2015-08-07 23:05:02 +01:00
Frederick C. Kurz fc976bdb97 Changes for pform.cc
First area of Change for "Microsoft Visual Studio Express 2015 RC Web" was for compiling with error when NDEBUG defined.  The second and third areas of change for "Microsoft Visual Studio Express 2015 RC Web", the dynamic_cast has to come first so parpkg_test.v, parpkg_test1.v, parpkg_test2.v would pass.
2015-07-22 09:22:26 -07:00
Martin Whitaker 4068c172f4 Fix overzealous detection of duplicate net/variable declarations.
As reported by Larry Doolittle on iverilog-devel.
2015-06-07 08:48:33 +01:00
Martin Whitaker 578a2543f7 Fix for br975 - assertion failure due to duplicate declaration of struct var.
Added proper error handling for duplicate declarations of all variable
types.
2015-05-17 20:54:53 +01:00
Martin Whitaker c6e618350d Fix for GitHub issue #60 (part 1) - reject numeric constant with zero size. 2015-04-26 11:04:02 +01:00
Maciej Suminski 46c41f9be2 ivl: Enum type can be used in port declarations. 2015-02-05 17:17:33 +01:00
Maciej Suminski bcca3cf395 ivl: Unpacked array typedefs are correctly recognized when used in function parameters. 2015-02-04 15:58:12 +01:00
Maciej Suminski b6e16aea6b ivl: Typedefs may use unpacked arrays. 2015-01-12 11:08:31 +01:00
Martin Whitaker bca84d9dbb Added parser support for SV modport declarations. 2015-01-10 11:10:41 +00:00
Martin Whitaker b400532169 Added support for interface declaration and instantiation.
modport and extern tf declarations are not yet supported.
2014-12-19 23:10:14 +00:00
Stephen Williams 8fd1ead082 Revert "ivl: Allow to initialize variables with other variables (since Verilog-2001)."
This reverts commit 610ca95cbe.
It turns out that the new feature is actually a bug.
2014-12-03 08:27:01 -08:00
Maciej Suminski 610ca95cbe ivl: Allow to initialize variables with other variables (since Verilog-2001). 2014-11-27 17:36:23 +01:00
Cary R 632e15a55c Catch enumerations with the same name. 2014-10-31 20:06:28 -07:00
Cary R c25538d750 Pass the integer type for enumerations to the IVL target stage 2014-10-31 18:09:19 -07:00
Stephen Williams 23238aa7ac Handle functions in $root scope. 2014-10-02 15:04:14 -07:00
Stephen Williams c5fee8bdb9 Elaborate root tasks/functions. 2014-09-30 16:06:32 -07:00
Stephen Williams fa21527e9f Classes in $root scope up to elaboration. 2014-09-15 17:37:30 -07:00
Stephen Williams 853512868b Merge branch 'x-mil15' 2014-09-08 21:10:14 -07:00
Cary R ec2793c9b0 Warn that classes defined in the compilation unit scope are not supported 2014-09-08 16:59:18 -07:00
Stephen Williams 9fa764285a foreach multiple indices through the pform. 2014-08-30 10:18:57 -07:00
Maciej Suminski a67f18f8ef ivl: Do not delete range objects right after setting range for a net. 2014-08-28 10:02:56 +02:00
Stephen Williams 5de83906f7 Sorry message for multi-dimension foreach loop indices. 2014-08-21 20:34:55 -07:00
Stephen Williams f602ae84ab Elaborate foreach loops as synthetic for loops.
Create an implicit scope to hold the index variable, and
generate a for loop to perform the functionality of the
foreach.
2014-08-21 16:44:46 -07:00
Cary R 588409389e SV: Add support for var decls in unnamed begin/end blocks.
SystemVerilog allows variables to be declared in unnamed begin/end
blocks. This patch adds support for this functionality.
2014-07-22 18:58:23 -07:00
Stephen Williams 14f597acdd Add support for synthesis translate meta-comments. 2014-07-15 18:03:40 -07:00
Cary R 0611135758 Some more cppcheck cleanup/updates 2014-06-29 20:39:40 -07:00
Martin Whitaker d96e8872c1 Fix for GitHub issue 25 - compiler crash when function declared outside module.
This is an error in traditional Verilog and a unsupported feature in
SystemVerilog. Fail gracefully with a suitable error/sorry message.
Do the same for task declarations.
2014-05-23 21:55:46 +01:00
Stephen Williams 6caa41cc93 First pass at support for continuous assign of unpacked net arrays. 2014-04-06 08:40:09 -07:00
Stephen Williams f8e33b12cd Clean up pform_module_define_port in preparation for new tricks.
Get rid of the data_type, signed_flag, and range arguments to the
pform_module_define_port because they add no value within the
parse.y parser. Cleaning these out will hopefully ease the addition
of new functionality.
2014-04-06 08:40:09 -07:00
Stephen Williams a849249a86 Allow typedefs to override inherited type names. 2014-04-06 08:40:08 -07:00
Larry Doolittle 3e95966d70 More spelling fixes
Mostly comments
Changs "initilzers" in a string visible with debug_elaborate.
Includes a few British->American changes in the root directory only.
2014-01-30 16:43:17 -08:00
Larry Doolittle be17bfc0e9 Spelling fixes
Mostly comments.
One user-visible string ("Evalutated to ") changed in the debug_eval_tree case.
2014-01-30 15:34:20 -08:00
Stephen Williams a3b29dd70b Handle enumeration literals that are in $root. 2014-01-11 19:19:14 -08:00
Stephen Williams b0491b9c54 Handle typedefs in $root scope. 2014-01-11 19:19:14 -08:00
Stephen Williams 819770a6c4 Handle enumerations as packed struct/union members.
There were also some subtleties related to using enumerations
from typedefs and using them in multiple places. Fix various
bugs related to those issues.
2013-12-07 12:20:28 -08:00
Stephen Williams 9a116498a2 Handle task/function default expressions in parsing/pform.
This gets it to (but not through) the elaborator.
2013-09-20 20:44:56 -07:00
Cary R 07cc18284c Fix print token/argument mismatches and other cppcheck fixes 2013-09-09 13:34:38 -07:00
Martin Whitaker 503487e9ea Fix for br932 - support string types in task input ports. 2013-06-13 23:18:23 +01:00
Martin Whitaker 6364aba975 Fix for br930 - support attributes on old-style port declarations. 2013-05-19 09:16:24 +01:00
Cary R 71c6193ff1 Finish adding support for end labels in SystemVerilog 2013-05-14 15:01:54 -07:00
Cary R 51d3c03922 A time variable is always unsigned and pass the integer property 2013-04-30 14:05:19 -07:00
Stephen Williams de6c57d661 Elaborate classes in lexical order so that mutual references work. 2013-04-28 16:28:24 -07:00
Stephen Williams 20ee350601 Generalize user defined function return type handling.
I'm gonna need functions to return class objects, so generalize
the output types of user defined functions.
2013-04-20 16:38:35 -07: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 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
Cary R bdfd5b9b55 Add -g2012 flag and keywords for IEEE 1800-2012. 2013-04-02 14:41:44 -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 25b48fa790 Remove svector template from port handling. 2013-03-24 15:03:52 -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
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
Stephen Williams 8fa79ceb30 Properly implement import <pkg>::<name>
This was temporarily implemented to just copy definitions to the
local scope, but the better method is to create a PEIdent that has
the package attached to it.
2013-02-17 17:00:15 -08:00
Stephen Williams 99b8086ad2 Import parameters from packages. 2013-02-17 16:59:21 -08:00
Stephen Williams 77d24cd095 Elaborate class_new and (null) expressions
This gets the types right for class_new and null expressions, and
elaborate them down to the ivl_target.h API.
2012-12-10 19:13:43 -08:00
Cary R 15fb58f8e4 Remove some cppcheck warnings, etc. 2012-11-12 18:15:25 -08:00
Stephen Williams 62be9c5b46 Parse (with sorry message) package declarations. 2012-10-21 11:42:19 -07:00
Stephen Williams b8093be42f Rework parse rules to handle more net types.
This makes the rules for types to be more in line with IEEE1800.
2012-09-03 16:00:10 -07:00
Stephen Williams f24d6b055d Use data_type_t instead of raw type bits. 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 3d9ed1f0f8 Clean up PWire handling of wire data type. / Reword packed type handling 2012-09-03 16:00:09 -07:00
Arun Persaud f5aafc32f9 updated FSF-address 2012-08-29 10:12:10 -07:00
Martin Whitaker 1f152aa838 Fix for pr3557493.
defparam assignments found inside a generate block were being stored
in the enclosing module scope. They should be stored in the generate
block scope.

Also removed the genvar list from the PGenerate class, as this is
already declared in the base LexicalScope class.
2012-08-21 17:46:34 -07:00
Cary R 4313fbbf1f Fix space errors in various files 2012-08-16 11:13:32 -07:00
Cary R 7ce8a9b01c Fix some cppcheck warnings in the main directory 2012-08-08 11:28:20 -07:00
Stephen Williams d48362b861 First pass at getting strings to work.
In vvp, create the .var/str variable for representing strings, and
handle strings in the $display system task.

Add to vvp threads the concept of a stack of strings. This is going to
be how complex objects are to me handled in the future: forth-like
operation stacks. Also add the first two instructions to minimally get
strings to work.

In the parser, handle the variable declaration and make it available
to the ivl_target.h code generator. The vvp code generator can use this
information to generate the code for new vvp support.
2012-07-22 10:52:06 -07:00
Stephen Williams c0f35cbe62 Disallow modules/gates in program blocks. 2012-05-27 18:26:53 -07:00
Stephen Williams dfe7beec31 Allow modules (and program blocks in particular) to nest.
An important advantage of program blocks is its ability to nest
within a module. This winds up also allowing modules to nest, which
is legal but presumably less used feature.
2012-05-27 18:26:53 -07:00
Stephen Williams 580c44c015 Prevent non-blocking assignment in program blocks. 2012-05-27 18:26:53 -07:00
Stephen Williams 0833d9e37a Basic support for program blocks. 2012-05-27 18:26:53 -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 ceaa60d2f4 Parse (to "sorry") arrays of named types. 2012-05-22 17:31:27 -07:00
Stephen Williams 247f6a4ecf Handle properly parsed structs in module ports. 2012-05-22 17:31:26 -07:00
Stephen Williams b7b633b613 module output ports use data_type_t types.
This is in place of ad hoc type information passed to the
pform_module_define_port function.
2012-05-22 17:31:26 -07:00
Stephen Williams c7366e65cd Rework port input and inout to use data_type_or_implicit rule for types. 2012-05-22 17:31:26 -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
Stephen Williams 5d05d97eb0 Repair handling of attributes attached to variables. 2012-05-09 10:56:52 -07:00
Stephen Williams 13348ba7ac Ranges are ranges, not expression lists.
This is a cleanup in preparation for better support of range lists.
(cherry picked from commit 8f7cf3255acad55841f8b3725e3786ef49daad68)

Conflicts:

	PTask.h
	elab_scope.cc
	elab_sig.cc
	parse.y
	pform.cc
	pform.h
	pform_types.h

Signed-off-by: Stephen Williams <steve@icarus.com>
2012-04-10 14:29:28 -07:00
Stephen Williams 3657b15428 Merge branch 'x-ms1' 2012-04-02 19:22:31 -07:00
Stephen Williams 5dbe688296 Allow variable initialization in any scope.
This is a SystemVerilog feature, so only allow it when
compiling SystemVerilog files.
2012-03-11 15:08:42 -07:00
Stephen Williams b0d61813b2 Get the scope of class methods right
Class methods belong in a class scope, not the containing module.
So create a lexical scope that carries tasks and functions and
create a PClass to represent classes.
2012-03-11 13:18:24 -07:00
Stephen Williams da743c3b2c Bunches more SystemVerilog syntax. 2012-03-09 18:54:05 -08:00
Stephen Williams 0e01dcf2b9 Miscellaneous SystemVerilog syntax.
... and sorry messages.
2012-03-04 19:33:16 -08:00
Stephen Williams f749867369 Rework rules for variable_dimensions, and support more syntax. 2012-03-02 18:34:43 -08:00
Stephen Williams 410350ae5a Rework data_type parsing to bring integer vectors into data_type_t method.
This adds the vector_type_t and real_type_t types to handle
vector and real types in tf_port items. This cleans up a lot
of the parsing for these items.
2012-02-25 22:05:00 -08:00
Cary R bae02433b7 Remove some more warnings in pform.cc Ubuntu 11.10 (gcc/clang)
Remove a few more warnings from the gcc and clang compilers on
Ubuntu 11.10.
2012-02-22 17:27:27 -08:00
Stephen Williams f8e346f108 Implement increment/decrement statements.
During parse/pform processing, convert increment statements to
the equivalent compressed assignment statement. This is less weird
for elaboration processing and better expresses what is going on.
2012-02-19 18:54:58 -08:00
Stephen Williams 6b4251626b Parse array literals / rearrange task declaration rules. 2012-02-19 17:31:15 -08:00
Stephen Williams 8456252c0c More class syntax
Part of ongoing parser work to support SystemVerilog classes.
2012-02-19 10:29:50 -08:00
Stephen Williams 950e7a632c Parse multi-dimension packed arrays to pform. 2012-02-04 16:19:27 -08:00
Stephen Williams 764b38bb3b Use user defined types in the syntax.
Given that the syntax is already parsed and elaborated, it is a
simple matter to bind that typedef'ed type to the instances that
use it.
2012-02-02 16:18:50 -08:00
Stephen Williams 42b3e6f268 Implement simple typedefs, and parse type identifiers.
This gets me to the point where the parser stashes a defined type,
and the lexical analyzer uses the type names to differentiate
IDENTIFIER and TYPE_IDENTIFIER.
2012-02-02 16:18:50 -08:00
Stephen Williams e14628193a Parse simple typedefs
Parse typedefs with structs and enums, but give a sorry message,
because they are not yet supported. Rearrange some of the parse
rules for variables in order to increase comonality with the
typedef rules.
2012-02-02 16:18:50 -08:00
Stephen Williams e9e2fb33e9 Handle nets that are packed structures. 2012-02-02 16:18:49 -08:00
Stephen Williams d362c8dba0 Parse support for struct variables. 2012-02-02 16:18:49 -08:00
Cary R 4c6a5bbd89 Update PSpecPath to take the polarity and full_flag when constructed
To avoid a variables not initialized in the construct this patch modifies
the PSpecPath class to take the polarity and full_flag as arguments to
the constructor.
2011-11-22 19:39:26 -08:00