Skip to main content

ParallelAlu

Enum ParallelAlu 

Source
pub enum ParallelAlu {
Show 41 variants Move, TfrAcc { src: Accumulator, d: Accumulator, }, Addr { src: Accumulator, d: Accumulator, }, Tst { d: Accumulator, }, CmpAcc { src: Accumulator, d: Accumulator, }, Subr { src: Accumulator, d: Accumulator, }, CmpmAcc { src: Accumulator, d: Accumulator, }, AddAcc { src: Accumulator, d: Accumulator, }, Rnd { d: Accumulator, }, Addl { src: Accumulator, d: Accumulator, }, Clr { d: Accumulator, }, SubAcc { src: Accumulator, d: Accumulator, }, Max, Maxm, Subl { src: Accumulator, d: Accumulator, }, Not { d: Accumulator, }, AddXY { hi: usize, lo: usize, d: Accumulator, }, Adc { hi: usize, lo: usize, d: Accumulator, }, SubXY { hi: usize, lo: usize, d: Accumulator, }, Sbc { hi: usize, lo: usize, d: Accumulator, }, Asr { d: Accumulator, }, Lsr { d: Accumulator, }, Abs { d: Accumulator, }, Ror { d: Accumulator, }, Asl { d: Accumulator, }, Lsl { d: Accumulator, }, Neg { d: Accumulator, }, Rol { d: Accumulator, }, AddReg { src: usize, d: Accumulator, }, TfrReg { src: usize, d: Accumulator, }, Or { src: usize, d: Accumulator, }, Eor { src: usize, d: Accumulator, }, SubReg { src: usize, d: Accumulator, }, CmpReg { src: usize, d: Accumulator, }, And { src: usize, d: Accumulator, }, CmpmReg { src: usize, d: Accumulator, }, Mpy { negate: bool, s1: usize, s2: usize, d: Accumulator, }, Mpyr { negate: bool, s1: usize, s2: usize, d: Accumulator, }, Mac { negate: bool, s1: usize, s2: usize, d: Accumulator, }, Macr { negate: bool, s1: usize, s2: usize, d: Accumulator, }, Undefined,
}
Expand description

Decoded parallel ALU operation (bits 7:0 of a parallel instruction).

The encoding is defined in DSP56300FM Tables 12-19 and 12-20:

  • Non-multiply (0x00-0x7F): 0 JJJ D kkk
  • Multiply (0x80-0xFF): 1 QQQ d kkk

Variants§

§

Move

0x00: No ALU operation (move-only parallel)

§

TfrAcc

§

Addr

§

Tst

Fields

§

CmpAcc

§

Subr

§

CmpmAcc

§

AddAcc

§

Rnd

Fields

§

Addl

§

Clr

Fields

§

SubAcc

§

Max

0x1D: always max a,b

§

Maxm

0x15: always maxm a,b

§

Subl

§

Not

Fields

§

AddXY

§

Adc

§

SubXY

§

Sbc

§

Asr

Fields

§

Lsr

Fields

§

Abs

Fields

§

Ror

Fields

§

Asl

Fields

§

Lsl

Fields

§

Neg

Fields

§

Rol

Fields

§

AddReg

Fields

§src: usize
§

TfrReg

Fields

§src: usize
§

Or

Fields

§src: usize
§

Eor

Fields

§src: usize
§

SubReg

Fields

§src: usize
§

CmpReg

Fields

§src: usize
§

And

Fields

§src: usize
§

CmpmReg

Fields

§src: usize
§

Mpy

Fields

§negate: bool
§

Mpyr

Fields

§negate: bool
§

Mac

Fields

§negate: bool
§

Macr

Fields

§negate: bool
§

Undefined

Undefined encoding (0x04, 0x08, 0x0C, 0x15)

Implementations§

Source§

impl ParallelAlu

Source

pub fn encode(&self) -> Option<u8>

Encode back to the ALU byte. Returns None for Undefined.

Source

pub fn dest_accumulator(&self) -> Option<Accumulator>

The destination accumulator of this ALU operation, if any. Returns None for Move, Undefined, and comparison/test ops (Cmp*, Cmpm*, Tst).

Source

pub fn from_text(text: &str) -> Option<ParallelAlu>

Parse from the display text format (inverse of Display).

Accepts strings like "add x,a", "mpy +x0,y1,b", "move", etc.

Source

pub fn is_logical_or_shift(&self) -> bool

Whether this is a logical or shift operation (writes only A1/B1, not full accumulator).

Trait Implementations§

Source§

impl Clone for ParallelAlu

Source§

fn clone(&self) -> ParallelAlu

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for ParallelAlu

Source§

impl Debug for ParallelAlu

Source§

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

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

impl Display for ParallelAlu

Source§

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

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

impl Eq for ParallelAlu

Source§

impl PartialEq for ParallelAlu

Source§

fn eq(&self, other: &ParallelAlu) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for ParallelAlu

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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>,

Source§

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.