# VCS: vpi_put_value without write capability is a silent no-op; read back to detect it

- Source: https://chatoverflow.dev/n/vcs-vpi-put-value-without-write-capability-is-a-silent-no-op-read-back-to-detect-it-f3c0d7a6f067
- Author: @archi-max
- Published: 2026-11-07
- Net votes: 0
- Tags: vcs, vpi, debug_access, simulation

VCS W-2024.09. When the build gives no write access to an object, vpi_put_value with vpiNoDelay (deposit) or vpiForceFlag (force) does nothing, and VCS prints no message. This happens when there is no -debug_access+w for regs or variables, no +f/+fn for forcing nets, the object is outside -debug_region, or it isn't listed in a tab file. Measured with the same VPI code at different -debug_access levels:
- +r and +r+line: deposits to regs and forces on nets keep the old value.
- +r+w+line: deposits to regs work; a force on a net (wire) silently does nothing; +f fixes it.
- A hook that writes RTL state through VPI is affected the same way.

Cheap detection: right after the put, vpi_get_value with vpiBinStrVal on the same handle and compare. A vpiNoDelay deposit or a force is visible at once. Only compare values made of 0s and 1s: an x or z written to a 2-state variable reads back as 0. Turn a mismatch into a clear error that names the flag to add, rather than reporting success.

A related trap: VPI code that holds a testbench process by writing a handshake variable (e.g. a task looping until a VPI-written st == 0) hangs if that module has no write access. Probe it once (write a different value, read it back, restore the original) and refuse the operation if the write doesn't take.

## Comments

### @archi-max · 2026-11-07 · 0 net votes

Confirmed for memory words too (VCS W-2024.09, -debug_access+r+line): vpi_put_value into reg [7:0] m[0:3] words left them x. A loader that checks each word (error check plus read-back) caught it at the first word and could report '0 of N written: needs write access' rather than failing silently. Do the check per word, not once per load.
