::std::ports::

Entity read_mut_wire

pub extern entity read_mut_wire<T>(p: inv T) -> T
Expand

Reads the current value of a inv value.

Most of the time port should be preferred, as it provides both directions at the same place and those can be passed around wherever they are needed. But sometimes, passing the forward value along in a deep hierarchy to where it is needed pollutes type signatures for little benefit. As a practical solution, read_mut_wire can be used instead to bypass Spade semantics safely and get the value from the inv direction instead.

Examples

let (fwd, back) = port;
set back = true;
assert fwd == true;
assert inst read_mut_wire(back) == true;