Commit Graph

350 Commits

Author SHA1 Message Date
Stephen Williams 27dfdf99dd Enumeration element values can be expressions
Allow more complex enumeration expressions, which means putting
off the evaluation of the expression values until elaboration.
2010-11-12 18:47:06 -08:00
Stephen Williams 2f474358d9 Support enumeration element ranges.
This also fixes:
Set verinum.has_sign() correctly for enum values.
2010-11-09 21:05:47 -08:00
Stephen Williams cced1e771b Remove some uses of the svector template.
I'm adding more uses of the make_range_from_width function, so
it seems like time to get rid of its use of the svector template.
This thread led to a lot of other uses of svector that had to
also be removed.
2010-10-25 19:36:44 -07:00
Stephen Williams eb4ed82893 Finish up parser code for enum types
This gets the parser syntax actions done, up to the pform code.
It is ready for generating pform structures.
2010-10-24 11:21:17 -07:00
Stephen Williams 9037354c6b reg can take unsigned as well as signed.
SystemVerilog adds "unsigned" so that it can be explicit
as well as implicit.
2010-10-19 19:34:17 -07:00
Stephen Williams b80dbeee11 Give module port atom2 objects their proper widths.
These widths can be expressions as ranges, but must be present
as this is how we identify them as the various types of ints.
2010-10-19 19:07:44 -07:00
Stephen Williams 162e3aac3a Handle atom2 types in modules input/output ports. 2010-10-18 19:23:02 -07:00
Stephen Williams 568ee4436f Allow variables to implicitly convert to unresolved nets.
SystemVerilog allows variables to be either variables or unresolved
nets, depending on how they are used. If they are assigned by
procedural code, then they are variables. If they are assigned
by a continuous assignment, they are unresolved nets. Note that
they cannot be both, and when they are unresolved nets they can
only be assigned once.
2010-10-10 10:06:27 -07:00
Stephen Williams af6fd66648 Tasks functions with atom2 arguments.
Parse 2-value atoms as arguments to functions and tasks.
2010-10-10 10:06:27 -07:00
Stephen Williams e03ff763fb Parse support for SystemVerilog atom2 types. 2010-10-10 10:06:26 -07:00
Stephen Williams ec49f10e2d Revert bad merge from vhdl branch 2010-10-02 11:02:27 -07:00
Cary R df4722b92c The switch gates do not support a strength specification.
This patch splits the switch types out of the gates to allow
them to be defined to not take a strength specification.
2010-07-13 19:21:02 -07:00
Cary R 07ee2e7dff On error there is no need to pop the scope.
The error routines for task and function definitions were incorrectly
popping the scope. This should not be done since no scope was pushed.
Also assert that the current_task/function is 0 to catch that kind of
error like the other definition rules.
2010-06-18 15:48:00 -07:00
Stephen Williams 79f8b8fcfd Remove Link::strength_t and PGate::strength_t types.
These types are useless repetition of the ivl_drive_t type.
This is also another chapter in the series to push ivl_target
generation further upstream.
2010-03-16 15:16:53 -07:00
Stephen Williams 47e68e21b1 Detect generate regions within generate schemes.
Generate schemes may nest freely, but generate regions
(an anachronistic concept from 1364-2001) cannot nest,
not within schemes or other regions. Have the parser detect
the nesting and print an error message.
2010-03-11 16:06:02 -08:00
Stephen Williams 70fc742c9d Add support for primitive types of ports.
The infrastructure is already there, all that's missing is the
syntax in the parser.
2010-03-11 12:22:41 -08:00
Jared Casper be67199177 Allow connecting module instance using implicit named port connections.
This is part of the 1800-2009 standard (Section 23.3.2.3) and allows
ports of module instances to be declared like:

modname instance(.foo, .bar);

instead of

modname instead(.foo(foo), .bar(bar));

The only tricky part about this is the implicit port connection shall
not create an implicit net declaration.  To make this happen, the path
of least resistance was to add a bool to PEIdent indicating that it
should not implicitely create a net.

This does not rely on the generation flag to be 2009, following the
trend that new port naming convention (like ANSI style ports) work
regardless of the generation.
2010-03-05 16:29:55 -08:00
Jared Casper 248fb32b9a Adding ability for generation to be 2009.
Added generation flag -g2009 which enables support for 1800-2009
constructs.  Added related support such as "1800-2009" in the
`begin_keywords directive.

Keeps 2005 as the default generation for now.

Removed the -gsytem-verilog flag and folded the 1800-2005 stuff into
1800-2009.  The rationale behind this is we have so little of
1800-2005 actually implemented that it does not make sense to
distinguish between 1800-2005 and 1800-2009 SystemVerilog extensions,
so we just count them all as the new 1800-2009 Verilog language.
2010-03-05 16:09:04 -08:00
Cary R 634d47bfe8 Add all the Verilog-AMS 2.3.1 keywords.
Like I did for SystemVerilog the other day this patch adds all the
Verilog-AMS 2.3.1 keywords. This necessitated adding one my byte
to the gperf -k argument (byte 9) to make the laplace_?? tokens
have a unique hash.
2010-01-23 09:40:56 -08:00
Cary R 511a274b41 Add all the SystemVerilog (1800-2005) keywords.
This patch adds the SystemVerilog keywords to Icarus. This allows
use to easily verify that out plain Verilog does not contain any
SystemVerilog keywords. The keywords are not parsed in any way.
When parsing a Verilog file using -gsystem-verilog any identifier
that is a keyword will cause a parse error. It is the users
responsibility to figure out the problem since bison does not
give nice error message when it finds a keyword instead of an
identifier.
2010-01-23 09:35:07 -08:00
Cary R a5060b8adc Add a waring that timing check delayed signals will not be driven.
The $setuphold and $recrem timing checks can create delayed signals
that are needed to get a model to work correctly when negative timing
check values are used. Since we do not support timing checks and just
ignore them this can create simulation problems when a user tries to
use these delayed signals since they are not driven.

This patch adds a waring when the circuit is being compiled that these
delayed signals will not be driven. This will be needed until we get
time to add the real timing checks are mimic the delayed properties of
the timing check.
2009-10-31 20:50:43 -07:00
Cary R 9dce6496fb Fix up original SV timeunit/timeprecision patch.
This patch modifies the original SystemVerilog timeunit/timeprecision
patch in the following way:

Removed trailing space.

Reworked some code to use standard spacing rules.

Added some comments.

Combined some code.

Major rework of local/global timeunit/timeprecision logic.

Major rework of timeunit/timeprecision declaration/check code.
This was needed to remove the shift/reduce warnings.

Add a number of checks for invalid combinations.
2009-07-28 19:18:09 -07:00
Sreeraj R c2feeb03df System Verilog timeunit and timeprecision addition
This patch adds timeunit and timeprecision keywords.Use -gsystem-verilog
generation flag to use this feature
2009-07-28 19:18:01 -07:00
Cary R 81822c2d50 Parse the config declarations and report they will be ignored.
This patch adds code to parse config declarations and reports
that they are not currently supported and will be ignored.
2009-06-19 21:45:53 -07:00
Cary R 5153bfc1f7 Ignore specify pulsestyle_* and *showcancelled directives.
This patch adds code to silently ignore the specify directives:
  pulsestyle_onevent
  pulsestyle_ondetect
  showcancelled
  noshowcancelled.
2009-06-07 16:56:30 -07:00
Cary R 4479471278 Parse all the 1364-1995 and 1364-2001 timing checks.
This patch adds code to parse and ignore the following timing checks:

$nochange  1364-1995
$skew      1364-1995
$fullskew  1364-2001
$removal   1364-2001
$timeskew  1364-2001

The other checks were already supported. These have not been tested,
but they use the same basic terms as the other checks. We can fully
test these when we actually implement them.
2009-06-07 16:39:25 -07:00
Cary R ca7e64afaf Fix some keywords, add -g2001-noconfig and fix up uwire/wone.
This patch adds -g2001-noconfig command line flag. The compiler
already supported this with `begin_keywords. Document this in
the manual page and fix a few other issues.

Fix endgenerate to be a 2001 keyword and add a few missing
keywords at the appropriate standard level e.g.(unsigned).

Add uwire and deprecate wone. wone used to just convert without
a warning to a wire. uwire will display a warning that it is
being converted to a wire without a check. wone is converted to
a uwire with a warning and then prints the uwire message. The
uwire message will be replaced with a real check fairly soon.
2009-06-07 16:31:34 -07:00
Cary R d06f6dfc51 Add support for unconnected_drive.
Icarus has recognized this directive, but it did not do anything
with the information. This patch adds the functionality for most
common cases. It adds this by changing the input net type from
wire/tri to tri1 or tri0 depending on the pull. The issue is that
if the input net is not a wire or tri this is not safe and should
really be done as an external pull gate connected to the input.
We will need to handle this is it ever comes up. For now a sorry
message is printed.
2009-06-07 16:14:52 -07:00
Cary R 636758f66d Add support for `celldefine, vpiCellInstance
This patch adds real functionality for `celldefine and pushes this
property to the run time which can access this with vpiCellInstance.
This is technically only available for a module, but all scopes
have the property and only modules should return true when the
'endmodule' is between a `celldefine and `endcelldefine directive.
2009-05-23 14:13:47 -07:00
Cary R 22416b4d01 Print a better error message for a '~' token in front of ('&' | '|' | '^')
Some users may expect this to work so this patch catches these
specific cases and tells the user to use the singe unary operators
'~&', etc. instead.
2009-05-23 14:08:22 -07: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 192522b3d8 Check for name space collisions.
This patch adds code to check for most of the name space
collisions. genvars are not checked correctly since they
are not completely implemented.
2009-04-27 17:24:36 -07:00
Cary R 46350da5f0 Add support for empty task port lists with a warning.
The standard does not allow this, but it appears that other
simulators do. This patch adds the functionality, but prints
a warning message for the invalid task definition.
2009-04-08 17:31:47 -07:00
Stephen Williams f1e702bdd5 Blind support for "integer foreign" attributes. (Stefan Theide)
Allows iverilog to parse attribute like syntax that a common
simuator puts into automatically generated verilog code. This
syntax cannot be found in any of the IEEE standards.
2009-02-23 16:37:34 -08:00
Sreeraj.R bd5c48eccd Added gsystem-verilog gen flag and 4 additional keywords
For future system-verilog additions
2009-01-10 11:05:48 -08:00
Cary R 5d7f8c9706 Update copyright in files changed in 2009
This patch updates the copyright notice in the files that
were modified in 2009. It also updates the normal programs
and the vvp target.
2009-01-08 20:03:34 -08:00
Cary R f2f7933708 Make lexical token STRING new based.
The STRING lexical token was malloc based, but then was passed
to routines that are expecting a new based result. This patch
standardizes on a new/delete based approach.
2009-01-08 19:40:50 -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 bd754b24f4 Support direct nesting of conditional generate schemes.
Verilog generate schemes support a special case where conditional
generate schemes that contain only a nested conditional generate
scheme do not create a new scope. Instead, it relies on the nested
generate scheme to generate the scope.
2008-11-27 19:45:22 -08:00
Cary R 407ce5e152 Add support for the 1364-2001 generate of a named block.
This is obsolete in 1364-2005, but is supported 1364-2001.
Icarus already supported generate with unnamed block.
2008-11-15 08:08:29 -08:00
Stephen Williams ddb2c60701 Remove svector class from Module.h
The goal is to completely remove the svector class because the standard
vector class works perfectly well. This removes the uses in the Module.h
header file.
2008-11-02 20:08:38 -08:00
Stephen Williams f4687757f1 Bring signal discipline all the way to the ivl_target API.
Signals may have VMA disciplines attached. Make the attached discipline
visible through the ivl_target.h API. Also, re-arrange the internal
handling of the discipline structure so that we can expose disciplines
through the ivl_target C API without creating new structures. The
t-dll-api implementations of the discipline access functions can look
at the elaborated discipline structure directly. This is possible since
the discipline parse and elaboration are very simple.
2008-11-02 08:10:41 -08:00
Stephen Williams b20019d8b6 Merge branch 'master' into verilog-ams 2008-11-01 21:09:29 -07:00
Stephen Williams 6cac1d2cab Add support for real/realtime arrays.
Support arrays of realtime variable arrays and net arrays. This
involved a simple fix to the ivl core parser, proper support in
the code generator, and rework the runtime support in vvp.
2008-11-01 20:44:03 -07:00
Stephen Williams ea057a7574 Elaborate logical and/or to account for special properties.
The arguments of logical and/or are self determined, and the width is
fixed as 1 bit. Account for this special behavior by creating the
PEBLogic class.
2008-10-29 20:31:26 -07:00
Stephen Williams 038b024e71 Merge branch 'master' into verilog-ams 2008-10-26 21:59:53 -07:00
Cary R 26e1693b2f generate case items can have an optional statement.
generate case supports optional statements by putting
 a ';' in place of the statement. This patch adds
this functionality for all generate case items.
2008-10-25 23:27:00 -07:00
Stephen Williams 68fbb94b3a Basic elaboration of analog contribution statements.
Get at least basic elaboration of analog processes and contribution
statements. Bring the statements and analog statements together and
net future elaboration work sort out which statements are valid in
a given context. This makes sense because there really is a lot of
syntactic overlap, and analog behavioral code is processed somewhat
sequentially.
2008-10-22 21:56:00 -07:00
Stephen Williams 5aa810dde7 Infrastructure for elaborating analog statements.
Put together the infrastructure for elaborating analog statements,
including create the NetAnalogTop objects that hold analog statements
and are in turn held by the design.

While doing this, clean up the various unique initial/always enumerations
to use the ivl_process_type_t type.
2008-10-21 22:15:49 -07:00
Martin Whitaker 082e06edb0 Remove checks for constant expressions from the parser.
This patch removes all the checks for constant expressions performed
during the parsing phase, as these checks are (mostly) repeated during
elaboration. It adds the missing check in the elaboration phase (the
RHS of a register initialisation), and improves the error reporting
and error recovery in other checks.

This patch fixes pr2132552, which was caused by a fault in the parser
constant expression checking.
2008-10-09 11:11:32 -07:00