Commit Graph

10101 Commits

Author SHA1 Message Date
Martin Whitaker aec18a6c19 Emit "sorry" message for packed array parameter declarations (issue #1180)
These aren't yet supported. Make it an error if not compiling fpr a
SystemVerilog generation.
2024-11-15 20:24:58 +00:00
Martin Whitaker 6c8ed62a5a Add regression test for issue #1181. 2024-11-10 19:34:36 +00:00
Martin Whitaker 2817bf59c5 tgt-vlog95: fix mixed-scope multiple constant assignments to a net (issue #1181)
The vlog95 code generator collects all the constant assignments to a net
within each scope and then emits them. The old code only recorded the
ivl_signal_t for each constant assignment, which meant it had to iterate
through the nexus pointers in the assicated nexus to find the constant.
When there were multiple constant assignments to the same net, it needed
to record which assignments had already been emitted, which it did by
keeping a count in the nexus private data and skipping that many constants
on each successive assignment. However the count did not get reset after
emitting all the assignments in that scope, so if there were assignments
to the same net made in another scope, the count would already be positive
and those assignments would also be skipped.

This could probably have been fixed by clearing the nexus private data
after processing the constant assignment list for each scope, but it is
more efficient to record the ivl_nexus_ptr_t for each constant along with
the ivl_signal_t, eliminating the need to search for the associated nexus
pointer.
2024-11-10 13:31:54 +00:00
Cary R 96d28250bd br_gh1178b uses inout which cannot be translated currently 2024-11-09 17:43:32 -08:00
Cary R 7a4e17661a Fix gold file for br_gh1178a (repeat concatenation) 2024-11-09 17:22:40 -08:00
Cary R 00fcd58fab A repeat concatenation cannot be used as a net l-value 2024-11-09 17:21:44 -08:00
Cary R 5e7e7622b4 Update to latest files from GTKWave 2024-11-09 14:07:06 -08:00
martinwhitaker ce7b26e3f9
Merge pull request #1106 from daglem/part-select-address-overflow
Guard against overflow / wrap around of internal bit address
2024-11-03 12:03:07 +00:00
Lars-Peter Clausen d8c3c51ab1
Merge pull request #1176 from HD787/hd787/typo-fixes
Some typo fixes in the developer docs,
2024-10-09 19:13:58 -07:00
henry 01d28ea277 typo fixes 2024-10-07 23:20:12 -05:00
Dag Lem ba7da9d5a5 Guard against overflow / wrap around of internal part-select bit address
Internally, the maximum address space of a vector is 31 bits + a sign bit
to signal invalid addresses (out of bounds or has one or more x or z bits).

This commit ensures that unsigned part-select bit addresses which would
otherwise overflow and wrap around within this address space are correctly
handled as out of bounds.
2024-09-16 23:50:24 +02:00
Dag Lem ff47e6bfbe Correct normalization of base address for bit- and part-selects
The required bit width for the address calculation should now be
exactly determined in all cases.

The normalization is also considerably simplified.
2024-09-16 23:05:43 +02:00
Martin Whitaker 25a84d5cfc Update vlog95 test list for tests containing incomplete for loops.
The for loop initialisation statement, termination condition, and step
statement were only made optional in IEEE 1800-2012. Commit 0695c1fe
enforced this. So we need to compile with -g2012. The vlog95 code
generator doesn't currently translate this, so the tests will fail
when compiling the translated code.
2024-09-07 18:08:44 +01:00
Martin Whitaker 2ab57a2b09 Add regression test for return type of $bits (issue #1163). 2024-09-07 17:56:15 +01:00
Martin Whitaker 0136db7ee7 Fix the return type of the $bits system function (issue #1163)
Early editions of the SystemVerilog standard did not specify the return
type for $bits, so we made it 32 bit unsigned 2-state. Later editions
state the return type is integer (32 bit signed 4-state), so make it so.
2024-09-07 17:52:28 +01:00
martinwhitaker 34ed6f6f97
Merge pull request #1168 from steveicarus/fix-vvp-cg-array-word-aliasing
Fix vvp cg array word aliasing
2024-09-07 17:04:57 +01:00
martinwhitaker 74ba42e2df
Merge pull request #1166 from larsclausen/fix-ix-load-sign
tgt-vvp: Use signedness of expression instead of signal for index load
2024-09-07 17:04:40 +01:00
martinwhitaker 07d5c6fb0c
Merge pull request #1164 from larsclausen/fix-undefined-delay
Fix vector assignment with undefined delay
2024-09-07 17:04:16 +01:00
Martin Whitaker ae78218c2f Add regression test for issue #1155. 2024-09-03 21:38:09 +01:00
Martin Whitaker d6abe59983 Improve annotation in vvp code generation. 2024-09-03 21:34:46 +01:00
Martin Whitaker f8947a6aab Fix indentation and white space. 2024-09-03 21:34:12 +01:00
Martin Whitaker d99add9dbe Fix vvp code generator for array word alias corner case (issue #1155)
When multiple words in one array were connected to the same nexus as a
single word array, the code generator was sometimes failing to generate
all the necessary aliases. This was highly dependent on the elaboration
order.

This fix should be more robust, but there are currently no tests in the
test suite that cause the compiler to generate whole-array aliases, and
I can't think of a way to make it do so as we don't yet support unpacked
arrays in module ports, so that branch of the code is currently untested.
2024-09-03 21:24:25 +01:00
Lars-Peter Clausen 841e5a9d9e ivtest: Add regression test to check that shift rhs is always unsigned
Add a regression test to check that the right-hand side of a shift
operation is always treated as unsigned, even if it is a signed registers
or a variation thereof.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2024-09-02 19:09:06 +02:00
Lars-Peter Clausen 50d9a32d56 tgt-vvp: Use signedness of expression instead of signal for index load
When loading a signal into into an index register currently the signedness
of the signal is used when deciding whether sign-extension should be
performed or not. But this can lead to incorrect results, instead the
signedness of the expression must be used as that might be different from
the signal. E.g.

```
reg signed [1:0] = 2'b10;
$display(1 << x[1:0]);
```

gives the wrong result without this.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2024-09-02 19:09:06 +02:00
Lars-Peter Clausen fa83f42cba ivtest: Add regression test for undefined intra-assignment delay
Check that assignments with undefined intra-assignment delay get executed
with zero delay. The assignment should not be skipped.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2024-09-02 14:11:29 +02:00
Lars-Peter Clausen 80fd301fc1 tgt-vvp: Fix vector assignment with undefined delay
Assignments with an undefined intra-assignment delay should be treated like
assignments with zero delay. For the most part this is implemented
correctly, except for assignments to a part of a vector where the offset
inside the vector is an immediate value. E.g.
```
reg [1:0] x;
integer d = 'x;
...
x[0] <= #d 1'b1
```

Here when loading the delay into the index register flag 4 is updated, but
never cleared afterwards. As a result, if the delay is undefined, the vector
assignment will be skipped. Fix this by making sure flag 4 is always
cleared before the vector assignment instruction.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2024-09-02 14:10:25 +02:00
Cary R. cbdaa865a1
Merge pull request #1162 from larsclausen/vvp-immediate
tgt-vvp: Replace `%pushi ...; %op` with `%opi`
2024-08-31 16:50:44 -07:00
Lars-Peter Clausen de9d5e98b1 tgt-vvp: Replace `%pushi ...; %op` with `%opi`
For sequences where the tgt-vvp backend generates `%pushi` followed by one
of the operations that have an immediate version replace it with the
immediate version. This is slightly more efficient.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2024-08-31 13:46:30 +02:00
Cary R 8c56b2d116 libbz2-dev is needed for Ubuntu 24.04 2024-08-16 22:27:27 -07:00
Cary R 99160f65b8 Add Ubuntu 24.04 to the test list 2024-08-16 22:10:49 -07:00
Cary R 6f743cd8db Only add -D__USE_MINGW_ANSI_STDIO=1 for MINGW64/32 2024-08-16 18:37:23 -07:00
Cary R cba2417db5 Update the test files to return the number of failures 2024-08-16 18:20:13 -07:00
Cary R ff9a520742 Updateing to latest files from GTKWave 2024-08-16 17:40:33 -07:00
Cary R 676b36e455 Fix space issues in the source code 2024-07-21 11:19:41 -07:00
Martin Whitaker 548010e36b Fix compiler generation option for br_gh801 tests.
These test null for-loop initialisation and step, so need -g2012.
2024-07-13 11:46:08 +01:00
Martin Whitaker 488fbfc412 Add regression tests for checking for-loops are fully specified in SV 2009-. 2024-07-13 11:37:23 +01:00
Martin Whitaker 0695c1fe9a Only allow null for-loop initialisation/termination/step for SV 2012+.
As discussed in issue #1143, the for loop initialisation statement,
termination condition, and step statement were only made optional in
IEEE 1800-2012. So check all three are present when compiling for
ealier generations.
2024-07-13 11:28:18 +01:00
Martin Whitaker cb6544fac3 Add regression tests for issue #1143. 2024-07-09 22:22:39 +01:00
Martin Whitaker 82a122372b Handle optional condition/step when evaluating for loops at compile time.
This fixes the compiler segfault seen in issue #1143.
2024-07-09 22:06:41 +01:00
Martin Whitaker a204af04a5 Support for loops with no loop condition.
SystemVerilog makes all of the initialisation, condition, and step
components of a for loop optional. We already support this for the
initialisation and step components.
2024-07-09 21:58:15 +01:00
Martin Whitaker 5cbdff202e Add regression tests for checking constant function call scopes. 2024-06-30 11:52:54 +01:00
Martin Whitaker f3092bba93 Correctly identify scopes for constant function calls (issue #1141)
A constant function call may be inside a named block, so we need to
search upwards to find the enclosing module before checking that the
called function is local to that module.

SystemVerilog allows constant function calls to reference functions
in (other) packages or in the $unit scope, so extend the checks to
permit that.
2024-06-30 11:50:59 +01:00
Cary R dc6f9f2049 make exit an alias for finish at the VVP command line 2024-06-17 10:19:44 -07:00
Cary R adb5731ace A package name must have more than three characters 2024-06-17 09:34:13 -07:00
Cary R 0937de3bee Update to the latest GTKWave files 2024-06-17 09:34:03 -07:00
Martin Whitaker 713b002138 vvp: fix regression in behaviour of -N option (issue #1138)
The -N option was broken by PR #1068. This fix modifies and simplifies
the libvvp API that was introduced in that PR.
2024-06-15 10:47:22 +01:00
Cary R 8ac44a38b3
Merge pull request #1136 from gatk555/actions_macos
Revive Action test.yml.
2024-06-13 06:40:20 -07:00
ga 1aa6a159d0 Fix test.yml for Mac by fixing docopt and using Macos-12 runner.
Update the versions of called Actions to prevent warnings.hi and add
"workflow_dispatch" to allow testing.
Unrelated: add "*.so" to .gitignore to hide built libvvp.so.
2024-06-13 10:36:11 +01:00
Martin Whitaker 94d9d19519 Add regression test for issue #1122. 2024-05-06 21:47:18 +01:00
Martin Whitaker 3b61c0088d vvp: handle tranif enable changes that result from island resolution.
The tran island resolution tests and caches the state of all branch
enable inputs before resolving the branch endpoint values. If a
branch enable is connected directly to a branch endpoint, we need
to update the cached stete and rerun the island resolution if any
enable state changed.

This fixes issue #1122.
2024-05-06 21:37:37 +01:00