verilator/docs/guide
Geza Lore bc892deacc
Safely support non-overlapping blocking/non-blocking assignments (#6137)
The manual for the BLKANDNBLK warning describes that it is safe to
disable that error if the updated ranges are non-overlapping. This
however was not true (see the added t_nba_mixed_update* tests).

In this patch we change V3Delayed to use a new ShadowVarMasked
scheme for variables that have mixed blocking and non-blocking 
updates (or the FlagUnique scheme for unpacked variables), which
is in fact safe to use when the updated parts are non-overlapping.

Furthermore, mixed assignments are safe as far as scheduling is
concerned if either:

- They are to independent parts (bits/members/etc) (with this patch)
- Or if the blocking assignment is in clocked (or suspendable) logic.

The risk in scheduling is a race between the Post scheduled NBA
commit, and blocking assignments in combinational logic, which might
order incorrectly.

The second point highlights that we can handle stuff like this safely,
which is sometimes used in testbenches:

```systemverilog
always @(posedge clk) begin
    if ($time == 0) a = 0;
end

always @(posedge clk) begin
    if ($time > 0) a <= 2;
end
````

The only dangerous case is:

```systemverilog
always @(posedge clk) foo[idx] <= val;
assign foo[0] = bar;
```

Whit this patch, this will still resolve fine at run-time if 'idx' is
never zero, but might resolve incorrectly if 'idx' is zero.

With the above in mind, the BLKANDNBLK warning is now only issued if:

- We can't prove that the assignments are to non-overlapping bits
- And the blocking assignment is in combinational logic

These are the cases that genuinely require user attention to resolve.

With this patch, there are no more BLKANDNBLK warnings in the RTLMeter
designs.

Fixes #6122.
2025-06-28 20:45:45 +01:00
..
figures Verilator_gantt now shows the predicted mtask times, eval times, and additional statistics. 2021-09-23 22:59:36 -04:00
changes.rst Copyright year update. 2025-01-01 08:30:25 -05:00
conf.py Commentary 2025-03-30 11:02:21 -04:00
connecting.rst Commentary 2025-03-30 11:02:21 -04:00
contributing.rst Commentary: Fix bugpoint link (#5883) 2025-03-26 07:05:18 -04:00
contributors.rst Commentary: Fix broken links 2025-06-15 14:51:56 -04:00
copyright.rst Copyright year update. 2025-01-01 08:30:25 -05:00
deprecations.rst Copyright year update. 2025-01-01 08:30:25 -05:00
environment.rst Copyright year update. 2025-01-01 08:30:25 -05:00
example_binary.rst Copyright year update. 2025-01-01 08:30:25 -05:00
example_cc.rst Copyright year update. 2025-01-01 08:30:25 -05:00
example_common_install.rst Copyright year update. 2025-01-01 08:30:25 -05:00
example_dist.rst Copyright year update. 2025-01-01 08:30:25 -05:00
example_sc.rst Copyright year update. 2025-01-01 08:30:25 -05:00
examples.rst Copyright year update. 2025-01-01 08:30:25 -05:00
exe_sim.rst Cleanup documentated option sort order, and enforce with test 2025-04-26 17:14:49 -04:00
exe_verilator.rst Rename Verilator Config Files to Verilator Control Files. 2025-06-27 20:38:01 -04:00
exe_verilator_coverage.rst Add filtering type option in verilator_coverage (#6030) 2025-05-22 02:42:09 -07:00
exe_verilator_gantt.rst Cleanup documentated option sort order, and enforce with test 2025-04-26 17:14:49 -04:00
exe_verilator_profcfunc.rst Cleanup documentated option sort order, and enforce with test 2025-04-26 17:14:49 -04:00
executables.rst Copyright year update. 2025-01-01 08:30:25 -05:00
extensions.rst Rename Verilator Config Files to Verilator Control Files. 2025-06-27 20:38:01 -04:00
faq.rst Fix spelling 2025-05-16 19:02:19 -04:00
files.rst Support SARIF JSON diagnostic output with `--diagnostics-sarif`. (#6017) 2025-05-17 15:46:15 -04:00
index.rst Copyright year update. 2025-01-01 08:30:25 -05:00
install-cmake.rst Copyright year update. 2025-01-01 08:30:25 -05:00
install.rst Internals/CI: Format cmakefiles using mbake 2025-06-26 17:36:56 -04:00
languages.rst Rename Verilator Config Files to Verilator Control Files. 2025-06-27 20:38:01 -04:00
overview.rst Copyright year update. 2025-01-01 08:30:25 -05:00
simulating.rst Rename Verilator Config Files to Verilator Control Files. 2025-06-27 20:38:01 -04:00
verilating.rst Rename Verilator Config Files to Verilator Control Files. 2025-06-27 20:38:01 -04:00
warnings.rst Safely support non-overlapping blocking/non-blocking assignments (#6137) 2025-06-28 20:45:45 +01:00