Struct hazardflow_designs::std::value::Array
source · pub struct Array<V: Copy, const N: usize> { /* private fields */ }
Expand description
An array of signals.
Implementations§
source§impl<V: Copy + Default, const N: usize> Array<V, N>
impl<V: Copy + Default, const N: usize> Array<V, N>
sourcepub fn fold_assoc<F: FnOnce(V, V) -> V>(self, f: F) -> V
pub fn fold_assoc<F: FnOnce(V, V) -> V>(self, f: F) -> V
Folds the array into a single value.
The fold order is not guaranteed, so the operation f
must be associative.
source§impl<V: Copy, const N: usize> Array<V, N>
impl<V: Copy, const N: usize> Array<V, N>
sourcepub fn set<Idx: Into<U<{ _ }>>>(self, _idx: Idx, _elt: V) -> Array<V, N>
pub fn set<Idx: Into<U<{ _ }>>>(self, _idx: Idx, _elt: V) -> Array<V, N>
Returns a new array with the idx
-th element set to elt
.
sourcepub fn set_cond(self, cond: bool, idx: U<{ _ }>, elt: V) -> Array<V, N>
pub fn set_cond(self, cond: bool, idx: U<{ _ }>, elt: V) -> Array<V, N>
Returns a new array with the idx
-th element set to elt
if cond
is true.
sourcepub fn clip_const<const M: usize>(self, _index: usize) -> Array<V, M>
pub fn clip_const<const M: usize>(self, _index: usize) -> Array<V, M>
Returns a new clipped array of size M
starting from index
.
sourcepub fn zip<W: Copy>(self, _other: Array<W, N>) -> Array<(V, W), N>
pub fn zip<W: Copy>(self, _other: Array<W, N>) -> Array<(V, W), N>
Returns a new array that has tuples from the two given arrays as elements.
sourcepub fn enumerate(self) -> Array<(U<{ _ }>, V), N>
pub fn enumerate(self) -> Array<(U<{ _ }>, V), N>
Returns a new array whose elements are enumerated with their indices.
sourcepub fn map<W: Copy, F: FnOnce(V) -> W>(self, _f: F) -> Array<W, N>
pub fn map<W: Copy, F: FnOnce(V) -> W>(self, _f: F) -> Array<W, N>
Transforms elements of self
using f
.
sourcepub fn fold<B: Copy, F: FnOnce(B, V) -> B>(self, _init: B, _f: F) -> B
pub fn fold<B: Copy, F: FnOnce(B, V) -> B>(self, _init: B, _f: F) -> B
Folds the array into a single value.
The fold order is from left to right. (i.e. foldl
)
sourcepub fn all<F: Fn(V) -> bool>(self, f: F) -> bool
pub fn all<F: Fn(V) -> bool>(self, f: F) -> bool
Tests if every element matches a predicate. TODO: Use tree fold?
sourcepub fn chunk<const M: usize>(self) -> Array<Array<V, M>, { _ }>
pub fn chunk<const M: usize>(self) -> Array<Array<V, M>, { _ }>
Chunks the array into an array of arrays.
sourcepub fn append<const M: usize>(self, _other: Array<V, M>) -> Array<V, { _ }>
pub fn append<const M: usize>(self, _other: Array<V, M>) -> Array<V, { _ }>
Returns a new array with the two given arrays appended.
sourcepub fn set_range<const M: usize>(
self,
_index: usize,
_other: Array<V, M>
) -> Array<V, N>
pub fn set_range<const M: usize>( self, _index: usize, _other: Array<V, M> ) -> Array<V, N>
Returns a new array with the M
elements starting from index
set to the elements of other
.
Trait Implementations§
source§impl<const SCALE_BITS: usize, const STRIDE_BITS: usize, const PIXEL_REPEAT_BITS: usize> From<Array<bool, 64>> for ConfigMvinRs1<SCALE_BITS, STRIDE_BITS, PIXEL_REPEAT_BITS>
impl<const SCALE_BITS: usize, const STRIDE_BITS: usize, const PIXEL_REPEAT_BITS: usize> From<Array<bool, 64>> for ConfigMvinRs1<SCALE_BITS, STRIDE_BITS, PIXEL_REPEAT_BITS>
source§impl<const ACC_SCALE_BITS: usize, const STRIDE_BITS: usize> From<Array<bool, 64>> for ConfigMvoutRs2<ACC_SCALE_BITS, STRIDE_BITS>
impl<const ACC_SCALE_BITS: usize, const STRIDE_BITS: usize> From<Array<bool, 64>> for ConfigMvoutRs2<ACC_SCALE_BITS, STRIDE_BITS>
source§impl From<Array<bool, 64>> for LocalAddr
impl From<Array<bool, 64>> for LocalAddr
source§fn from(value: U<64>) -> Self
fn from(value: U<64>) -> Self
Reterive 32 bits address.
let addr: U<32> = value[31:0]
value[63:32]
means the number of rows and columns.
Address scheme.
- is_acc_addr:
addr[31]
- accumulate:
addr[30]
- read_full_acc_row:
addr[29]
- norm_cmd:
addr[28:26]
- garbage:
addr[25:15]
- is_garbage:
addr[14]
- data:
addr[13:0]