Commit Graph

209 Commits

Author SHA1 Message Date
Lars-Peter Clausen 42212cfb58 Add `regress-v13.list`
With the development version bumped to v13 the regression tests runner
expects a `regress-v13.list`. Provide one, which is just a copy of the
`regress-v12.list` for now.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-12-26 15:07:34 -08:00
Lars-Peter Clausen 295b65da2c Add regression tests for using `super` to access the base class
Check that it is possible to use the `super` keyword to access properties
and methods of the base class that exist with the same name in current
class.

Also check that `this.super` is supported as an alternative to `super` and
has the same behavior.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-12-25 09:19:21 -08:00
Stephen Williams cc2ba4f8cb
Merge pull request #825 from larsclausen/typed-constructor
Add support for typed constructor calls
2022-12-24 17:36:01 -08:00
Stephen Williams 7b1fad78c3
Merge pull request #824 from larsclausen/class-lifetime
Fix variable initialization in class methods
2022-12-24 17:33:29 -08:00
Stephen Williams 507d8cc8ab
Merge pull request #826 from steveicarus/parser-cleanup
Parser cleanup
2022-12-24 17:31:17 -08:00
Martin Whitaker 6b04d9795a Use consistent capitalisation for compiler parser warning messages. 2022-12-22 10:47:45 +00:00
Martin Whitaker a56ccabf7f Use consistent format for compiler parser error messages.
Always prefix with "error: " or "sorry: ". Capitalise the first word
of the main message unless it's a Verilog keyword.
2022-12-22 10:13:26 +00:00
Lars-Peter Clausen 6334839406 Add regression tests for typed constructor calls
Check that typed constructors calls are supported. Also check various
invalid usages of typed constructor calls and check that an error is
reported.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-12-21 20:08:58 -08:00
Lars-Peter Clausen 748d6d8de2 Add regression tests for class methods with static lifetime
Check that trying to specify a class method with static lifetime results in
an error.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-12-21 19:28:46 -08:00
Lars-Peter Clausen da4ac3607a Add regression test for var init in class method
Check that variable initialization as part of the declaration works as
expected in class methods.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-12-21 19:28:46 -08:00
Stephen Williams 580d79eae3
Merge pull request #820 from larsclausen/array-compatibility
Add error checking for continuous unpacked array assignments
2022-12-21 11:38:15 -08:00
Martin Whitaker cd0b360575 Support free-form `default_net_type directives. 2022-12-20 18:14:18 +00:00
Martin Whitaker 79a3d08d69 Support free-form `begin_keywords and `end_keywords directives. 2022-12-20 18:14:18 +00:00
Martin Whitaker 52f269649a Support free-form `(end)cell_define and `reset_all directives.
Also use VLerror for reporting errors.
2022-12-20 18:14:18 +00:00
Martin Whitaker 0dc64b99f3 Support free-form `(no)unconnected_drive directives.
Also use VLerror for reporting errors.
2022-12-20 18:14:18 +00:00
Martin Whitaker 59d70cad45 Support free-form `timescale directives with interspersed comments (issue #782)
Verilog compiler directives are free-form and, subject to semantic rules,
can appear anywhere in the source code. Whilst it is common practice to
write them on a separate line, we should handle all legal syntax.
2022-12-20 18:14:17 +00:00
Stephen Williams 46e1a21d7b
Merge pull request #819 from larsclausen/class-compatiblity
Allow objects to be assigned to a variable of a base class
2022-12-18 09:03:44 -08:00
Stephen Williams 9d2244abb4
Merge pull request #818 from larsclausen/void-cast
Add support for void cast function call
2022-12-18 09:00:41 -08:00
Martin Whitaker c8a85877c2 Allow io-range-error warnings to be disabled (issue #788)
It was common practice in the past to just declare a port direction
and declare it as a vector in a subsequent type declaration. Versions
of the standard up to and including 1364-2005 include an example that
does this (e.g. 1364-2005 section 12.3.7). Users may have old or
third-party code that they can't or don't want to modify, so allow
the warning to be suppressed by including it in the anachronisms
category.
2022-12-18 12:12:26 +00:00
Lars-Peter Clausen 4ef5b02bcd Add regression tests for continuous array assign compatibility
Check various different scenarios for array compatibility in continuous
array assign. Both testing cases that should work and cases that should
fail.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-12-17 15:47:18 -08:00
Lars-Peter Clausen 4cfba91d65 Add regression tests for class compatibility
Check that it is possible to assign an object to another object that is of
a type of any of its base classes. Also check that an error is reported if
this is not the case.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-12-17 14:27:38 -08:00
Lars-Peter Clausen 269e1ca88d Add regression tests for void casts
Check that it is possible to use a function with a return type as a
statement by using a void cast.

Also check that trying to void cast a void function, a task or an
expression results in an error.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-12-17 11:38:07 -08:00
Stephen Williams 2d6243ea6c
Merge pull request #816 from larsclausen/task-in-expr-fail
Report errors for task and void function calls in expressions
2022-12-17 11:12:39 -08:00
Stephen Williams dd7bea1d5e
Merge pull request #815 from larsclausen/class-virtual-new
Do not allow to create objects of virtual classes
2022-12-17 11:11:30 -08:00
Lars-Peter Clausen a8dbb38af2 Add regression test for array query functions on C style array
Check that array query functions return the correct value for C style
arrays.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-12-17 09:50:43 -08:00
Lars-Peter Clausen fa4c67ccf7 Add regression tests for tasks and void function calls in expression
Check that an error is reported when either calling a task or a void
function as part of an expression.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-12-15 21:07:39 -08:00
Lars-Peter Clausen 569ba887b3 Add regression test for creating instances of virtual classes
Check that an error is reported when trying to create an object of a
virtual class.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-12-13 21:32:45 -08:00
Lars-Peter Clausen c4397e66f9 Add regression tests for automatic terms in cast expressions
Check that a sign, width or type cast expression that contains an automatic
term is detected as such and can not be used as the left-hand side in a
procedural continuous assignment.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-12-11 20:08:33 -08:00
Stephen Williams 2bb1489f92
Merge pull request #808 from steveicarus/steveicarus/for-loop-step-opt
Allow for for_step of for loops to be optional
2022-12-11 17:07:31 -08:00
Stephen Williams 15b4a8a046
Merge pull request #806 from larsclausen/class-sig-elab
Elaborate class properties during signal phase instead of scope phase
2022-12-11 16:46:54 -08:00
Stephen Williams 4ead552203
Merge pull request #805 from larsclausen/sv-type-params
Support type parameters
2022-12-11 16:45:39 -08:00
Stephen Williams 0acb938f79 Regression test that optional for_step works
Add the br_gh801b.v regression test.
2022-12-11 16:40:30 -08:00
Stephen Williams bb779112c7
Merge pull request #807 from steveicarus/steveicarus/issue801-empty-for-init
Handle empty for-loop init statement
2022-12-11 16:07:24 -08:00
Stephen Williams afe2cd63ef Regression test for github issue 801 2022-12-11 15:46:23 -08:00
Lars-Peter Clausen fbfb6016c1 Add regression test for using packed scoped type identifier in class
Check that it is possible to use a packed scope type identifier for the
type of a class property when the class is defined in the unit scope. This
makes sure that the elaboration is done in an order so that the type is
available when the class property is elaborated.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-12-11 14:10:40 -08:00
Lars-Peter Clausen 68d89bbe05 Add regression test for referencing forward declared classes
Check that it is possible to use a forward declared class type as the type
of a property in another class.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-12-11 14:10:40 -08:00
Lars-Peter Clausen 0e86e99358 Add regression tests for omitted foreach dimensions
Check that it is possible to omit one or more dimensions in a foreach loop.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-12-11 14:06:30 -08:00
Lars-Peter Clausen f8401095aa Add regression test for too many foreach loop indices
Check that an error is reported if too many indices are specified
in a foreach loop.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-12-11 13:56:48 -08:00
Lars-Peter Clausen aec1ee5a42 Add regression tests for type parameters
Check that all sorts of variations of type parameters are supported.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-12-11 13:50:27 -08:00
Lars-Peter Clausen 10e35d1573 Add regression tests for circular type definitions
Check that circular type definitions are detected and an error is
reported.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-12-11 10:38:08 -08:00
Lars-Peter Clausen 3787eca248 Add regression tests for forward typedefs
Check that all sorts of forward typedefs are supported.
Also check that any recursive use of a type results in an error.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-12-11 10:37:46 -08:00
Lars-Peter Clausen 9553a872da Add regression test for compressed assignment statement in genvar loops
Check that compressed assignment statements are supported for genvar loops.
This is supported in SystemVerilog, but not in Verilog.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-12-04 14:37:21 -08:00
Stephen Williams 3438078c90
Merge pull request #795 from larsclausen/gh793-add-driver
Insert drivers for undriven nets
2022-12-02 18:03:32 -08:00
Lars-Peter Clausen 9e37f4382e Add regression test for issue #793
Check that $signed/$unsigned works when being combinatorially assigned with a
delay and the target of the function is a net without any drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-11-29 20:28:03 -08:00
Dag Lem 1e3994e1fa Support for range indexing of arrays with swapped ranges within structs
This patch corrects range indexing of members in structs such as:

struct packed {
   bit [0:7] [7:0] a;
   bit [0:15] b;
} bar;
2022-11-15 18:11:18 +01:00
Sean Anderson b18d90a2d9 ivlpp: Fix segfault in macro_start_args
macro_start_args truncates def_buf, but does not check to ensure that
someone has allocated def_buf first. This will cause a null pointer
dereference if the first access to def_buf while parsing a file is a
macro invocation. Fix this by avoiding truncating def_buf if it is NULL,
as it is effectively already truncated.

Fixes: 680196953 ("Add support for text macros with arguments.")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
2022-10-30 18:02:40 -04:00
Stephen Williams c2dbf4e483
Merge pull request #785 from larsclausen/type-ref
Improve handling of type identifier references
2022-10-16 20:52:52 -07:00
Stephen Williams 0c8c642022
Merge pull request #784 from larsclausen/class-call-void
Handle calling void function from class method
2022-10-16 20:52:13 -07:00
Martin Whitaker 01a11cce56 Handle C-style comments following a `include directive (issue #782) 2022-10-16 22:03:37 +01:00
Lars-Peter Clausen b9bc06951a Add regression tests for scoped type identifier references
Check that it is possible to have scoped reference to a type identifier in
a package.

 * As part of variable declarations
 * As an argument to a system function
 * As the type in a type cast

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-10-15 12:32:32 +02:00