Commit Graph

9908 Commits

Author SHA1 Message Date
Lars-Peter Clausen b8eb21b3ac Allow to omit trailing module ports in ordered list connection
The current implementation expects that for a module instantiation with a
ordered list connection all ports are supplied.

But there doesn't seem to be such a requirement in the LRMs. The Verilog
LRM doesn't mention anything in this regard and the SystemVerilog LRM
mentions in section 23.3.2.1 that a blank or omitted port connection is
either left unconnected or uses the default value of the port.

Update the implementation so that it allows to omit trailing ports and only
generates an error message if too many ports are specified in the ordered
port list.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-06-11 08:45:34 -07:00
Cary R edaa6e6c76
Merge pull request #935 from larsclausen/do-while-continue-break
Handle continue/break in do-while loops
2023-06-11 07:59:01 -07:00
Lars-Peter Clausen 438e510764 Update regression tests for continue/break to cover do-while loops
Also check do-while loops in the regression tests for continue and break
statements.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-06-11 07:20:15 -07:00
Lars-Peter Clausen fb403c6266 tgt-vvp: Handle continue/break in do-while loops
Currently continue and break are supported in most loops. But not in
do-while loops. Add support for them in do-while loops as well.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-06-11 07:20:15 -07:00
Cary R 750ec01352 Update vlog95 immediate assert/assume gold files 2023-06-10 21:19:32 -07:00
Cary R 63bcb9601d
Merge pull request #906 from svenka3/svenka3/labelled_imm_sva
Added support for labels in immediate assert/assume
2023-06-10 20:59:41 -07:00
Cary R ee14cb0eb0 Update displayed Copyright dates 2023-06-10 20:33:08 -07:00
Cary R ed691d25f7 Add wget commands to update config.guess and config.sub 2023-06-10 20:32:50 -07:00
Cary R 6307057e8d Fix space issues 2023-06-10 19:44:10 -07:00
Cary R bff91566ab
Merge pull request #930 from larsclausen/fix-fn-partial-oob-write
Fix incorrect assert for partial oob write to function return value
2023-06-10 18:00:06 -07:00
Cary R bfba4bf6ca
Merge pull request #932 from mole99/overhaul-documentation
[WIP] Documentation Overhaul
2023-06-10 17:54:33 -07:00
Cary R 5bf44cc78d
Merge pull request #904 from a1ca7raz/master
Update config.guess and config.sub to add support for riscv64 platform
2023-06-10 17:54:11 -07:00
mole99 f4345e2d03 Add favicon 2023-06-09 14:07:28 +02:00
mole99 b0c1eab51e Move textfiles to documentation 2023-06-09 13:30:44 +02:00
mole99 41496040e8 Rename to .txt 2023-06-09 13:29:25 +02:00
mole99 265f585096 Document all targets 2023-06-09 13:28:14 +02:00
Cary R c74048a526
Merge pull request #908 from mole99/sdf-info
Move `SDF INFO`,  `SDF WARNING`, `SDF ERROR` to start of line
2023-06-04 21:13:22 -07:00
Cary R a37181ae95
Merge pull request #924 from aelmahmoudy/fix-typos
Fix typos
2023-06-04 21:12:07 -07:00
Cary R 13166092da
Merge pull request #919 from larsclausen/fix-real-format-arm
Fix formatting real to binary and hex strings on ARM
2023-06-04 21:10:49 -07:00
Cary R 9cb3d53633
Merge pull request #918 from larsclausen/fix-single-element-array-ports
Fix connecting single element array ports
2023-06-04 21:09:04 -07:00
Cary R cd293e17af
Merge pull request #895 from larsclausen/fork-in-final
vvp: Handle `%fork` in `final` procedures
2023-06-04 21:07:48 -07:00
Cary R f22c1a519b
Merge pull request #900 from larsclausen/task-return
Support return in tasks
2023-06-04 21:07:30 -07:00
Lars-Peter Clausen 4ab59dd55e Add regression tests for oob write to function return value
Check that partial and fully out-of-bound writes to a function's return
value are handled correctly. Check this for both 4-state and 2-state
vectors.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-06-04 16:27:24 -07:00
Lars-Peter Clausen 925f5fb608 Fix incorrect assert for partial oob write to function return value
Partial out-of-bounds write to a function's return value will trigger an
assert, even though the operation is valid.

The assert checks that the truncated value has the expected width, but
instead it should check that the non-truncated value has the expected with.

Move the assert before the truncation to fix this.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-06-04 16:04:16 -07:00
Cary R 2e84766e79
Merge pull request #893 from larsclausen/array-assign-order
Connect continuous array assignments in the right order
2023-06-02 13:57:18 -07:00
Cary R d3a0e9606f
Merge pull request #891 from larsclausen/init-netnet-port-index
Initialize NetNet::port_index_
2023-06-02 13:54:20 -07:00
Cary R 210ada0a5a Update Python test script to run using 3.5 or newer 2023-06-01 01:06:05 -07:00
Cary R 01c5e502bd Update tests so they can be converted to vlog95 2023-05-31 22:45:06 -07:00
Cary R ef931e2e0d Spelling and space cleanup 2023-05-31 22:44:13 -07:00
Cary R 5439fcd5c2 Update to latest fstapi.c 2023-05-31 20:02:54 -07:00
Cary R 7ac6182d4c Update to compile with older GCC versions 2023-05-31 20:02:36 -07:00
أحمد المحمودي (Ahmed El-Mahmoudy) 08aee81924 Fix typos 2023-05-17 07:08:00 +02:00
Martin Whitaker deeac2edfe Fix broken example code (discussion #922)
'output' is a keyword, so can't be used as a signal name.
2023-05-15 19:42:47 +01:00
Lars-Peter Clausen abe1099335 Fix formatting real to binary and hex strings on ARM
Directly casting a negative double to a unsigned integer type is undefined
behavior and has different results on x86 and ARM based platforms.

On x86 the behavior is similar to casting a signed int to an unsigned
integer, i.e. the sign bit will end up in the MSB. But on ARM the result
will be 0.

To get consistent behavior, first cast to signed integer and then cast the
signed integer value to an unsigned integer value.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-05-08 09:16:00 -07:00
Lars-Peter Clausen 99a9be25f0 Add regression test for single element module port array
Check that connections to a module port array with a single element are
supported.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-05-06 09:58:41 -07:00
Lars-Peter Clausen 829af9f438 Fix connecting single element array ports
The current check to decide whether a port is an array or a scalar signal
uses the number of pins on the NetNet. If it is larger than one the code
assumes that it is an array.

But for arrays with on a single element the number of pins will be 1 and
the port is incorrectly treated as a scalar signal which results in an
error.

Instead of using the number of pins check for the number of unpacked
dimensions to decide whether the port is an array.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-05-06 09:28:40 -07:00
mole99 691159a8fe Move SDF ERROR, SDF WARNING to start of line 2023-04-19 19:30:23 +02:00
mole99 a3bf61030d Move SDF_INFO to start of line 2023-04-19 18:35:32 +02:00
Srinivasan Venkataramanan 2eeedb193d Added support for labels in immediate assert/assume 2023-04-18 22:30:04 +01:00
a1ca7raz 20753ee6c5 Update config.guess and config.sub 2023-04-18 19:26:42 +08:00
Lars-Peter Clausen d1aecf452c Add regression test for return in tasks
Check support for using the return statement in a task.
 * That it is possible to exit form a task using the `return` statement
   without affecting other concurrently running instances of the same task
 * That it is possible to use return in a named block in a task
 * That using a return value in a task results in a elaboration error
 * Returning from inside a parallel block in a task results in a
   elaboration error

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-04-16 19:22:49 -07:00
Lars-Peter Clausen 730c9c28b2 Support return in tasks
SystemVerilog allows to use the `return` statement in a task to exit the
task before it reaches the end of its execution. This is defined in section
13.3 ("Tasks") of the LRM (1800-2017).

This is similar to using `disable` to stop a task from within itself with
the difference that `disable` will affect all concurrently running
executions of a task, while `return` will only affect the task from which
it has been called.

The `%disable/flow` vvp instruction allows to implement the required
behavior for task return.

There is one complication in that it is not allowed to call return from
inside a parallel block (fork-join). If a parallel block is unnamed and has
no variable declarations there won't be a NetScope for it. So it is not
possible to detect whether the return is inside a parallel block by
walking up the scope chain.

To solve this add a design global counter that gets incremented when
entering a fork block and decremented when exiting a parallel block. The
return implementation then checks if the counter is non 0 to determine
whether it is in a parallel block.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-04-16 19:22:29 -07:00
Lars-Peter Clausen e1691c48fe Add regression tests for reversed continuous array assignment
Check that assigning array that have opposite left-to-righto order for
their dimensions have their elements assigned in reversed order.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-04-16 09:21:27 -07:00
Lars-Peter Clausen cc962310bb Connect continuous array assignments in the right order
In SystemVerilog arrays assignments are supposed to be connected left to
right. This means if the left to right direction differs between the two
arrays they will be connected in reverse order.

E.g.
```
logic a[1:0];
logic b[0:1];
assign b = a;
```

should connect a[0] to b[1] and a[1] to b[0]. Things get a bit more tricky
for multi-dimensional arrays where some dimensions have a matching
direction and some do not.

The current implementation always connects them low to high, which results
in incorrect behavior.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-04-16 09:21:26 -07:00
Lars-Peter Clausen 7973b105ac Add regression test for sub-blocks in `final` procedures
Check that sub-blocks containing variables inside of `final` procedures do
get executed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-04-16 09:20:39 -07:00
Lars-Peter Clausen df30eda3a3 vvp: Handle %fork in `final` procedures
In the current implementation a `%fork` instruction in a final block will
get scheduled, but never executed.

And while SystemVerilog requires a `final` procedure to execute in 0 time
and so no SystemVerilog `fork` is allowed inside of it, there are some
other scenarios where iverilog generates `%fork` statements.

For example when declaring variables in a sub-block a sub-scope with its
own thread is is used to allocate the storage for those variables and
`%fork` is used to execute the child thread.

E.g. the following, while being valid SystemVerilog, will never execute the
loop because the generated code will implement the loop as a child thread
being executed by a `%fork` statement.
```
  final for (int i = 0; i < 10; i++) $display(i);
```

To mitigate this treat final statements the same as functions and rather
than scheduling a child thread, execute it immediately when using the
`%fork` statement.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-04-16 09:20:31 -07:00
Stephen Williams b210eb8264
Merge pull request #880 from mole99/master
Print more information about the SDF header
2023-04-14 18:14:03 -07:00
Lars-Peter Clausen a68fe8ea0a Initialize NetNet::port_index_
The port_index_ member of the NetNet is not initialized which can lead to
undefined behavior. Make sure to initialize to -1 to indicate that the net
is not associated with any port.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-04-14 07:13:43 -07:00
mole99 fd9f0b3c75 Add divider to header output 2023-04-14 11:08:10 +02:00
mole99 cca7d15cc4 Add testcase for sdf header 2023-04-14 11:08:08 +02:00