Commit Graph

8828 Commits

Author SHA1 Message Date
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
Martin Whitaker c564184bd1 Fix evaluation of out-of-bounds bit/part-select in constant function (issue #531).
(cherry picked from commit 3b1b611a18)
2021-07-30 22:52:02 +01:00
Martin Whitaker b48cdff89e Fix segfault in wildcard port connection with unnamed port (issue #530).
A module port list may contain unnamed entries, e.g.

  module dut(a,);

When performing a wildcard connection, these entries should be skipped,
as there is no name to match.

(cherry picked from commit 061121203b)
2021-07-30 22:51:52 +01:00
Cary R d3b0992a22 Cleanup space 2021-06-20 22:51:41 -07:00
Cary R 5a9ff97df5 Update pform_dump copyright year 2021-06-20 22:40:34 -07:00
Cary R 87d7881365 Correctly dump case items 2021-06-20 22:39:53 -07:00
Cary R afe008ca75 Update fstapi files to latest from GTKWave 2021-06-17 21:41:46 -07:00
Martin Whitaker b45a52a164 Fix .event/or connectivity when inputs have multiple fanout (issue #508).
The old implementation connected all inputs to the same vvp_net_t port,
on the basis that we don't care about the data values or what port they
arrived on. But if one or more of the inputs fans out to multiple nets,
the chains get tangled, which either results in connections being lost
or inappropriate connections being made, depending on the order that
the inputs are linked.

This could have been fixed by using a standard wide functor. But as we
don't care about the data values, that would be unnecessary overhead.
We just need separate vvp_net_t objects to handle the input connectivity
and can keep using a single shared functor.

(cherry picked from commit 1f8876be1c)
2021-05-18 10:08:01 +01:00
Martin Whitaker a676db798a Remove redundant elab_and_eval_lossless().
(cherry picked from commit 711623f682)
2021-05-16 22:38:53 +01:00
Martin Whitaker a14118cd6c Do not force lossless calculation for index expressions (issue #515)
The standard Verilog expression bit length rules must be used.

(cherry picked from commit a040ddc070)
2021-05-16 22:38:44 +01:00
Martin Whitaker 0bd51dbfb8 Record the actual data type when a module port has an enum type.
This fixes assignment compatibility problems (issue #498).

(cherry picked from commit cf0bf4d9aa)
2021-04-28 20:35:57 +01:00
Martin Whitaker ada3067899 Fix waveform dumpers to use vpiInstance when dumping all variables.
(cherry picked from commit a7cb93842e)
2021-04-21 11:42:14 +01:00
Martin Whitaker 69cf8d8901 Add support for vpiInstance as the type code in calls to vpi_iterate().
This is needed for the waveform dumpers now that vpi_iterate(vpiModule, NULL)
has been ficed to only return modules.

This includes recognising vpiProgram and vpiInterface, although the compiler
and vvp currently incorrectly classify them as modules.

(cherry picked from commit d2521878d7)
2021-04-21 11:41:51 +01:00
Martin Whitaker a83a205b06 Properly report errors for out-of-bounds constant indexed part selects.
(replacing assertions)

The IEEE standard either requires out-of-bounds bits to be ignored on
write, returned as 1'bx on read, or requires a compile-time error message.
The latter is easier to implement.

(cherry picked from commit 7d7aa0604c)
2021-04-21 11:41:07 +01:00
Martin Whitaker c0c46dc173 Support indexed part selects that index sub-arrays (issue #497)
(cherry picked from commit 4af830187e)
2021-04-21 11:39:48 +01:00
Cary R cccf36d76f Fix warning and little E full vector up/down selects
(cherry picked from commit 0c12344b27)
2021-04-21 11:39:40 +01:00
Martin Whitaker f64c831688 Fix width calculation for bit/part selects of multi-dimensioned packed arrays.
If we have a bit/part select that is selecting one or more sub-arrays, e.g.

  wire [3:0][3:0] foo;
  assign foo[1] = 4'd1;

we need to take into account the bit width of the sub-array when calculating
the bit width of the select.

(cherry picked from commit 7c024d6cab)
2021-04-21 11:39:01 +01:00
Martin Whitaker adb4be5c75 Don't return packages when iterating over root modules (issue #496)
The code assumed all handles stored in vpip_root_table were modules. This
is true for traditional Verilog, but not so for SystemVerilog.

Whilst here, also add support for iterating over packages.

(cherry picked from commit 3167b2ed24)
2021-04-18 10:53:34 +01:00
Cary R eaea698027 V11: Add support to include macro expanded strings 2021-02-13 16:58:09 -08:00
Cary R 338b9a69ee Update severity tasks to match devel 2021-02-01 00:23:35 -08:00
Cary R b613cf4bf5 Update warning to match devel 2021-01-30 14:29:09 -08:00
Martin Whitaker a89eab47f5 CI: run 'make check' before 'make install'.
This makes sure 'make check' works when iverilog isn't already
installed on the system.
2021-01-28 00:38:45 +00:00
Martin Whitaker 0d9268cdbc Don't exit when ivl_root not found - the user may have supplied it.
When running 'make check' without having an installed copy, find_ivl_root()
will fail on Unix systems that don't provide /proc/self/exe (e.g. MacOS).

(cherry picked from commit 56d2d798ec)
2021-01-28 00:34:11 +00:00
Cary R f806ed5084 Add define to indicate Icarus synthesis 2021-01-14 00:15:58 -08:00