Skip to main content

Rv32ZkndInstruction

Enum Rv32ZkndInstruction 

Source
pub enum Rv32ZkndInstruction<Reg> {
    Aes32Dsi {
        rd: Reg,
        rs1: Reg,
        rs2: Reg,
        bs: Rv32AesBs,
    },
    Aes32Dsmi {
        rd: Reg,
        rs1: Reg,
        rs2: Reg,
        bs: Rv32AesBs,
    },
}
Expand description

RISC-V RV32 Zknd instructions (AES decryption)

Variants§

§

Aes32Dsi

AES final round decryption step: InvSubBytes on one byte of rs2, rotated to the byte lane selected by bs, XOR’d into rs1.

rd = rs1 ^ rol32(INV_SBOX[(rs2 >> (bs*8)) & 0xff] as u32, bs*8)

Fields

§rd: Reg
§rs1: Reg
§rs2: Reg
§

Aes32Dsmi

AES middle round decryption step: InvSubBytes + partial InvMixColumns on one byte of rs2, rotated to the byte lane selected by bs, XOR’d into rs1.

rd = rs1 ^ rol32(InvMixColByte(INV_SBOX[(rs2 >> (bs*8)) & 0xff]), bs*8)

Fields

§rd: Reg
§rs1: Reg
§rs2: Reg

Trait Implementations§

Source§

impl<Reg: Clone> Clone for Rv32ZkndInstruction<Reg>

Source§

fn clone(&self) -> Rv32ZkndInstruction<Reg>

Returns a duplicate 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<Reg: Debug> Debug for Rv32ZkndInstruction<Reg>

Source§

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

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

impl<Reg> Display for Rv32ZkndInstruction<Reg>
where Reg: Display,

Source§

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

Formats the value using the given formatter. Read more
§

impl<Reg> Instruction for Rv32ZkndInstruction<Reg>
where Reg: Register<Type = u32>,

Encoding layout (R-type, opcode 0x33, funct3 0x0):

[31:30] bs       - 2-bit byte select
[29:25] funct5   - 0b10101 (aes32dsi) / 0b10111 (aes32dsmi)
[24:20] rs2
[19:15] rs1
[14:12] funct3   - 0b000
[11:7]  rd
[6:0]   opcode   - 0b0110011 (OP)

Ratified match/mask values (from riscv-opcodes): MATCH_AES32DSI = 0x2a000033, MASK_AES32DSI = 0x3e00707f MATCH_AES32DSMI = 0x2e000033, MASK_AES32DSMI = 0x3e00707f

rd and rs1 are independent fields. The assembler convention places the accumulator in both rd and rs1 (the rt pattern), but the hardware does not require rd == rs1 and the decoder must not enforce it.

§

type Reg = Reg

A register type used by the instruction
§

fn try_decode(instruction: u32) -> Option<Self>

Try to decode a single valid instruction
§

fn alignment() -> u8

Instruction alignment in bytes
§

fn size(&self) -> u8

Instruction size in bytes
Source§

impl<Reg: PartialEq> PartialEq for Rv32ZkndInstruction<Reg>

Source§

fn eq(&self, other: &Rv32ZkndInstruction<Reg>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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<Reg: Copy> Copy for Rv32ZkndInstruction<Reg>

Source§

impl<Reg: Eq> Eq for Rv32ZkndInstruction<Reg>

Source§

impl<Reg> StructuralPartialEq for Rv32ZkndInstruction<Reg>

Auto Trait Implementations§

§

impl<Reg> Freeze for Rv32ZkndInstruction<Reg>
where Reg: Freeze,

§

impl<Reg> RefUnwindSafe for Rv32ZkndInstruction<Reg>
where Reg: RefUnwindSafe,

§

impl<Reg> Send for Rv32ZkndInstruction<Reg>
where Reg: Send,

§

impl<Reg> Sync for Rv32ZkndInstruction<Reg>
where Reg: Sync,

§

impl<Reg> Unpin for Rv32ZkndInstruction<Reg>
where Reg: Unpin,

§

impl<Reg> UnsafeUnpin for Rv32ZkndInstruction<Reg>
where Reg: UnsafeUnpin,

§

impl<Reg> UnwindSafe for Rv32ZkndInstruction<Reg>
where Reg: 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> 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.