Commit Graph

8851 Commits

Author SHA1 Message Date
Martin Whitaker 1f4e65ee08 vvp: Fix implementation of strndup for Windows (issue #608).
The maximum length to copy, n, does not include the terminating null
character.

(cherry picked from commit 4c36b2a8a7)
2022-03-25 21:07:52 +00:00
Martin Whitaker 5aef565b94 vvp: Fix error message output when a VPI module can't be found.
(cherry picked from commit 3c58ca908d)
2022-03-25 21:07:42 +00:00
Martin Whitaker 20b5377989 vvp: Accept either \ or / as path separators in the -m option (issue #606).
Windows system calls will accept either of these. This is already done in
the iverilog driver.

(cherry picked from commit 2bf753fd8f)
2022-03-25 21:07:32 +00:00
Cary R f247fe532f Update to the latest from GTKWave 2022-03-22 23:32:36 -07:00
Martin Whitaker 598363de84 vvp: ensure array ports are added to the correct context (issue #621)
Array ports are created via a resolve list. We need to detect and
record whether they need to be created in an automatic context at
the point they are declared, not at the time they are created.

(cherry picked from commit b3f7ce6020)
2022-03-21 20:10:43 +00:00
Martin Whitaker 7b9407f66d Add regression test for issue #621.
(cherry picked from commit 2c505f0040)
2022-03-21 20:09:42 +00:00
Martin Whitaker fcb64232de Report correct net name in synthesis "sorry" message (issue #649).
(cherry picked from commit b7f948193a)
2022-03-19 13:03:48 +00:00
Martin Whitaker ff21f02c6c 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.

(cherry picked from commit e53b2e774b)
2022-03-19 11:36:36 +00:00
Martin Whitaker 92e4597607 Fix vvp code generation for c. assign shift of array word (issue #632)
(cherry picked from commit 831db5a0d7)
2022-03-15 09:31:22 +00:00
Stephen Williams 37a8b9a6c7
Merge pull request #625 from steveicarus/vvp_stop_scopes-v11
Add more types to vvp-stop
2022-02-26 12:54:41 -08:00
Stephen Williams 899a240311 Add more types to vvp-stop
Several scope types were not understood by the push command, and
a few types were not displayed reasonably. Flesh these out.

(cherry picked from commit de579f2650)
2022-02-26 12:19:16 -08:00
Stephen Williams 631fa17002
Merge pull request #588 from steveicarus/ivtests-fail-exit-v11
v11 fulling using included ivtests, and remove the checked in regression_report files.
2022-01-16 16:39:33 -08:00
Stephen Williams a48769f5d4 ivtest: Mark as NI tests that are known to fail.
Mark them as NI so that in the fugure they might be turned back
on if they can be made to work. Keep the tests around as reference.

Also, remove reports that are no longer tested in CI. This is because
they are no longer tested by a previous patch that relies on the
change vvp_reg.pl behavior around failed tests.

Remove now obsolete update_msys2_report.pl, and simplify the test.sh
script, since diff commands and Windows specific trickery are no
longer needed.
2022-01-16 16:03:03 -08:00
Stephen Williams 5b82d69636 ivtest: vvp_reg.pl sets exit status
If there are any failures, return a non-zero exit status so that
invoking scripts can detect that failures happen. This eliminates
the need to use regression report reference outputs, and should
make it easier to merge PRs that add or impact tests.
2022-01-16 15:56:20 -08:00
Stephen Williams c4d07b6a62 Drop workaround that documentation goes missing for msys2 build. 2022-01-16 09:00:16 -08:00
Martin Whitaker 9bf45e89f0 Fix CI on Windows again.
man-db has now been removed from the base-devel group.

(cherry picked from commit f705e7b61c)
2022-01-15 23:45:14 +00:00
Stephen Williams b17a967ced
Merge pull request #583 from steveicarus/bring-in-ivtest
v11: Add ivtest to the iverilog source tree
2022-01-15 13:42:59 -08:00
Stephen Williams 6f114cce17 Do not fail msys build if there are no pdf files installed. 2022-01-15 13:15:12 -08:00
Stephen Williams fd30e57337 Fix up some v11 issues brought on by ivtests issues
The ivtest suite from the master branch has a few bits that the
v11-branch cannot handle. So here we start seeing the test suites
diverge for releases.
2022-01-15 11:53:31 -08:00
Stephen Williams 74f7dacc86 Add ivtest to the iverilog source tree
By adding ivtest to the iverilog source tree, it is easier to keep
the regression test synchronized with the source that is being tested.
This should be especially helpful for PRs that add a new feature, and
have a matching ivtest PR with the regression test for that feature.
2022-01-15 11:05:49 -08:00
Miodrag Milanovic 3e84e6e93a Fix find_ivl_root for OSX
(cherry picked from commit 57cfbc0cea)
2022-01-06 08:34:04 +00:00
Lars-Peter Clausen 7d3c25f39a Short circuit logical operator to constant if possible
If the left-hand side of a logical operator is a constant that causes the
right-hand side to be short-circuited the right-hand side can be discarded
even if it is not constant.

In this case replace the expression by a constant.

E.g.
 * `0 && expr` will be replaced by a constant 0.
 * `1 || expr` will be replaced by a constant 1.
 * `0 -> expr` will be replaced by a constant 1.

Note that it is not possible to replace the expression by a constant if
only the right-hand side is a constant, even when the value of the
expression is constant. The left side still has to be evaluated for side
effects.

E.g. it is known at elaboration that `a++ && 0` will yield 0, but the
increment on `a` has to be executed regardless.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
(cherry picked from commit 957e3d482f)
2021-12-31 09:48:23 +00:00
Lars-Peter Clausen 48e26a44d7 tgt-vvp: Short circuit logical operators
Section 11.4.7 of the SystemVerilog LRM states

```
The && and || operators shall use short circuit evaluation as follows:
  - The first operand expression shall always be evaluated.
  - For &&, if the first operand value is logically false then the second operand shall not be evaluated.
  - For ||, if the first operand value is logically true then the second operand shall not be evaluated.
```

vvp currently evaluates both operands of a logical operator. This works
fine as long as the right-hand side does not have a side effect. But if it
has the result might be incorrect.

E.g. for `a && b++` `b` must not be incremented if `a` evaluates to false.

The Verilog LRM mentions that it is allowed to short circuit any expression
"if the final result of an expression can be determined early". But there
is no requirement to do so.

So the new and the old behavior are both correct implementations in
Verilog.

Use the new behavior in both Verilog and SystemVerilog mode to make sure
the behavior is consistent when an expression has side effects.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
(cherry picked from commit d4334139d3)
2021-12-31 09:47:20 +00:00
Lars-Peter Clausen f436565dfe tgt-vvp: Consolidate vec4 logical `and` and `or` generation
The code for generating the logical `and` and `or` operators is identical
except for the final opcode to combine the two results.

Consolidate this into a single function to reduce the code a bit.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
(cherry picked from commit 2fa7260a4c)
2021-12-31 09:47:15 +00:00
Michael Singer 6b494eaa11 Fix unique0 keyword/token mapping
(cherry picked from commit 6c60851558)
2021-12-31 09:46:26 +00:00
Miodrag Milanovic 687dc0c751 Fix for cross compile build
(cherry picked from commit 1341dee0e6)
2021-12-31 09:45:34 +00:00
Martin Whitaker f7ca845a47 Fix CI on Windows.
autoconf has been removed from the MSYS2 base-devel group.
2021-12-30 11:33:36 +00:00
Martin Whitaker 48ab896fa6 Warn when a negative value is assigned to a genvar (-g2001 only) (issue #567)
(cherry picked from commit 668f9850bc)
2021-12-13 22:17:16 +00:00
Martin Whitaker cdbc2c466f Fix genvar increment/decrement operations to be signed (issue #568)
(cherry picked from commit e1d6fd78f4)
2021-12-13 22:17:08 +00:00
Martin Whitaker 038fbe609d Change compiler's generate loop counter from int to long.
This matches the type of the values assigned to it, and exposes a bug that
was previously only showing up under Windows.

(cherry picked from commit 67b9374c69)
2021-12-13 22:17:00 +00:00
Martin Whitaker a317a066af Improve error message on assignment to an array or array slice (issue #562).
This is valid SystemVerilog, but not something we support yet.

(cherry picked from commit 71c36d1289)
2021-11-12 22:52:02 +00:00
Martin Whitaker c7ee6157fc Fix an assertion failure when a variable name is replicated in the same list.
(cherry picked from commit 61aed6882c)
2021-11-12 22:51:52 +00:00
Martin Whitaker c00104bc50 Remove unreachable code.
pform_get_or_make_wire() should always return a valid pointer. Replace the
existing unreachable code with an assertion.

(cherry picked from commit 3c23180af3)
2021-11-12 22:51:41 +00:00
Cary R 56d69f498b Fix valgrind compile to work with new using std reorg 2021-11-10 18:21:23 -08:00
Martin Whitaker 12d67bb9ae Support SV [size] dimension for module and gate instances (issue #553).
Also output a proper error message if multiple dimensions are supplied
instead of failing an assertion.

(cherry picked from commit dcc9b59f6d)
2021-11-06 08:44:13 +00:00
Martin Whitaker c288487810 Clean up indentation.
(cherry picked from commit dbf55da0f5)
2021-11-06 08:40:58 +00:00
Martin Whitaker 7ba381a0d0 Remove buggy assertion.
If this assert fires, the "this" pointer we pass to it will be a
null pointer, so will cause a null pointer dereference. We've
tested it is not null earlier, so we don't need the assertion.
2021-11-04 19:35:22 +00:00
Martin Whitaker 97b5ac91cb Remove "using namespace std" from vvp header files and fix the fallout.
(cherry picked from commit 9cc09b8513)
2021-11-04 19:32:09 +00:00
Martin Whitaker 5533ff848b Remove "using namespace std" from tgt-vhdl header files and fix the fallout.
(cherry picked from commit 23390c1ba3)
2021-11-04 19:30:21 +00:00
Martin Whitaker 52b099feae Remove "using namespace std" from compiler header files and fix the fallout.
(cherry picked from commit ecbbb60fb6)
2021-11-04 19:22:43 +00:00
Martin Whitaker 9ac6154068 Handle run-time out-of-bounds access for wire real arrays (issue #556).
(cherry picked from commit 3dda39bce3)
2021-11-04 18:48:22 +00:00
Cary R 2b7ee675ee Update fstapi.c to the latest from GTKWave 2021-10-26 19:41:37 -07:00
Martin Whitaker 5ea6ee130e Fix signedness of non-ANSI port declarations (issue #540).
For non-ANSI port declarations that have both a port declaration and
a corresponding variable declaration, the signed attribute may be
attached to either the port declaration or the variable declaration,
or both declarations.

(cherry picked from commit ef01dd1e81)
2021-09-10 23:12:42 +01:00
Martin Whitaker 066eb0aca7 Check that a genvar is not shadowed when used in a generate loop construct.
This also ensures the same genvar cannot be used in two nested loops
(issue #533), because the implicit localparam with the same name
shadows the genvar declaration.

(cherry picked from commit 7ee7a48310)
2021-08-04 15:41:21 +01:00
Martin Whitaker 4c428a536e Include named events in checks for name collisions.
(cherry picked from commit cefcffecda)
2021-08-04 15:41:10 +01:00
Martin Whitaker 1ff4bfa63d Include typedefs in checks for name collisions.
This requires us to make a copy of the typedefs map when adding it to
a NetScope object, because the pform data is deleted before we are
finished with it.

(cherry picked from commit a17557575d)
2021-08-04 15:41:02 +01:00
Martin Whitaker 79a5e90e4d Avoid name collisions when naming unnamed generate blocks.
As specified in the IEEE standard, the automatically generated name
must not conflict with any explicitly declared name (not just scope
names).

(cherry picked from commit 7445b424f1)
2021-08-04 15:40:53 +01:00
Martin Whitaker 2f75fe4053 Fix naming of unnamed generate blocks (issue #528)
The IEEE standard specifies that the numbering of generate blocks
restarts at 1 in each new scope, and that the 'else' part of an 'if'
construct is part of the same constuct, so has the same number.

(cherry picked from commit ceb2581368)
2021-08-04 15:40:42 +01:00
Martin Whitaker 19dc81a242 Fix detection of directly nested generate constructs.
If a generate construct is enclosed in a begin-end pair, it can't
be directly nested (1364-2005 section 12.4.2).

(cherry picked from commit c34167b2c0)
2021-08-04 15:40:20 +01:00
Martin Whitaker 987ac819a9 Use a list instead of a set for storing the potential package imports.
This eliminates some indeterminism in the error messages, which was
causing occasional failures in CI. We don't expect this list to be
very large, so the O(n) insertion time should not be a problem.

(cherry picked from commit 389e2a3a94)
2021-07-31 19:22:44 +01:00