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>

source

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

pub fn find_idx(self, f: impl Fn(V) -> bool) -> HOption<U<{ _ }>>

Finds the index of the first element that satisfies the given condition.

source§

impl<V: Copy, const N: usize> Array<V, N>

source

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.

source

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.

source

pub fn clip_const<const M: usize>(self, _index: usize) -> Array<V, M>

Returns a new clipped array of size M starting from index.

source

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.

source

pub fn enumerate(self) -> Array<(U<{ _ }>, V), N>

Returns a new array whose elements are enumerated with their indices.

source

pub fn map<W: Copy, F: FnOnce(V) -> W>(self, _f: F) -> Array<W, N>

Transforms elements of self using f.

source

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)

source

pub fn any<F: Fn(V) -> bool>(self, f: F) -> bool

Tests if any element matches a predicate.

source

pub fn all<F: Fn(V) -> bool>(self, f: F) -> bool

Tests if every element matches a predicate. TODO: Use tree fold?

source

pub fn resize<const M: usize>(self) -> Array<V, M>

Resizes the given array.

source

pub fn chunk<const M: usize>(self) -> Array<Array<V, M>, { _ }>

Chunks the array into an array of arrays.

source

pub fn append<const M: usize>(self, _other: Array<V, M>) -> Array<V, { _ }>

Returns a new array with the two given arrays appended.

source

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.

source

pub fn cartesian_product<W: Copy, const M: usize>( self, other: Array<W, M> ) -> Array<(V, W), { _ }>

Returns a Cartesian product of the two arrays.

source

pub fn reverse(self) -> Array<V, N>

Reverses the array.

source§

impl<V: Copy, const N: usize, const M: usize> Array<Array<V, N>, M>

source

pub fn concat(self) -> Array<V, { _ }>

Concatenates the array of arrays into a 1D array.

source§

impl<const N: usize> Array<bool, N>

source

pub fn trunk_add(self, rhs: Self) -> Self

Adds two U<N>s and truncate the result to U<N>.

source§

impl<const N: usize> Array<bool, N>

source

pub fn unsigned_max() -> U<N>

Returns the maximum value of an N bit unsigned value. (i.e., 2^N - 1)

Trait Implementations§

source§

impl Add<Array<bool, MAX_ADDR_BITS>> for LocalAddr

§

type Output = LocalAddr

The resulting type after applying the + operator.
source§

fn add(self, rhs: U<MAX_ADDR_BITS>) -> Self::Output

Performs the + operation. Read more
source§

impl<V: Copy, const N: usize> BitAnd for Array<V, N>

§

type Output = Array<V, N>

The resulting type after applying the & operator.
source§

fn bitand(self, _rhs: Self) -> Self::Output

Performs the & operation. Read more
source§

impl<V: Copy, const N: usize> BitOr for Array<V, N>

§

type Output = Array<V, N>

The resulting type after applying the | operator.
source§

fn bitor(self, _rhs: Self) -> Self::Output

Performs the | operation. Read more
source§

impl<V: Copy, const N: usize> BitXor for Array<V, N>

§

type Output = Array<V, N>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, _rhs: Self) -> Self

Performs the ^ operation. Read more
source§

impl<V: Clone + Copy, const N: usize> Clone for Array<V, N>

source§

fn clone(&self) -> Array<V, N>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<V: Debug + Copy, const N: usize> Debug for Array<V, N>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<V: Copy + Default, const N: usize> Default for Array<V, N>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<V: Copy, const N: usize> From<[V; N]> for Array<V, N>

source§

fn from(_value: [V; N]) -> Self

Converts to this type from the input type.
source§

impl From<Array<bool, 2>> for ConfigCmd

source§

fn from(value: U<2>) -> ConfigCmd

Converts to this type from the input type.
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>

source§

fn from(value: U<64>) -> Self

Converts to this type from the input type.
source§

impl From<Array<bool, 64>> for ConfigMvoutRs1

source§

fn from(value: U<64>) -> Self

Converts to this type from the input type.
source§

impl<const ACC_SCALE_BITS: usize, const STRIDE_BITS: usize> From<Array<bool, 64>> for ConfigMvoutRs2<ACC_SCALE_BITS, STRIDE_BITS>

source§

fn from(value: U<64>) -> Self

Converts to this type from the input type.
source§

impl<const ACC_BITS: usize> From<Array<bool, 64>> for ConfigNormRs1<ACC_BITS>

source§

fn from(value: U<64>) -> Self

Converts to this type from the input type.
source§

impl<const ACC_BITS: usize> From<Array<bool, 64>> for ConfigNormRs2<ACC_BITS>

source§

fn from(value: U<64>) -> Self

Converts to this type from the input type.
source§

impl From<Array<bool, 64>> for LocalAddr

source§

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]
source§

impl<const ROWS_BITS: usize, const COLS_BITS: usize> From<Array<bool, 64>> for MvinRs2<ROWS_BITS, COLS_BITS>

source§

fn from(value: U<64>) -> Self

Converts to this type from the input type.
source§

impl<const ROWS_BITS: usize, const COLS_BITS: usize> From<Array<bool, 64>> for MvoutRs2<ROWS_BITS, COLS_BITS>

source§

fn from(value: U<64>) -> Self

Converts to this type from the input type.
source§

impl<const N: usize> From<Array<bool, N>> for S<N>

source§

fn from(value: U<N>) -> S<N>

Converts to this type from the input type.
source§

impl<const N: usize> From<Array<bool, N>> for bool

source§

fn from(_value: U<N>) -> bool

Converts to this type from the input type.
source§

impl<const N: usize> From<Array<bool, N>> for u32

source§

fn from(_value: U<N>) -> Self

Converts to this type from the input type.
source§

impl<const N: usize> From<Array<bool, N>> for u8

source§

fn from(_value: U<N>) -> Self

Converts to this type from the input type.
source§

impl<V: Copy, const N: usize, const M: usize> Index<Array<bool, N>> for Array<V, M>

§

type Output = V

The returned type after indexing.
source§

fn index(&self, _idx: U<N>) -> &V

Performs the indexing (container[index]) operation. Read more
source§

impl<V: Copy, const M: usize> Index<usize> for Array<V, M>

§

type Output = V

The returned type after indexing.
source§

fn index(&self, _idx: usize) -> &V

Performs the indexing (container[index]) operation. Read more
source§

impl<const N: usize, const M: usize> Mul<Array<bool, M>> for U<N>

§

type Output = Array<bool, { N + M }>

The resulting type after applying the * operator.
source§

fn mul(self, _other: U<M>) -> Self::Output

Performs the * operation. Read more
source§

impl<V: Copy, const N: usize> PartialEq for Array<V, N>

source§

fn eq(&self, _other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
source§

fn ne(&self, _other: &Self) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const N: usize, const M: usize> Shl<Array<bool, M>> for U<N>

§

type Output = Array<bool, N>

The resulting type after applying the << operator.
source§

fn shl(self, _lhs: U<M>) -> Self::Output

Performs the << operation. Read more
source§

impl<const N: usize, const M: usize> Shr<Array<bool, M>> for U<N>

§

type Output = Array<bool, N>

The resulting type after applying the >> operator.
source§

fn shr(self, _rhs: U<M>) -> Self::Output

Performs the >> operation. Read more
source§

impl<V: Copy + Copy, const N: usize> Copy for Array<V, N>

Auto Trait Implementations§

§

impl<V, const N: usize> RefUnwindSafe for Array<V, N>
where V: RefUnwindSafe,

§

impl<V, const N: usize> Send for Array<V, N>
where V: Send,

§

impl<V, const N: usize> Sync for Array<V, N>
where V: Sync,

§

impl<V, const N: usize> Unpin for Array<V, N>
where V: Unpin,

§

impl<V, const N: usize> UnwindSafe for Array<V, N>
where V: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> RepeatExt for T
where T: Copy,

source§

fn repeat<const N: usize>(self) -> Array<T, N>

Returns an array with the given value repeated N times.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.