Primitive inv
Expand
Inverted version of a type where the T and inv T fields of a non-Data/port struct are changed.
Implementations
impl<T, #uint N> [inv T; N]
fn transpose(self) -> inv [T; N]
Transposes an array of inv values into an inv array.
This transformation preserves the low level signals behind the value, but presents them in
a new format that is easier to set.
Examples
let x = port();
let y = port();
let array_of_invs: [inv bool; 2] = [x.1, y.1];
let inv_array: inv [bool; 2] = array_of_invs.transpose();
set inv_array = [true, false];
assert x.0 == true;
assert y.0 == false;impl<T> inv T
pub fn inspect(self) -> (T, Self)
Retrieves the contents of an inv wire alongside a copy of itself.
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 through a deep hierarchy to where it is needed pollutes type signatures
for little benefit. As a practical solution, (inv T)::inspect can be used instead to tap
into an existing inv wire by connecting a new port to it, consuming it and getting both
the forward value and a fresh inv value.
Examples
let (fwd, back) = port();
let (new_fwd, new_back) = back.inspect();
set new_back = true;
assert fwd == true;
assert new_fwd == true;