verilator/include
Christian Hecken b0adf5f7af Add vpi_put/vpi_get support for forcing signals
This commit includes PR #6688.
It adds support for `vpiForceFlag` and `vpiReleaseFlag` to
`vpi_put_value`. `vpi_get_value` is updated to return the value of
either the signal itself, or the `__VforceVal` control signal, depending
on whether the forcing is active.

The functionality is tested in the tests `t_vpi_force`, which tests that
forcing and releasing works on a clocked register being forced with a
VpiIntVal, as well as `t_vpi_forceable_bad`, which tests that attempting
to force a signal without marking it forceable causes an error. The
tests were run under Verilator (based on dc00bf248 with the commit for
isForceable applied), `Icarus Verilog version 13.0 (devel)
(s20251012-20-gcc496c3cf)`, and `xrun 24.09-a071`.

The implementation is simply done using string concatenation of the
signal name with the __VforceEn and __VforceVal suffixes. The signal vop
that the vpi_put/get functions operate on is then pointed towards either
the base signal or the __VforceVal signal (for vpi_put) or the
__VforceRd signal (for vpi_get).

While it works and passes the newly implemented tests, this solution is
quite brittle and in part re-implements existing functionality by
recreating the `__VforceRd` signal, so once #6705 is completed, it
should extend `VerilatedVar` to hold information about the force control
signals, which is provided at Verilation time, rather than a runtime
lookup.

Because `valuep` should get set to the value of the signal after
forcing when `vpi_put_value` is called with `vpiReleaseFlag`, this
commit also adds information about `isContinuously` to the
`VerilatedVarFlags`.

Lastly, since unpacked arrays cannot be forced (#4735), a Verilation
time check for this was added and tested in `t_forceable_unpacked_bad`,
which simplifies the error handling in `vpi_put_value` and
`vpi_get_value`. The same was done for forceable strings, which is
tested in `t_forceable_string_bad`.

Fixes #5933
2025-12-17 14:08:13 +01:00
..
gtkwave Update libfst from upstream 2025-04-12 18:10:40 -04:00
vltstd Commentary: Changes update 2025-05-22 06:45:39 -04:00
.gitignore Support VPI product info, warning calls, etc, bug588. 2013-01-17 21:40:37 -05:00
verilated.cpp Fix stale pointers in VerilatedImpData::m_hierMap (#6726) 2025-12-07 15:42:29 -05:00
verilated.h Add vpi_put/vpi_get support for forcing signals 2025-12-17 14:08:13 +01:00
verilated.mk.in Makefile: Hide deplist echo 2025-11-16 17:16:14 -05:00
verilated.v Copyright year update. 2025-01-01 08:30:25 -05:00
verilated_config.h.in Copyright year update. 2025-01-01 08:30:25 -05:00
verilated_cov.cpp Internals: Fix up include/ cppcheck issues (#6311) 2025-08-20 07:27:55 -04:00
verilated_cov.h Support separate coverage counters for toggles 0->1 and 1->0 (#6086) 2025-08-20 07:31:04 -04:00
verilated_cov_key.h Copyright year update. 2025-01-01 08:30:25 -05:00
verilated_dpi.cpp Internals: Fix up include/ cppcheck issues (#6311) 2025-08-19 21:36:52 -04:00
verilated_dpi.h Internals: Make AstCExpr always cleanOut (#6280) (#6570) 2025-10-19 09:44:33 +01:00
verilated_fst_c.cpp Optimize trace initialization code size (#6749) 2025-12-02 07:19:45 -05:00
verilated_fst_c.h Optimize trace initialization code size (#6749) 2025-12-02 07:19:45 -05:00
verilated_fst_sc.cpp Copyright year update. 2025-01-01 08:30:25 -05:00
verilated_fst_sc.h Copyright year update. 2025-01-01 08:30:25 -05:00
verilated_funcs.h Add `sc_biguint` pragma (#6712) 2025-11-20 17:08:59 -05:00
verilated_imp.h Fix stale pointers in VerilatedImpData::m_hierMap (#6726) 2025-12-07 15:42:29 -05:00
verilated_intrinsics.h Copyright year update. 2025-01-01 08:30:25 -05:00
verilated_probdist.cpp Internals: Favor preincrements. No functional change. 2025-05-09 21:20:35 -04:00
verilated_profiler.cpp Internals: Fix up include/ cppcheck issues (#6311) 2025-08-19 21:36:52 -04:00
verilated_profiler.h Internals: Fix minor macOS issues 2025-11-23 11:04:51 +00:00
verilated_random.cpp Support `std::randomize(){...}` (#4706) (#6573) 2025-11-14 14:32:01 -05:00
verilated_random.h Support array reference arguments into 'std::randomize()' (#6384) (#6719) 2025-11-26 15:50:24 +03:00
verilated_saif_c.cpp Optimize trace initialization code size (#6749) 2025-12-02 07:19:45 -05:00
verilated_saif_c.h Optimize trace initialization code size (#6749) 2025-12-02 07:19:45 -05:00
verilated_saif_sc.h Add `--trace-saif` for SAIF power traces (#5812) 2025-03-07 10:41:29 -05:00
verilated_save.cpp Internals: Fix up include/ cppcheck issues (#6311) 2025-08-19 21:36:52 -04:00
verilated_save.h Internals: Cleanup cppcheck c casts. No functional change intended. 2025-08-21 20:06:43 -04:00
verilated_sc.h Copyright year update. 2025-01-01 08:30:25 -05:00
verilated_sc_trace.h Internals: Fix coverage exclusion markers 2025-10-01 21:22:16 +01:00
verilated_std.sv Support parsing only of covergroup.option.option_name 2025-12-04 21:55:55 -05:00
verilated_std_waiver.vlt Update UVM 1800.2 2017-1.1 waivers 2025-11-01 16:34:31 -04:00
verilated_sym_props.h Add vpi_put/vpi_get support for forcing signals 2025-12-17 14:08:13 +01:00
verilated_syms.h Copyright year update. 2025-01-01 08:30:25 -05:00
verilated_threads.cpp Set runtime worker thread stack sizes on macOS (#6721) 2025-11-22 20:13:46 -05:00
verilated_threads.h Set runtime worker thread stack sizes on macOS (#6721) 2025-11-22 20:13:46 -05:00
verilated_timing.cpp Fix `--timing` with `--x-initial-edge` (#6603) (#6631) 2025-11-03 09:39:23 -05:00
verilated_timing.h Fix 'experimental/coroutine' file not found on macOS (#5030) (#5031) (#5151) 2024-06-08 08:33:50 -04:00
verilated_trace.h Fix missing net type mappings in FST traces (#6582) (#6583) 2025-10-21 21:07:51 -04:00
verilated_trace_imp.h Commentary: spelling 2025-08-25 18:47:08 -04:00
verilated_types.h Internals: Replace VlTriggerVec with unpacked array (#6616) 2025-10-31 18:29:11 +00:00
verilated_vcd_c.cpp Optimize trace initialization code size (#6749) 2025-12-02 07:19:45 -05:00
verilated_vcd_c.h Optimize trace initialization code size (#6749) 2025-12-02 07:19:45 -05:00
verilated_vcd_sc.cpp Copyright year update. 2025-01-01 08:30:25 -05:00
verilated_vcd_sc.h Copyright year update. 2025-01-01 08:30:25 -05:00
verilated_vpi.cpp Add vpi_put/vpi_get support for forcing signals 2025-12-17 14:08:13 +01:00
verilated_vpi.h Copyright year update. 2025-01-01 08:30:25 -05:00
verilatedos.h Fix extern function that returns parametrized class (#4924). 2025-12-06 16:16:06 -05:00
verilatedos_c.h Internals: cppcheck fixes. No functional change. (#6687) 2025-11-12 18:54:22 -05:00