Commit Graph

117 Commits

Author SHA1 Message Date
Cary R d697312cf8 Cleanup ivt casting for cppcheck 2025-10-25 10:54:12 -07:00
Cary R ef931e2e0d Spelling and space cleanup 2023-05-31 22:44:13 -07:00
Stephen Williams 6c9c876c83 Add compiler support for break and continue
This includes support at the parser (pform) through enaboration
and the netlist format for the break and continue statements.

Elaboration actually already worked for for-loops, but since the code
generators need more information, this is a rewire of that support to
be explicit about for-loops. This means they are not rewritten as fancy
while loops. The code generators will have to handle that.

Given the elaboration of for-loops now work, write the vvp code generator
support needed to implement it.

Now that for-loops are presented as for-loops to the code generator, the
vlog95 code generator doesn't need to infer them anymore. Generate the code
more directly.

Also update the tests list so that the vlog95_reg tests all pass.
2023-01-15 21:46:20 -08:00
Lars-Peter Clausen c0adbd0deb Add support for handling `super` keyword
SystemVerilog allows to use the `super` keyword to access properties and
methods of a base class. This is useful if there is for example an
identifier with the same name in the current class as in the base class and
the code wants to access the base class identifier.

To support this a bit of refactoring is required. Currently properties are
internally referenced by name, this does not work if there are multiple
properties of the same. Instead reference properties always by index.

In addition when looking up an identifier that resolves to an object return
both the type and the object itself. This is necessary since both `this`
and `super` resolve to the same object, but each with a different type.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-12-25 09:19:21 -08:00
Martin Whitaker 313f376394 Fix behaviour of fork/join_none with only one statement (issue #672).
The compiler normally optimises away the enclosing block statement
if a block only contains one statement. But this is not valid for
a fork/join_none block.
2022-04-12 16:54:33 +01:00
Lars-Peter Clausen 84c3c72563 Support recursive functions using `return` statement
A `return` statement in a function gets translated into a vvp `%disable`
instruction. This works fine as long as no recursion is involved. The
`%disable` instruction will stop execution of all active threads of a
particular scope. For recursive functions this means as soon as the inner
most function returns all containing outer function calls get disabled as
well. This results in incorrect behavior.

To make recursive functions using the `return` statement work use the new
vvp `%disable/parent` instruction. This instruction will only disable the
closest thread in the thread hierarchy that matches the target scope.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-04-11 22:03:02 +02:00
Cary R 60a77b08d2 Add compiler and the start of vvp support for ->> 2021-02-19 23:21:51 -08:00
Cary R 32787bb973 Add support for SV edge 2021-01-07 01:22:49 -08:00
Stephen Williams e5f68d7c89 Handle dynamic queue objects in event context
In the rare cases where DARRAY signals are in the network, handle
them by creating the proper ivl_nexus_t node. This also implements
the receive of vvp_object_t objects bu vvp_fun_anyedge_sa. This
together makes it possible for IVL_VT_DQUEUE objects to be in
wait lists.

This fixes #412
2020-12-13 18:22:34 -08:00
Stephen Williams befc91340c Parse and elaborate unique and priority case statements
The unique, unique0, and priority keywords can decorate case statements
to tell the run time (or synthesis) to do extra tests (or make extra
assumptions). These tests are not implemented in the vvp run time, but
now the decorations make it to the code generators.
2019-10-05 16:23:04 -07:00
Cary R 84d0df8a8a Pass to the targets if an implicit T0 trigger event is needed. 2017-12-03 20:17:42 -08:00
Stephen Williams 712f394224 Elaborate classes in packages. 2014-10-10 18:53:53 -07:00
Stephen Williams 480668fee6 Add support for classes defined in $root scope. 2014-09-15 17:37:30 -07:00
Stephen Williams fa8d35ae9c Support nested l-value objects
This allows for syntax like a.b.c where a is a class with member
b, which is a class with member c, and so on. The handling is mostly
for the support of compound objects like classes.
2013-11-22 19:54:42 -08:00
Stephen Williams 37ac1ed474 Clean up dead code in ivl_lval_t handling. 2013-11-22 12:02:03 -08:00
Stephen Williams 68d83383ff Elaborate nested l-values.
This gets nested l-values to (but just short of) the ivl_target API.
Now the elaborator can process nested l-values, but I haven't figured
out how to present that at the ivl_target.h API.
2013-11-16 16:27:05 -08:00
Cary R 97d06b107f Add support for wait fork to the compiler and code generators 2013-10-22 09:41:03 -07:00
Cary R c64b8900ca Add support for disable fork to the compiler. 2013-10-17 19:34:57 -07:00
Stephen Williams 7bc94d7810 Support functions that return void. 2013-09-20 20:44:57 -07:00
Cary R d8f945be23 Add support for SV do/while 2013-09-16 20:02:09 -07:00
Stephen Williams 860419a346 Draft run-time support for SystemVerilog class objects.
This provides the ivl_target.h interface for class definitions
and expressions, the vvp code generator support for class objects
and properties, and the vvp run time support. Trivial class objects
now seem to work.
2012-12-10 19:20:02 -08:00
Stephen Williams 318a4033b8 Flesh out class type elaboration
Add properties to the classes, and elaborate expressions that
have class properties. Describe class object property references
all the way down to the stub target.
2012-12-10 19:20:02 -08:00
Arun Persaud f5aafc32f9 updated FSF-address 2012-08-29 10:12:10 -07:00
Stephen Williams 6a57764e0e Elaborate fork-join_none and fork-join_any statements. 2012-05-27 18:26:53 -07:00
Stephen Williams 3dabb2970d Get compressed assignment opcodes through to the ivl_target API. 2011-11-27 16:46:02 -08:00
Cary R 1e3af45335 Pass some module port information and fix a few bugs.
This patch adds some preliminary module port information to the ivl
interface. This may change as I investigate exactly what is needed.
It also fixes a few minor bugs (a missed local variable and spacing)
2011-03-08 19:15:28 -08:00
Cary R a6220fe562 Add support for passing variable indexed part select type information
This patch modifies the compiler and the ivl interface to pass the
type of indexed part select that is being represented (up/down) in
a procedural L-value or R-value. This is needed by any back end that
wants to correctly denormalize the (zero based) base expression.
2011-02-28 19:15:48 -08:00
Cary R 427aef8cc4 Add more file/line and scope information to the ivl interface, etc.
This patch adds/fixes the following:

  Adds file/line information to a UDP definition.

  Prints an error message if a UDP is passed signals wider than 1 bit.
  A UDP should supports a range, but the compiler currently does not.

  Add scope information for constants.

  Fix the Icarus extension UDP table entry element 'h' to use h.

  The ivl_udp_init() value is a char not unsigned.

  Add FILE_NAME() for a bunch more of the ivl interface objects.
2011-02-10 19:04:08 -08:00
Cary R d5352ca47a Add missing support for task ports in ivl interface
It was documented that ivl_scope_port(s)() could be used with tasks,
but the code did not support this. This patch adds that functionality
as documented. It also removes the documentation for ivl_lval_mem()
since that function no longer exists.
2011-01-12 16:40:05 -08:00
Cary R a4a7b0a09d Make ivl_alloc.h the last include so it doesn't effect any system includes.
In ivl_alloc.h we redefine malloc(), realloc() and calloc() to have
standard error checking. We don't want to do this for anything that
comes from the standard headers. This specifically doesn't work if
a C++ header files does std::malloc, etc.

Also change to -W instead of -Wextra since that is more portable. I
plan to add a check from -Wextra and use it when available since it
is more descriptive.
2010-11-02 10:51:57 -07:00
Cary R cb86fb15bf Add error checking definitions for malloc(), realloc() and calloc()
This patch adds defines that translate all malloc(), realloc() and calloc()
calls into ones with error checking when ivl_alloc.h is included.
2010-10-14 17:39:23 -07:00
Cary R 03f6283203 Add support for calling system functions as a task (SystemVerilog)
This patch adds the ability to call a system function as a task for
the SystemVerilog generation (-g2009). The return value is really
calculated, but it is ignored.
2010-08-13 20:05:23 -07:00
Cary R 1993bf6f69 Remove malloc.h support and for C++ files use <c...> include files.
The functions (malloc, free, etc.) that used to be provided in
malloc.h are now provided in cstdlib for C++ files and stdlib.h for
C files. Since we require a C99 compliant compiler it makes sense
that malloc.h is no longer needed.

This patch also modifies all the C++ files to use the <c...>
version of the standard C header files (e.g. <cstdlib> vs
<stdlib.h>). Some of the files used the C++ version and others did
not. There are still a few other header changes that could be done,
but this takes care of much of it.
2010-06-01 08:56:30 -07:00
Cary R 5ae86bd6b4 Add support for 64 bit delays in procedural non-blocking assignments.
This patch adds support for 64 bit non-blocking delays in procedural
code. We fixed the procedural delay operator (blocking delays) earlier.
This patch mostly mimics what was done there. The continuous assignment
delay operator still needs to be fixed.
2009-02-17 10:32:11 -08:00
Stephen Williams 13aaaab783 Bring analog contribution statements to the ivl_target API.
Add support for analog processes with analog contributation statements
all the way down to the ivl_target code generator API.
2008-11-06 21:31:34 -08: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
Larry Doolittle 904e76f176 Shadow reduction part 3
Continue cleaning up shadowed variables, flagged by turning on -Wshadow.
No intended change in functionality.  Patch looks right, and is tested
to compile and run on my machine.  No regressions in test suite.
2008-10-20 21:43:02 -07:00
Martin Whitaker 7ebcc6b357 Support for automatic tasks and functions.
This patch adds support for automatic tasks and functions.
Refer to the overview in vvp/README.txt for details.
2008-09-27 15:51:16 -07:00
Cary R 1e60754ff0 Partial non-blocking event control implementation
This patch pushes the non-blocking event control information to
the code generator. It adds the %evctl statements that are used
to put the event control information into the special thread
event control registers. The signed version (%evctl/s) required
the implementation of %ix/getv/s to load a signed value into
an index register. It then adds %assign/wr/e event control based
non-blocking assignment for real values. It also fixes the other
non-blocking real assignments to use Transport instead of inertial
delays.
2008-09-12 20:00:28 -07:00
Stephen Williams c14987aa18 Merge branch 'master' into verilog-ams 2008-08-01 21:15:11 -07:00
Cary R 61930c3b6e Add file and line information to processes.
This patch adds file and line information to processes
(initial and always).
2008-08-01 20:13:29 -07:00
Stephen Williams 9f04641fc7 Detect and elaborate AMS access functions.
Detect function call expressions that turn out to be calls to the
access function of a nature. Elaborate the access function and stub
the emit code. This gets the access function just short of the code
generator.
2008-07-30 18:01:41 -07:00
Larry Doolittle 8ea3b6b0b8 header includes for gcc-4.3 compatibility
minimal changes required to build without error
tested with gcc-4.3 (Debian 4.3-20071130-1) 4.3.0 20071130 (experimental)
2008-01-04 16:14:44 -08:00
Stephen Williams 08752453b4 File line information for expressions
Add ivl_target support for file and line numbers of expressions.
2007-12-22 17:19:45 -05:00
Stephen Williams 1db19b8703 Make statement file lineno available to targets.
Make the Verilog file/lineno of statements available to loadable
code generators. Make sure the information is properly set for
system task calls.
2007-12-22 09:31:24 -05:00
Stephen Williams 5bb936a226 Fix addressing of variable words.
Variable word addresses are not to be adjusted by the bit select
of the vector direction. That is a holdover from when arrays were
stored as bit vectors.

Signed-off-by: Stephen Williams <steve@icarus.com>
2007-09-28 18:22:17 -07:00
steve c7d97f4146 Properly evaluate scope path expressions. 2007-06-02 03:42:12 +00:00
steve c5524b4acf t-dll should not canonicalize word addresses, elaboration already does it. 2007-04-04 01:50:38 +00:00
steve 91d84e7dc7 Major rework of array handling. Memories are replaced with the
more general concept of arrays. The NetMemory and NetEMemory
 classes are removed from the ivl core program, and the IVL_LPM_RAM
 lpm type is removed from the ivl_target API.
2007-01-16 05:44:14 +00:00
steve d434dd7296 Allow part selects of memory words in l-values. 2006-02-02 02:43:57 +00:00