Commit Graph

209 Commits

Author SHA1 Message Date
Lars-Peter Clausen 998d0c655d Add regression test for chained type definitions
Check that chained type definitions declared in different scopes are
handled correctly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-10-15 12:32:32 +02:00
Lars-Peter Clausen 54afdc1e6b Add regression test for module port with vector typedef
Check that for a module port with a vector type identifier the type is
elaborated in the scope where it is declared rather than the scope of the
module port.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-10-15 12:32:32 +02:00
Lars-Peter Clausen 9107e298a3 Add regression test for calling void functions from class method
Check that it is possible to call a void function from a class method.
Check this for both functions defined in the global scope as well as
functions that are methods of the class or a base class.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-10-15 00:15:36 +02:00
Stephen Williams 10a39e59a1
Merge pull request #781 from larsclausen/darray-type-compat
Improve type compatibility checking for dynamic arrays and queues
2022-10-14 08:15:50 -07:00
Stephen Williams b0c262de80
Merge pull request #780 from larsclausen/nb-auto-struct-fail
Prevent non-blocking writes to fields of automatic structs
2022-10-14 08:13:53 -07:00
Stephen Williams 8bbddfb69f
Merge pull request #779 from larsclausen/method-call-default
Handle default argument values for class function method calls
2022-10-14 08:11:45 -07:00
Lars-Peter Clausen 7896349380 Add regression tests for dynamic array/queue type compatibility
Check for various dynamic array and queue types that their type
compatibility is handled correctly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-10-08 14:01:41 +02:00
Lars-Peter Clausen 070fc2aedc Add regression tests for invalid non-blocking writes to SV constructs
Current regression tests only cover checking for invalid non-blocking
writes to constructs that are valid in Verilog. Add two tests to
additionally cover some SystemVerilog constructs.

 * Non-blocking writes to members of a struct typed variable with automatic
   lifetime
 * Non-blocking writes to class typed variables with automatic lifetime

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-10-06 10:51:49 +02:00
Lars-Peter Clausen 0aef9326ca Add regression test for class method argument defaults
Check that default values for class methods are handled correctly and it is
possible to omit any argument. Check it for both functions and tasks.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-10-05 08:49:25 +02:00
Lars-Peter Clausen 159345ca96 Add regression tests for package scope identifiers
Check that it is possible to reference a package scoped identifier that has
the same name as a local identifier, but is a different kind of identifier.

 * A variable or function identifier from a package scope if it is a
   type identifier in the current scope
 * A type identifier from a package scope if it is a non-type identifier
   in the current scope

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-10-04 11:13:37 +02:00
Stephen Williams 4f1dbee4ee
Merge pull request #775 from larsclausen/ps-function-call
Allow package scoped functions to be called without arguments
2022-10-03 19:43:26 -07:00
Stephen Williams b83fc0ac59
Merge pull request #774 from larsclausen/darray-copy-empty
vvp: Handle copying of empty dynamic array and queue
2022-10-03 19:42:13 -07:00
Stephen Williams 463f18a03f
Merge pull request #773 from larsclausen/function-return-class
Support class objects as function return values
2022-10-03 19:40:42 -07:00
Lars-Peter Clausen 4c0b06329f Add regression test for nested unpacked arrays
Check that it is possible to declare an unpacked array type with an
unpacked array type as the base type.

Also check that it is possible to declare an signal with an unpacked array
dimension with an unpacked array base type.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-10-01 13:51:55 +02:00
Lars-Peter Clausen bcc0730b6b Add regression test for module port with array typedef
Check that for a module port with an array type identifier the type is
elaborated in the right scope.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-10-01 13:51:51 +02:00
Lars-Peter Clausen 6fe3e52085 Add regression tests for package scoped function calls
Check that package scope function calls work with and without arguments as
well as empty positional arguments.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-09-20 20:44:27 +02:00
Lars-Peter Clausen 72e59fc626 Add regression tests for copying empty dynamic array and queue
Check that it is possible to copy empty dynamic arrays and queues.

If the target is a dynamic arrays there are two ways of copying. Through
direct assignment as well as the array new operator.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-09-19 18:47:22 +02:00
Lars-Peter Clausen d4c662c6a1 Add regression tests for returning class objects from functions
Check that returning class objects from functions is supported.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-09-19 18:20:16 +02:00
Lars-Peter Clausen cff24f77b4 Add regression tests for packed struct/union with unpacked array members
Check that a packed struct or union with an unpacked array, dynamic array
or queue as a member is detected as an error.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-09-15 12:53:29 +02:00
Lars-Peter Clausen c8daebef48 Add regression tests for invalid task port declarations
Check that all kinds of invalid repeated task port declarations are
detected as errors. They should not crash the application nor should they
result in successful elaboration.

The tests are created for corner cases that previously resulted in
incorrect behavior.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-09-14 18:59:16 +02:00
Lars-Peter Clausen 2acf7aded5 Add regression tests for invalid module port declarations
Check that all kinds of invalid module port declarations, where the
declaration conflicts with previous declarations, are detected as errors.
They should not crash the application nor should they result in successful
elaboration.

The tests are created for corner cases that previously resulted in
incorrect behavior.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-09-14 18:59:16 +02:00
Lars-Peter Clausen b0d328d594 Add regression tests for non-ANSI task port range mismatch
Check that when port direction and data type are declared separately that
an error is reported if the port direction has an explicit range
specification, but the data type has not. This should even be the case if
the data type has an implicit range, e.g `int` or a struct type.

For vector types also check that it is an error if the ranges are not
identical.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-09-14 18:59:15 +02:00
Lars-Peter Clausen 521a7bea61 Add regression tests for non-ANSI module port range mismatch
Check that when port direction and data type are declared separately that
an error is reported if the port direction has an explicit range
specification, but the data type has not. This should even be the case if
the data type has an implicit range, e.g `int` or a struct type.

For vector types also check that it is an error if the ranges are not
identical.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-09-14 18:58:56 +02:00
Lars-Peter Clausen 6204b78610 Prevent invalid port redeclaration
(System)Verilog allows to declare the port direction separate from the
signal declaration. E.g.

```
output x;
integer x;
```

But this is only allowed if the port declaration
 * does not have an explicit net type
 * does not have an explicit data type
 * is a non-ANSI style declaration

For all other cases of port declarations the signal is considered fully
defined and it is not allowed to have a separate signal declaration.

In addition the declared packed dimensions need to match between the port
and signal declaration.

In the current implementation there are a few cases where this is not
handled correctly.

1) It is possible to declare non-ANSI task ports with the same name over
and over again, if it was declared as a signal before the port.

```
task t;
  string x;
  input logic x;
  output real x;
endtask
```

2) It is possible to re-declare non-ANSI input ports of a module that have
a data type, but no explicit net type.

```
module M;
  input integer x;
  wire integer x;
endmodule
```

3) It is possible to re-declare a ANSI port if it has an implicit data type.

```
module M(output [1:0] x);
  reg [1:0] x;
endmodule
```

4) It is possible to declare a vector signal for a scalar non-ANSI task
port.

```
task t;
input x;
reg [7:0] x;
```

To handle all of these correctly refactor signal declaration and lookup a
bit.

The PWire class that represents a signal already has two flags `port_set_`
and `net_set_`. These flags indicate whether a signal has already been used
in a port or signal declaration. A port declaration that includes an
explicit data type is considered both a port and signal declaration.

Use these flags to decide whether it is possible to extend an existing
declaration. E.g. when creating a port without an explicit data type and a
PWire by that name already exists and the `port_set_` flag is not set
extend the existing PWire. On the other hand if the `port_set_` flag is
already set report an error.

Similar for signals but with the `net_set_` flag.

For port declarations with an explicit data type or ANSI style port
declarations it is always an error if a PWire by that name already exists.

This is for both module and task/function ports.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-09-14 18:55:19 +02:00
Lars-Peter Clausen 7fbfd82d51 Set no-io-range-error flag for tests where required
There are some tests that use non-ANSI style task port declarations where
the port direction has no packed range specification, but the corresponding
signal declaration has as range specification.

This is not valid, the standard requires the range specification for both
to match.

These tests are currently passing because this error is not detected if the
port direction declaration is scalar.

In preparation for eventually detecting this error set the
`no-io-range-error` flag for these tests. When this flag is set the error
is downgraded to a warning.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-09-14 18:55:19 +02:00
Lars-Peter Clausen 20f4f31c1a ivtest: Remove non-standard compliant test br_ml20150606
The br_ml20150606 regression test uses ANSI style port declarations, but
also re-declares the ports inside module as signals.

This is not valid (System)Verilog, even though the data type in the port
declaration is an implicit type. An ANSI-style port is always fully
defined. This defined section 23.2.2.2 ("ANSI style list of port
declarations") of the SystemVerilog LRM (1800-2017) and section 12.3.4
("List of ports declarations") of the Verilog LRM (1364-2005).

The test was originally added in response to a similarly non-compliant test
in the Yosys test suite, but that test has subsequently been updated to
conform to the standard[2].

Remove the non-compliant test in preparation for adding strict standard
compliance checking on ANSI port redeclarations.

[1] https://sourceforge.net/p/iverilog/mailman/message/34182256/
[2] https://github.com/YosysHQ/yosys/issues/1570

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-09-14 18:54:14 +02:00
Stephen Williams fa0217af87
Merge pull request #764 from larsclausen/module-port-list-default
Support default port values in port declarations lists
2022-09-14 09:25:33 -07:00
Lars-Peter Clausen 6e4a1ac15e Add regression tests for module port list default values
Check that default values are support for module port lists.
 * For output ports it is supported in both Verilog and SystemVerilog.
 * For input ports it is only supported in SystemVerilog.
 * For inout ports it is never supported

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-09-13 14:14:41 +02:00
Lars-Peter Clausen 8315b82f40 Add regression tests for SystemVerilog sign cast
Check that SystemVerilog sign cast are supported correctly. The regression
tests are modeled after the existing tests for $unsigned/$signed.

They check that
 * Width extension is done correctly on the cast expression
 * Expressions in the sign cast are evaluated as self-determined

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-09-11 19:06:22 +02:00
Lars-Peter Clausen 9ffe627b32 Add regression tests for `var` keyword
Check that the var keyword is supported in the following contexts
 * Module ports (both ANSI and non-ANSI)
 * Module variable declarations
 * Package variable declarations
 * Task and function ports
 * block variable declarations
 * for loop variable declarations

Also check that it is an error to use the var keyword in a for loop without
an explicit data type, as that is not allowed by the standard.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-09-11 18:34:58 +02:00
Martin Whitaker 899d459233 Add regression test for issue #756. 2022-08-27 16:19:04 +01:00
Martin Whitaker c7cdc6c230 Add regression test for issue #732. 2022-08-24 15:38:40 +01:00
Lars-Peter Clausen dbd92bd3cd Add regression tests for partial writes to vectors
Add regression tests for the following types partial writes for both
2-state and 4-state vectors.

 * Non-blocking
 * Blocking
 * Blocking event control

Check that all in-bounds partial writes, partial out-of-bounds and
full out-of-bounds all works as expected.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-06-12 16:14:30 +02:00
Lars-Peter Clausen 2bc1385a59 Add regression test for multiple events in non-blocking event control
Check that multiple events can be used in a non-blocking event control
assignment. The assignment should happen if either of the events trigger.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-06-06 17:01:23 +02:00
Lars-Peter Clausen ebd574474c Add regression test for non-blocking event control to concatenation
Check that a non-blocking event control assignment works as expected to a
lvalue concatenation. All values that are part of the concatenation should
only be assigned after the event triggers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-06-05 11:40:55 +02:00
Lars-Peter Clausen 34876c8854 Add additional regression test for non-blocking event control on array partsel
Check that non-blocking event control assignments works on an array part
select if the part select index is not an immediate value.

This is a copy of the nb_ec_array_pv test, but using variable indices
instead of immediate values.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-06-04 22:27:00 +02:00
Stephen Williams bf4bee319d
Merge pull request #722 from larsclausen/real-array-assignment-op
tgt-vvp: Handle assignment operator on real array entries
2022-06-01 23:13:05 -07:00
Lars-Peter Clausen 5ae7425fdb Add regression tests for assignment operator on real array entries
Check that assignment operators on real array entries are supported.

Also check that
  * out-of-bounds indices work as expected
  * it works after a comparison that set vvp flag 4 to 0

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-05-26 22:02:24 +02:00
Lars-Peter Clausen 61549165cf Add regression test for passing struct members to system functions
Check that the signedness of a struct member is properly handled when being
passed to a system function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-05-24 11:32:31 +02:00
Lars-Peter Clausen 12188f8d83 Add regression test for out-of-bounds array assignment operator
Check that an assignment operator on an out-of-bounds array element works
as expected. The out-of-bounds access should leave the array unmodified,
but the right-hand side must be evaluated regardless.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-05-22 10:55:58 +02:00
Stephen Williams e8bc3bf8dd
Merge pull request #719 from steveicarus/steveicarus/issue717-vcd-real-parameters
Fix vcd dump of real value parameters
2022-05-21 11:35:17 -07:00
Stephen Williams 6564f55219 Fix vcd dump of real value parameters
Parameters with real values are possible in Verilog, but not in the VCD
format, so lie a little and call them "real" objects. Otherwise, we can
treat them like constants and it works out, at least for gtkwave.
2022-05-21 10:13:27 -07:00
Stephen Williams 6176f8eec3
Merge pull request #715 from larsclausen/vvp-load-store-skip
tgt-vvp: Fix incorrect load or store operation skip
2022-05-21 09:17:38 -07:00
Stephen Williams 5d97405724
Merge pull request #714 from steveicarus/steveicarus/issue156-vcd-dump-parameter
Add parameters to vcd dumps
2022-05-17 08:37:21 -07:00
Lars-Peter Clausen c2c758369d Add regression tests for accidental store/load skip
Check that for the following operations the load or store is not skipped
after a operation that sets vvp flag 4.

 * Assignment to immediate indexed real array entry
 * Assignment operator on immediate indexed vector array entry
 * Assignment operator on dynamic vector part select

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-05-16 11:36:20 +02:00
Stephen Williams a1485906ca Add parameters to vcd dumps
Writing parameters into VCD files makes the values available to waveform
tools. This can be done easily enough by writing out a $dumpadd section
at the beginning of the file that sets the parameter values. We don't need
to track the values over change, because by definition they do not change.

This changes the typical vcd output as well, so a few of the regression tests
need to be adjusted to account for this.

Also, while tracking this down, found and fixed the vvp/README.txt documention
for the .param/x records.
2022-05-15 18:47:18 -07:00
Lars-Peter Clausen b83daa3ae3 Add regression tests for dynamic array and queue out-of-bounds access
Check that out-of-bounds access on a dynamic array or queue works and
returns the correct value.

  * 2-state vectors: '0 with the element width
  * 4-state vectors: 'x with the element width
  * reals: 0.0
  * strings: ""

Note that the 2-state test currently still fails as out-of-bounds access on
a 2-state vector incorrectly returns 'x.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-05-15 21:58:01 +02:00
Stephen Williams e076400449
Merge pull request #708 from larsclausen/real-array-multi-dim
tgt-vvp: Allow multi-dimensional real arrays
2022-05-12 14:48:15 -07:00
Lars-Peter Clausen 37392383b5 Add regression test for scalar and 1-bit parameters
Check that scalar typed parameters are handled correctly. Make sure the
width of the parameter only depends on the type and not on the value
assigned to the parameter.

Same for parameters with a 1-bit range specification.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-05-02 14:33:31 +02:00
Lars-Peter Clausen ef009e7200 Add regression test for multi-dimensional real array
Check that multi-dimensional real arrays are supported and can be accessed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-05-02 14:30:29 +02:00
Lars-Peter Clausen 58ac6ed1f8 Add regression tests for invalid class new
Check that using a class new operator on a variable that is not of a class
type results in an error.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-04-30 21:13:59 +02:00
Stephen Williams 7e67b8b11b Add br_gh699 regression test. 2022-04-23 18:52:35 -07:00
Stephen Williams 4679c722e3
Merge pull request #698 from larsclausen/type-cast-elaborated
PECastType: Use elaborated data type
2022-04-23 17:33:40 -07:00
Lars-Peter Clausen da21c62f29 Add regression tests for type casts with type identifiers
Check that type casts using type identifiers works as expected.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-04-22 09:06:31 +02:00
Lars-Peter Clausen 9d37878aa7 Add regression test for shortreal module ports
Check that module ports can have the shortreal data type.

Note that SystemVerilog does not allow nets to be of shortreal type.
Supporting net ports with a shortreal type is a Icarus extension.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-04-21 10:18:12 +02:00
Lars-Peter Clausen 818dfa55f3 Add regression tests for nested dynamic arrays and queues
SystemVerilog allows to declare signals of nested unpacked types. E.g. a
queue of dynamic arrays.

This is currently not supported by Icarus. Add regression test nevertheless
to check that this is reported as a non-supported construct and does not
result in random crashes.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-04-18 09:58:02 +02:00
Lars-Peter Clausen f42ab248a4 Add regression test for functions with bounded queue return type
Check that the maximum size of a bounded queue is properly handled when
being used as the return type for a function.

Elements beyond the maximum size should be ignored.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-04-18 09:58:02 +02:00
Lars-Peter Clausen 724d7d4282 Consolidate unpacked array type elaboration
There are currently two implementations for elaborating unpacked array
types. One that is used when elaborating a signal with an unpacked array
type and one that is used everywhere else using the elaborate_type()
infrastructure.

The elaborate_type() implementation is less complete and for example does
not support bounded queue types.

Consolidate both into a single implementation to reduce duplicated code and
get consistent behavior. This for example makes sure that the maximum queue
size is respected when used as a function return type.

Nested data structures of arrays, dynamic arrays or queues are not yet
supported. In the current implementation when encountering such a type an
assert will be triggered and the application crashes. In the new
implementation an error message will be printed without crashing the
application.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-04-18 09:58:02 +02:00
Stephen Williams bf521c7eec
Merge pull request #686 from larsclausen/assignment-pattern-expr
Elaborate array assignment pattern values in the right context
2022-04-17 18:36:18 -07:00
Lars-Peter Clausen a3c329ae84 Add regression tests for evaluating expression within assignment patterns
Check that expressions within assignment patterns are evaluated as if they
were assigned to a variable with the same type as the base type of the
assignment pattern target.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-04-17 09:58:19 +02:00
Lars-Peter Clausen 393c7a3b49 Add a regression test for functions with queue return type
Check that a queue type is supported for the return type of a function.
Make sure that the queue is not cleared in between invocations for
non-automatic functions.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-04-17 09:14:38 +02:00
Lars-Peter Clausen 031fbac5be Add regression tests for signed class properties
Check that the signedness of class properties is handled correctly
  * When sign extending
  * When passing as a value to a system function

Check this for both when accessing the property from within a class method
as well as accessing it on a class object.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-04-14 12:01:23 +02:00
Lars-Peter Clausen 0c123b8498 Add regression tests for methods with signed return values
Check that the signedness of the return value of methods is handled
correctly.
  * When sign extending
  * When passing as a value to a system function

Check this for both methods on user defined class as well as built-in
methods on SystemVerilog types.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-04-14 12:01:23 +02:00
Stephen Williams 752a28598b
Merge pull request #681 from larsclausen/signal-real-type
Use `real_type_t` as the data type for `real` type signals
2022-04-13 22:23:14 -07:00
Stephen Williams 760ecfc44f
Merge pull request #680 from larsclausen/class-static-prop-assign
Handle assignment to static class properties in class methods
2022-04-13 22:20:55 -07:00
Lars-Peter Clausen 4ae2eec275 Add regression test for Verilog AMS abs() with function call argument
Check that the behavior of the Verilog AMS `abs()` function is correct when
its argument is a function call. Check this for both vector as well as real
types.

This test is largely a copy of the existing vams_abs2 test, just replacing
the identifier argument with a function call argument.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-04-12 19:38:34 +02:00
Martin Whitaker 6b5d7a3695 Add regression test for br_gh672. 2022-04-12 16:59:41 +01:00
Lars-Peter Clausen ea55421a07 Add regression test for accessing static class properties
Check that static class properties can be accessed for read and write and
that they are shared between all instances of a class type.

Check that this works for the following 3 cases

 * accessing the static property in a class function or task
 * accessing the static property in a class function or task using `this`
 * accessing the static property on a class object instance

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-04-12 11:45:30 +02:00
Lars-Peter Clausen 338516bc55 Add regression tests for constant recursive functions
Check that constant recursive functions are supported. Check both Verilog
style using assignments to the implicit function return signal and
SystemVerilog style using `return`.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-04-11 22:03:02 +02:00
Lars-Peter Clausen 5b6d8e968d Add regression test for recursive function using `return
Add a regression test that checks that recursive functions using a `return`
statement work correctly.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-04-11 22:03:02 +02:00
Stephen Williams 7c5694e516
Merge pull request #673 from larsclausen/package-no-implicit-var
Require explicit data type for package variable declarations
2022-04-10 15:06:26 -07:00
Stephen Williams 3da5b4cf65
Merge pull request #664 from larsclausen/integer-port
Correctly handle separate port type declaration for integer types
2022-04-10 15:05:48 -07:00
Stephen Williams 070b8af63c
Merge pull request #663 from larsclausen/class-constructor
Small class syntax improvements
2022-04-10 14:56:51 -07:00
Stephen Williams 99eaf007a1
Merge pull request #662 from larsclausen/array-base-type-scope
Elaborate base type of array types in the right scope
2022-04-10 14:56:07 -07:00
Martin Whitaker 50ae8cf552 Add regression test for br_gh674. 2022-04-10 21:58:39 +01:00
Lars-Peter Clausen 35c69366a5 Add regression tests for implicit variable declarations in packages
Check that it is not possible to declare a variable in a package without an
explicit data type for the variable.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-04-09 09:15:23 +02:00
Martin Whitaker 42de9e646a Add regression test for br_gh661 and test for correct $random behaviour. 2022-04-03 19:56:56 +01:00
Lars-Peter Clausen 4c9af1c47a Add regression tests for non-ANSI integer module ports
Check that it is possible to declare the type separately from the direction
for non-ANSI integer, time and atom2 ports. Check that it is possible to
both declare the type before and after the direction.

For integer, time and atom2 types the range specification on the port
direction declaration should be empty, rather than the implicit packed
dimension of the integer type.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-03-28 10:40:25 +02:00
Lars-Peter Clausen 571f222a73 Add additional regression tests for class syntax
Check that it is possible to both declare and call class constructors
without using parenthesis after the `new` keyword.

Check that a non-ANSI port for a class constructor results in an error.

Check that it is possible to invoke a class task through a implicit class
handle (`this` or `super`) without using parenthesis after the task name.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-03-28 10:14:56 +02:00
Lars-Peter Clausen 1a95dafc8d Add regression tests array base type elaboration scope
Check that for typedefs of array, dynamic array and queue types the base
type is elaborated in the right scope. There are separate tests for vector
base type and other base types since these take different paths internally.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-03-28 09:17:24 +02:00
Stephen Williams d480c4d7d0
Merge pull request #659 from larsclausen/typedef-overwrite
Support typedef overwrites with unpacked dimensions and in classes
2022-03-27 15:49:55 -07:00
Stephen Williams 658d4f5eee
Merge pull request #658 from larsclausen/class-in-module
Handle multiple instances of modules with class definitions
2022-03-27 15:48:56 -07:00
Stephen Williams 4f971ea4f9
Merge pull request #657 from larsclausen/enum-base-type
Support type identifier base type for enum
2022-03-27 15:47:34 -07:00
Martin Whitaker 8a19380a5d Add multi-file VPI test. 2022-03-26 16:44:57 +00:00
Lars-Peter Clausen 315bc1908a Add regression tests for enum base type
Check that the behavior for all sorts of base types for enums is correctly
implemented. Both for valid as well as invalid base types.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-03-25 21:55:34 +01:00
Lars-Peter Clausen 252174d15a Add additional regression tests for typedef overwrites
Check that it is possible to create a typedef of an array type that shadows
an existing typedef in a higher level scope.

Also check that it is possible to create a typedef in a class scope that
shadows an exiting typedef in a higher level scope.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-03-23 10:53:56 +01:00
Cary R 86a7707482 Update vlog95 regress for some recent test changes 2022-03-23 00:07:30 -07:00
Lars-Peter Clausen abe5e692ce Add regression test for classes defined in modules
Check that it is possible to have multiple instances of a module
that declares a class and that the class in each module instance
is a unique type that can have dependencies on module parameters.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-03-22 11:53:47 +01:00
Martin Whitaker 2c505f0040 Add regression test for issue #621. 2022-03-21 19:55:15 +00:00
Stephen Williams fc80465b87
Merge pull request #656 from larsclausen/enum-compatibility
Restrict enum compatibility to the same scope
2022-03-20 19:13:56 -07:00
Stephen Williams f73af99ce7
Merge pull request #655 from larsclausen/fix-udp-output-reg
parser: Fix UDP registered output syntax
2022-03-20 19:12:34 -07:00
Stephen Williams af09d86113
Merge pull request #647 from larsclausen/non-ansi-ports
Allow to declare direction after data type for non-ANSI ports
2022-03-20 19:10:49 -07:00
Lars-Peter Clausen 83da384df3 Add regression test for enum compatibility across module boundaries
Check that the compatibility of signals of enum data type across module
boundaries.

If the enum data type is declared at a higher level scope or imported from
a package the signals are compatible between different module instances. If
the enum data type is declared within the module itself though the signals
are not compatible.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-03-19 17:17:21 +01:00
Lars-Peter Clausen c5e160f1dd Add regression test for `output reg` syntax for UDPs
Check that it is possible to declare a registered output of a user defined
primitive using the `output reg` syntax.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-03-19 13:00:04 +01:00
Martin Whitaker e53b2e774b Further fixes for vvp code generation for c. assign of an array word.
The draw_net_input() function can write additional statements to the output
file, so must not be called in the midst of writing a statement.
2022-03-19 10:22:49 +00:00
Lars-Peter Clausen db33dbfbcc Add regression tests for task non-ANSI port declarations
Check that it is possible to define the data type of a non-ANSI task port
in a separate declaration from the port direction. Add tests for both the
type declared before the port direction and for the type declared after the
port direction.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-03-16 09:17:55 +01:00
Lars-Peter Clausen ee81ac2f85 Add regression tests for module non-ANSI port declarations
Check that it is possible to define the data type of a non-ANSI module port
in a separate declaration from the port direction. Add tests for both the
type declared before the port direction and for the type declared after the
port direction.

Note that this doesn't work yet correctly for integer type module ports
yet, so there are no tests for this. This will be addressed in follow up
work.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-03-16 09:17:55 +01:00
Martin Whitaker 831db5a0d7 Fix vvp code generation for c. assign shift of array word (issue #632) 2022-03-14 23:24:20 +00:00
Stephen Williams 15e1a7a3f2
Merge pull request #644 from larsclausen/port-range-mismatch-recover
Recover from port and signal vector range mismatch
2022-03-13 14:36:31 -07:00
Stephen Williams d7e4d209b8
Merge pull request #640 from larsclausen/darray-packed-array
Support dynamic arrays and queues of packed arrays
2022-03-13 14:33:27 -07:00